diff --git a/AdbCommandForm.cs b/AdbCommandForm.cs new file mode 100644 index 0000000..b40ee05 --- /dev/null +++ b/AdbCommandForm.cs @@ -0,0 +1,240 @@ +using System; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Windows.Forms; + +namespace AndroidSideloader +{ + public partial class AdbCommandForm : Form + { + public string Command { get; private set; } + public bool ToggleUpdatesClicked { get; private set; } + + public AdbCommandForm() + { + InitializeComponent(); + } + + private void InitializeComponent() + { + this.lblTitle = new Label(); + this.txtCommand = new TextBox(); + this.btnSend = new RoundButton(); + this.btnToggleUpdates = new RoundButton(); + this.btnClose = new RoundButton(); + this.separator = new Panel(); + this.lblHint = new Label(); + this.SuspendLayout(); + // + // lblTitle + // + this.lblTitle.AutoSize = true; + this.lblTitle.Font = new Font("Segoe UI", 11F, FontStyle.Bold); + this.lblTitle.ForeColor = Color.FromArgb(93, 203, 173); + this.lblTitle.Location = new Point(20, 15); + this.lblTitle.Name = "lblTitle"; + this.lblTitle.Size = new Size(140, 20); + this.lblTitle.TabIndex = 0; + this.lblTitle.Text = "Run ADB Command"; + // + // txtCommand + // + this.txtCommand.BackColor = Color.FromArgb(40, 44, 52); + this.txtCommand.BorderStyle = BorderStyle.FixedSingle; + this.txtCommand.Font = new Font("Consolas", 10F); + this.txtCommand.ForeColor = Color.White; + this.txtCommand.Location = new Point(24, 50); + this.txtCommand.Name = "txtCommand"; + this.txtCommand.Size = new Size(292, 23); + this.txtCommand.TabIndex = 1; + this.txtCommand.KeyPress += TxtCommand_KeyPress; + // + // lblHint + // + this.lblHint.AutoSize = true; + this.lblHint.Font = new Font("Segoe UI", 8F); + this.lblHint.ForeColor = Color.FromArgb(120, 120, 120); + this.lblHint.Location = new Point(24, 78); + this.lblHint.Name = "lblHint"; + this.lblHint.Size = new Size(200, 13); + this.lblHint.TabIndex = 2; + this.lblHint.Text = "Enter command without \"adb\" prefix"; + // + // separator + // + this.separator.BackColor = Color.FromArgb(50, 55, 65); + this.separator.Location = new Point(20, 105); + this.separator.Name = "separator"; + this.separator.Size = new Size(300, 1); + this.separator.TabIndex = 3; + // + // btnSend + // + this.btnSend.Active1 = Color.FromArgb(113, 223, 193); + this.btnSend.Active2 = Color.FromArgb(113, 223, 193); + this.btnSend.BackColor = Color.Transparent; + this.btnSend.Cursor = Cursors.Hand; + this.btnSend.DialogResult = DialogResult.OK; + this.btnSend.Disabled1 = Color.FromArgb(32, 35, 45); + this.btnSend.Disabled2 = Color.FromArgb(25, 28, 35); + this.btnSend.DisabledStrokeColor = Color.FromArgb(50, 55, 65); + this.btnSend.Font = new Font("Segoe UI", 9F, FontStyle.Bold); + this.btnSend.ForeColor = Color.FromArgb(20, 24, 29); + this.btnSend.Inactive1 = Color.FromArgb(93, 203, 173); + this.btnSend.Inactive2 = Color.FromArgb(93, 203, 173); + this.btnSend.Location = new Point(24, 120); + this.btnSend.Name = "btnSend"; + this.btnSend.Radius = 5; + this.btnSend.Size = new Size(140, 30); + this.btnSend.Stroke = false; + this.btnSend.StrokeColor = Color.FromArgb(93, 203, 173); + this.btnSend.TabIndex = 4; + this.btnSend.Text = "SEND COMMAND"; + this.btnSend.Transparency = false; + this.btnSend.Click += BtnSend_Click; + // + // btnToggleUpdates + // + this.btnToggleUpdates.Active1 = Color.FromArgb(50, 55, 65); + this.btnToggleUpdates.Active2 = Color.FromArgb(50, 55, 65); + this.btnToggleUpdates.BackColor = Color.Transparent; + this.btnToggleUpdates.Cursor = Cursors.Hand; + this.btnToggleUpdates.DialogResult = DialogResult.None; + this.btnToggleUpdates.Disabled1 = Color.FromArgb(32, 35, 45); + this.btnToggleUpdates.Disabled2 = Color.FromArgb(25, 28, 35); + this.btnToggleUpdates.DisabledStrokeColor = Color.FromArgb(50, 55, 65); + this.btnToggleUpdates.Font = new Font("Segoe UI", 9F); + this.btnToggleUpdates.ForeColor = Color.White; + this.btnToggleUpdates.Inactive1 = Color.FromArgb(40, 44, 52); + this.btnToggleUpdates.Inactive2 = Color.FromArgb(40, 44, 52); + this.btnToggleUpdates.Location = new Point(176, 120); + this.btnToggleUpdates.Name = "btnToggleUpdates"; + this.btnToggleUpdates.Radius = 5; + this.btnToggleUpdates.Size = new Size(140, 30); + this.btnToggleUpdates.Stroke = true; + this.btnToggleUpdates.StrokeColor = Color.FromArgb(60, 65, 75); + this.btnToggleUpdates.TabIndex = 5; + this.btnToggleUpdates.Text = "Toggle OS Updates"; + this.btnToggleUpdates.Transparency = false; + this.btnToggleUpdates.Click += BtnToggleUpdates_Click; + // + // btnClose + // + this.btnClose.Active1 = Color.FromArgb(60, 65, 75); + this.btnClose.Active2 = Color.FromArgb(60, 65, 75); + this.btnClose.BackColor = Color.Transparent; + this.btnClose.Cursor = Cursors.Hand; + this.btnClose.DialogResult = DialogResult.Cancel; + this.btnClose.Disabled1 = Color.FromArgb(32, 35, 45); + this.btnClose.Disabled2 = Color.FromArgb(25, 28, 35); + this.btnClose.DisabledStrokeColor = Color.FromArgb(50, 55, 65); + this.btnClose.Font = new Font("Segoe UI", 9F); + this.btnClose.ForeColor = Color.White; + this.btnClose.Inactive1 = Color.FromArgb(50, 55, 65); + this.btnClose.Inactive2 = Color.FromArgb(50, 55, 65); + this.btnClose.Location = new Point(24, 160); + this.btnClose.Name = "btnClose"; + this.btnClose.Radius = 5; + this.btnClose.Size = new Size(292, 30); + this.btnClose.Stroke = true; + this.btnClose.StrokeColor = Color.FromArgb(74, 74, 74); + this.btnClose.TabIndex = 6; + this.btnClose.Text = "Close"; + this.btnClose.Transparency = false; + this.btnClose.Click += BtnClose_Click; + // + // AdbCommandForm + // + this.AcceptButton = this.btnSend; + this.AutoScaleDimensions = new SizeF(6F, 13F); + this.AutoScaleMode = AutoScaleMode.Font; + this.BackColor = Color.FromArgb(20, 24, 29); + this.CancelButton = this.btnClose; + this.ClientSize = new Size(340, 210); + this.Controls.Add(this.lblTitle); + this.Controls.Add(this.txtCommand); + this.Controls.Add(this.lblHint); + this.Controls.Add(this.separator); + this.Controls.Add(this.btnSend); + this.Controls.Add(this.btnToggleUpdates); + this.Controls.Add(this.btnClose); + this.FormBorderStyle = FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "AdbCommandForm"; + this.ShowIcon = false; + this.StartPosition = FormStartPosition.CenterParent; + this.Text = "ADB Command"; + this.Load += AdbCommandForm_Load; + this.ResumeLayout(false); + this.PerformLayout(); + } + + private void AdbCommandForm_Load(object sender, EventArgs e) + { + txtCommand.Focus(); + } + + private void TxtCommand_KeyPress(object sender, KeyPressEventArgs e) + { + if (e.KeyChar == (char)Keys.Enter) + { + e.Handled = true; + BtnSend_Click(sender, e); + } + else if (e.KeyChar == (char)Keys.Escape) + { + e.Handled = true; + this.DialogResult = DialogResult.Cancel; + this.Close(); + } + } + + private void BtnSend_Click(object sender, EventArgs e) + { + if (string.IsNullOrWhiteSpace(txtCommand.Text)) + { + return; + } + + Command = txtCommand.Text; + ToggleUpdatesClicked = false; + this.DialogResult = DialogResult.OK; + this.Close(); + } + + private void BtnToggleUpdates_Click(object sender, EventArgs e) + { + // Check current state and set the appropriate command + string adbResult = ADB.RunAdbCommandToString("shell pm list packages -d").Output; + bool isUpdatesDisabled = adbResult.Contains("com.oculus.updater"); + + if (isUpdatesDisabled) + { + Command = "shell pm enable com.oculus.updater"; + } + else + { + Command = "shell pm disable-user --user 0 com.oculus.updater"; + } + + ToggleUpdatesClicked = true; + this.DialogResult = DialogResult.OK; + this.Close(); + } + + private void BtnClose_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.Cancel; + this.Close(); + } + + private Label lblTitle; + private TextBox txtCommand; + private Label lblHint; + private Panel separator; + private RoundButton btnSend; + private RoundButton btnToggleUpdates; + private RoundButton btnClose; + } +} \ No newline at end of file diff --git a/AndroidSideloader.csproj b/AndroidSideloader.csproj index f18d336..f135480 100644 --- a/AndroidSideloader.csproj +++ b/AndroidSideloader.csproj @@ -181,6 +181,9 @@ + + Form + Component diff --git a/DonorsListView.Designer.cs b/DonorsListView.Designer.cs index 29a038e..c0dcafb 100644 --- a/DonorsListView.Designer.cs +++ b/DonorsListView.Designer.cs @@ -31,31 +31,148 @@ namespace AndroidSideloader { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DonorsListViewForm)); - this.DonorsListView = new System.Windows.Forms.ListView(); - this.GameNameIndex = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.PackageNameIndex = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.VersionCodeIndex = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.UpdateOrNew = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.DonationTimer = new System.Windows.Forms.Timer(this.components); this.panel1 = new System.Windows.Forms.Panel(); this.skip_forever = new AndroidSideloader.RoundButton(); this.SkipButton = new AndroidSideloader.RoundButton(); this.DonateButton = new AndroidSideloader.RoundButton(); this.panel2 = new System.Windows.Forms.Panel(); + this.DonorsListView = new System.Windows.Forms.ListView(); + this.GameNameIndex = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.PackageNameIndex = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.VersionCodeIndex = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.UpdateOrNew = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.bothdet = new System.Windows.Forms.Label(); this.newdet = new System.Windows.Forms.Label(); this.upddet = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.TimerDesc = new System.Windows.Forms.Label(); - this.DonationTimer = new System.Windows.Forms.Timer(this.components); this.panel1.SuspendLayout(); this.panel2.SuspendLayout(); this.SuspendLayout(); // + // panel1 + // + this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(24)))), ((int)(((byte)(29))))); + this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; + this.panel1.Controls.Add(this.skip_forever); + this.panel1.Controls.Add(this.SkipButton); + this.panel1.Controls.Add(this.DonateButton); + this.panel1.Controls.Add(this.panel2); + this.panel1.Controls.Add(this.bothdet); + this.panel1.Controls.Add(this.newdet); + this.panel1.Controls.Add(this.upddet); + this.panel1.Controls.Add(this.label2); + this.panel1.Controls.Add(this.TimerDesc); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(160)))), ((int)(((byte)(165)))), ((int)(((byte)(175))))); + this.panel1.Location = new System.Drawing.Point(0, 0); + this.panel1.Name = "panel1"; + this.panel1.Padding = new System.Windows.Forms.Padding(16); + this.panel1.Size = new System.Drawing.Size(460, 420); + this.panel1.TabIndex = 1; + this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.DonorsListViewForm_MouseDown); + this.panel1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.DonorsListViewForm_MouseMove); + this.panel1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.DonorsListViewForm_MouseUp); + // + // skip_forever + // + this.skip_forever.Active1 = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(52)))), ((int)(((byte)(62))))); + this.skip_forever.Active2 = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(52)))), ((int)(((byte)(62))))); + this.skip_forever.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.skip_forever.BackColor = System.Drawing.Color.Transparent; + this.skip_forever.DialogResult = System.Windows.Forms.DialogResult.OK; + this.skip_forever.Disabled1 = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(35)))), ((int)(((byte)(45))))); + this.skip_forever.Disabled2 = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(35)))), ((int)(((byte)(45))))); + this.skip_forever.DisabledStrokeColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(55)))), ((int)(((byte)(65))))); + this.skip_forever.Font = new System.Drawing.Font("Segoe UI Semibold", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.skip_forever.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(160)))), ((int)(((byte)(165)))), ((int)(((byte)(175))))); + this.skip_forever.Inactive1 = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(35)))), ((int)(((byte)(42))))); + this.skip_forever.Inactive2 = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(35)))), ((int)(((byte)(42))))); + this.skip_forever.Location = new System.Drawing.Point(20, 380); + this.skip_forever.Margin = new System.Windows.Forms.Padding(0); + this.skip_forever.Name = "skip_forever"; + this.skip_forever.Radius = 4; + this.skip_forever.Size = new System.Drawing.Size(420, 32); + this.skip_forever.Stroke = true; + this.skip_forever.StrokeColor = System.Drawing.Color.FromArgb(((int)(((byte)(93)))), ((int)(((byte)(203)))), ((int)(((byte)(173))))); + this.skip_forever.TabIndex = 97; + this.skip_forever.Text = "Add to blacklist / Never ask for the selected apps again"; + this.skip_forever.Transparency = false; + this.skip_forever.Click += new System.EventHandler(this.skip_forever_Click); + // + // SkipButton + // + this.SkipButton.Active1 = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(52)))), ((int)(((byte)(62))))); + this.SkipButton.Active2 = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(52)))), ((int)(((byte)(62))))); + this.SkipButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.SkipButton.BackColor = System.Drawing.Color.Transparent; + this.SkipButton.DialogResult = System.Windows.Forms.DialogResult.OK; + this.SkipButton.Disabled1 = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(35)))), ((int)(((byte)(45))))); + this.SkipButton.Disabled2 = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(35)))), ((int)(((byte)(45))))); + this.SkipButton.DisabledStrokeColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(55)))), ((int)(((byte)(65))))); + this.SkipButton.Font = new System.Drawing.Font("Segoe UI Semibold", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.SkipButton.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(160)))), ((int)(((byte)(165)))), ((int)(((byte)(175))))); + this.SkipButton.Inactive1 = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(35)))), ((int)(((byte)(42))))); + this.SkipButton.Inactive2 = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(35)))), ((int)(((byte)(42))))); + this.SkipButton.Location = new System.Drawing.Point(20, 326); + this.SkipButton.Margin = new System.Windows.Forms.Padding(0); + this.SkipButton.Name = "SkipButton"; + this.SkipButton.Radius = 4; + this.SkipButton.Size = new System.Drawing.Size(100, 32); + this.SkipButton.Stroke = true; + this.SkipButton.StrokeColor = System.Drawing.Color.FromArgb(((int)(((byte)(93)))), ((int)(((byte)(203)))), ((int)(((byte)(173))))); + this.SkipButton.TabIndex = 96; + this.SkipButton.Text = "Skip"; + this.SkipButton.Transparency = false; + this.SkipButton.Click += new System.EventHandler(this.SkipButton_Click); + // + // DonateButton + // + this.DonateButton.Active1 = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(140)))), ((int)(((byte)(115))))); + this.DonateButton.Active2 = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(125)))), ((int)(((byte)(105))))); + this.DonateButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.DonateButton.BackColor = System.Drawing.Color.Transparent; + this.DonateButton.DialogResult = System.Windows.Forms.DialogResult.OK; + this.DonateButton.Disabled1 = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(35)))), ((int)(((byte)(45))))); + this.DonateButton.Disabled2 = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(28)))), ((int)(((byte)(35))))); + this.DonateButton.DisabledStrokeColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(55)))), ((int)(((byte)(65))))); + this.DonateButton.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Bold); + this.DonateButton.ForeColor = System.Drawing.Color.White; + this.DonateButton.Inactive1 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(120)))), ((int)(((byte)(100))))); + this.DonateButton.Inactive2 = System.Drawing.Color.FromArgb(((int)(((byte)(35)))), ((int)(((byte)(100)))), ((int)(((byte)(85))))); + this.DonateButton.Location = new System.Drawing.Point(128, 326); + this.DonateButton.Margin = new System.Windows.Forms.Padding(0); + this.DonateButton.Name = "DonateButton"; + this.DonateButton.Radius = 4; + this.DonateButton.Size = new System.Drawing.Size(312, 32); + this.DonateButton.Stroke = true; + this.DonateButton.StrokeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(150)))), ((int)(((byte)(125))))); + this.DonateButton.TabIndex = 95; + this.DonateButton.Text = "Share Selected Apps"; + this.DonateButton.Transparency = false; + this.DonateButton.Click += new System.EventHandler(this.DonateButton_Click); + // + // panel2 + // + this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.panel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(32)))), ((int)(((byte)(38))))); + this.panel2.Controls.Add(this.DonorsListView); + this.panel2.Location = new System.Drawing.Point(20, 70); + this.panel2.Name = "panel2"; + this.panel2.Padding = new System.Windows.Forms.Padding(1); + this.panel2.Size = new System.Drawing.Size(420, 250); + this.panel2.TabIndex = 2; + // // DonorsListView // this.DonorsListView.AccessibleRole = System.Windows.Forms.AccessibleRole.None; - this.DonorsListView.BackColor = global::AndroidSideloader.Properties.Settings.Default.ComboBoxColor; - this.DonorsListView.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.DonorsListView.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(32)))), ((int)(((byte)(38))))); + this.DonorsListView.BorderStyle = System.Windows.Forms.BorderStyle.None; this.DonorsListView.CausesValidation = false; this.DonorsListView.CheckBoxes = true; this.DonorsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { @@ -63,22 +180,17 @@ namespace AndroidSideloader this.PackageNameIndex, this.VersionCodeIndex, this.UpdateOrNew}); - this.DonorsListView.DataBindings.Add(new System.Windows.Forms.Binding("BackColor", global::AndroidSideloader.Properties.Settings.Default, "ComboBoxColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.DonorsListView.DataBindings.Add(new System.Windows.Forms.Binding("Font", global::AndroidSideloader.Properties.Settings.Default, "FontStyle", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.DonorsListView.DataBindings.Add(new System.Windows.Forms.Binding("ForeColor", global::AndroidSideloader.Properties.Settings.Default, "FontColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.DonorsListView.Font = global::AndroidSideloader.Properties.Settings.Default.FontStyle; - this.DonorsListView.ForeColor = global::AndroidSideloader.Properties.Settings.Default.FontColor; + this.DonorsListView.Dock = System.Windows.Forms.DockStyle.Fill; + this.DonorsListView.Font = new System.Drawing.Font("Segoe UI", 9.5F); + this.DonorsListView.ForeColor = System.Drawing.Color.White; this.DonorsListView.FullRowSelect = true; this.DonorsListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; this.DonorsListView.HideSelection = false; - this.DonorsListView.ImeMode = System.Windows.Forms.ImeMode.On; - this.DonorsListView.Location = new System.Drawing.Point(6, 6); + this.DonorsListView.Location = new System.Drawing.Point(1, 1); this.DonorsListView.MinimumSize = new System.Drawing.Size(100, 100); this.DonorsListView.Name = "DonorsListView"; - this.DonorsListView.RightToLeftLayout = true; - this.DonorsListView.Size = new System.Drawing.Size(419, 219); + this.DonorsListView.Size = new System.Drawing.Size(418, 248); this.DonorsListView.TabIndex = 0; - this.DonorsListView.TileSize = new System.Drawing.Size(100, 100); this.DonorsListView.UseCompatibleStateImageBehavior = false; this.DonorsListView.View = System.Windows.Forms.View.Details; this.DonorsListView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.DonorsListView_ItemChecked); @@ -89,146 +201,37 @@ namespace AndroidSideloader // GameNameIndex // this.GameNameIndex.Text = "App Name"; - this.GameNameIndex.Width = 219; + this.GameNameIndex.Width = 220; // // PackageNameIndex // this.PackageNameIndex.DisplayIndex = 2; - this.PackageNameIndex.Text = "Packagename"; + this.PackageNameIndex.Text = "Package"; this.PackageNameIndex.Width = 0; // // VersionCodeIndex // this.VersionCodeIndex.DisplayIndex = 3; this.VersionCodeIndex.Text = "Version"; - this.VersionCodeIndex.Width = 113; + this.VersionCodeIndex.Width = 100; // // UpdateOrNew // this.UpdateOrNew.DisplayIndex = 1; - this.UpdateOrNew.Text = "Donation Type"; - this.UpdateOrNew.Width = 85; - // - // panel1 - // - this.panel1.BackColor = global::AndroidSideloader.Properties.Settings.Default.BackColor; - this.panel1.Controls.Add(this.skip_forever); - this.panel1.Controls.Add(this.SkipButton); - this.panel1.Controls.Add(this.DonateButton); - this.panel1.Controls.Add(this.panel2); - this.panel1.Controls.Add(this.bothdet); - this.panel1.Controls.Add(this.newdet); - this.panel1.Controls.Add(this.upddet); - this.panel1.Controls.Add(this.label2); - this.panel1.Controls.Add(this.TimerDesc); - this.panel1.DataBindings.Add(new System.Windows.Forms.Binding("BackColor", global::AndroidSideloader.Properties.Settings.Default, "BackColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.panel1.Location = new System.Drawing.Point(-7, -7); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(463, 373); - this.panel1.TabIndex = 1; - this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.DonorsListViewForm_MouseDown); - this.panel1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.DonorsListViewForm_MouseMove); - this.panel1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.DonorsListViewForm_MouseUp); - // - // skip_forever - // - this.skip_forever.Active1 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); - this.skip_forever.Active2 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); - this.skip_forever.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.skip_forever.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); - this.skip_forever.DataBindings.Add(new System.Windows.Forms.Binding("BackColor", global::AndroidSideloader.Properties.Settings.Default, "SubButtonColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.skip_forever.DataBindings.Add(new System.Windows.Forms.Binding("ForeColor", global::AndroidSideloader.Properties.Settings.Default, "FontColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.skip_forever.DataBindings.Add(new System.Windows.Forms.Binding("Font", global::AndroidSideloader.Properties.Settings.Default, "FontStyle", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.skip_forever.DialogResult = System.Windows.Forms.DialogResult.OK; - this.skip_forever.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F); - this.skip_forever.ForeColor = global::AndroidSideloader.Properties.Settings.Default.FontColor; - this.skip_forever.Inactive1 = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); - this.skip_forever.Inactive2 = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); - this.skip_forever.Location = new System.Drawing.Point(22, 337); - this.skip_forever.Margin = new System.Windows.Forms.Padding(0); - this.skip_forever.Name = "skip_forever"; - this.skip_forever.Radius = 5; - this.skip_forever.Size = new System.Drawing.Size(419, 27); - this.skip_forever.Stroke = true; - this.skip_forever.StrokeColor = System.Drawing.Color.FromArgb(((int)(((byte)(74)))), ((int)(((byte)(74)))), ((int)(((byte)(74))))); - this.skip_forever.TabIndex = 97; - this.skip_forever.Text = "Add to blacklist / Never ask for the selected apps again"; - this.skip_forever.Transparency = false; - this.skip_forever.Click += new System.EventHandler(this.skip_forever_Click); - // - // SkipButton - // - this.SkipButton.Active1 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); - this.SkipButton.Active2 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); - this.SkipButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.SkipButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); - this.SkipButton.DataBindings.Add(new System.Windows.Forms.Binding("BackColor", global::AndroidSideloader.Properties.Settings.Default, "SubButtonColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.SkipButton.DataBindings.Add(new System.Windows.Forms.Binding("ForeColor", global::AndroidSideloader.Properties.Settings.Default, "FontColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.SkipButton.DataBindings.Add(new System.Windows.Forms.Binding("Font", global::AndroidSideloader.Properties.Settings.Default, "FontStyle", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.SkipButton.DialogResult = System.Windows.Forms.DialogResult.OK; - this.SkipButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F); - this.SkipButton.ForeColor = global::AndroidSideloader.Properties.Settings.Default.FontColor; - this.SkipButton.Inactive1 = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); - this.SkipButton.Inactive2 = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); - this.SkipButton.Location = new System.Drawing.Point(22, 277); - this.SkipButton.Margin = new System.Windows.Forms.Padding(0); - this.SkipButton.Name = "SkipButton"; - this.SkipButton.Radius = 5; - this.SkipButton.Size = new System.Drawing.Size(102, 36); - this.SkipButton.Stroke = true; - this.SkipButton.StrokeColor = System.Drawing.Color.FromArgb(((int)(((byte)(74)))), ((int)(((byte)(74)))), ((int)(((byte)(74))))); - this.SkipButton.TabIndex = 96; - this.SkipButton.Text = "Skip"; - this.SkipButton.Transparency = false; - this.SkipButton.Click += new System.EventHandler(this.SkipButton_Click); - // - // DonateButton - // - this.DonateButton.Active1 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); - this.DonateButton.Active2 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); - this.DonateButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.DonateButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); - this.DonateButton.DataBindings.Add(new System.Windows.Forms.Binding("BackColor", global::AndroidSideloader.Properties.Settings.Default, "SubButtonColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.DonateButton.DataBindings.Add(new System.Windows.Forms.Binding("ForeColor", global::AndroidSideloader.Properties.Settings.Default, "FontColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.DonateButton.DataBindings.Add(new System.Windows.Forms.Binding("Font", global::AndroidSideloader.Properties.Settings.Default, "FontStyle", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.DonateButton.DialogResult = System.Windows.Forms.DialogResult.OK; - this.DonateButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F); - this.DonateButton.ForeColor = global::AndroidSideloader.Properties.Settings.Default.FontColor; - this.DonateButton.Inactive1 = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); - this.DonateButton.Inactive2 = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); - this.DonateButton.Location = new System.Drawing.Point(130, 277); - this.DonateButton.Margin = new System.Windows.Forms.Padding(0); - this.DonateButton.Name = "DonateButton"; - this.DonateButton.Radius = 5; - this.DonateButton.Size = new System.Drawing.Size(311, 36); - this.DonateButton.Stroke = true; - this.DonateButton.StrokeColor = System.Drawing.Color.FromArgb(((int)(((byte)(74)))), ((int)(((byte)(74)))), ((int)(((byte)(74))))); - this.DonateButton.TabIndex = 95; - this.DonateButton.Text = "Automatically share selected apps"; - this.DonateButton.Transparency = false; - this.DonateButton.Click += new System.EventHandler(this.DonateButton_Click); - // - // panel2 - // - this.panel2.BackColor = global::AndroidSideloader.Properties.Settings.Default.SubButtonColor; - this.panel2.Controls.Add(this.DonorsListView); - this.panel2.DataBindings.Add(new System.Windows.Forms.Binding("BackColor", global::AndroidSideloader.Properties.Settings.Default, "SubButtonColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.panel2.Location = new System.Drawing.Point(16, 43); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(430, 230); - this.panel2.TabIndex = 2; + this.UpdateOrNew.Text = "Type"; + this.UpdateOrNew.Width = 80; // // bothdet // this.bothdet.AutoSize = true; this.bothdet.BackColor = System.Drawing.Color.Transparent; - this.bothdet.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.25F, System.Drawing.FontStyle.Bold); - this.bothdet.Location = new System.Drawing.Point(125, 7); + this.bothdet.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold); + this.bothdet.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(93)))), ((int)(((byte)(203)))), ((int)(((byte)(173))))); + this.bothdet.Location = new System.Drawing.Point(20, 15); this.bothdet.Name = "bothdet"; - this.bothdet.Size = new System.Drawing.Size(213, 17); + this.bothdet.Size = new System.Drawing.Size(228, 20); this.bothdet.TabIndex = 3; - this.bothdet.Text = "Updates/new apps detected!"; - this.bothdet.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.bothdet.Text = "Updates && New Apps Available"; this.bothdet.Visible = false; this.bothdet.MouseDown += new System.Windows.Forms.MouseEventHandler(this.DonorsListViewForm_MouseDown); this.bothdet.MouseMove += new System.Windows.Forms.MouseEventHandler(this.DonorsListViewForm_MouseMove); @@ -238,13 +241,13 @@ namespace AndroidSideloader // this.newdet.AutoSize = true; this.newdet.BackColor = System.Drawing.Color.Transparent; - this.newdet.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.25F, System.Drawing.FontStyle.Bold); - this.newdet.Location = new System.Drawing.Point(120, 7); + this.newdet.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold); + this.newdet.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(93)))), ((int)(((byte)(203)))), ((int)(((byte)(173))))); + this.newdet.Location = new System.Drawing.Point(20, 15); this.newdet.Name = "newdet"; - this.newdet.Size = new System.Drawing.Size(150, 17); + this.newdet.Size = new System.Drawing.Size(149, 20); this.newdet.TabIndex = 3; - this.newdet.Text = "New apps detected!"; - this.newdet.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.newdet.Text = "New Apps Available"; this.newdet.Visible = false; this.newdet.MouseDown += new System.Windows.Forms.MouseEventHandler(this.DonorsListViewForm_MouseDown); this.newdet.MouseMove += new System.Windows.Forms.MouseEventHandler(this.DonorsListViewForm_MouseMove); @@ -254,13 +257,13 @@ namespace AndroidSideloader // this.upddet.AutoSize = true; this.upddet.BackColor = System.Drawing.Color.Transparent; - this.upddet.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.25F, System.Drawing.FontStyle.Bold); - this.upddet.Location = new System.Drawing.Point(120, 7); + this.upddet.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold); + this.upddet.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(93)))), ((int)(((byte)(203)))), ((int)(((byte)(173))))); + this.upddet.Location = new System.Drawing.Point(20, 15); this.upddet.Name = "upddet"; - this.upddet.Size = new System.Drawing.Size(185, 17); + this.upddet.Size = new System.Drawing.Size(135, 20); this.upddet.TabIndex = 3; - this.upddet.Text = "Game Updates Detected"; - this.upddet.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.upddet.Text = "Updates Available"; this.upddet.Visible = false; this.upddet.MouseDown += new System.Windows.Forms.MouseEventHandler(this.DonorsListViewForm_MouseDown); this.upddet.MouseMove += new System.Windows.Forms.MouseEventHandler(this.DonorsListViewForm_MouseMove); @@ -270,28 +273,29 @@ namespace AndroidSideloader // this.label2.AutoSize = true; this.label2.BackColor = System.Drawing.Color.Transparent; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label2.Location = new System.Drawing.Point(23, 23); + this.label2.Font = new System.Drawing.Font("Segoe UI", 9F); + this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(160)))), ((int)(((byte)(165)))), ((int)(((byte)(175))))); + this.label2.Location = new System.Drawing.Point(20, 42); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(416, 15); + this.label2.Size = new System.Drawing.Size(338, 15); this.label2.TabIndex = 3; - this.label2.Text = "All Apps are donated by users! Without them none of this would be possible!"; - this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label2.Text = "All apps are donated by users! Help the community by sharing."; this.label2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.DonorsListViewForm_MouseDown); this.label2.MouseMove += new System.Windows.Forms.MouseEventHandler(this.DonorsListViewForm_MouseMove); this.label2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.DonorsListViewForm_MouseUp); // // TimerDesc // + this.TimerDesc.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.TimerDesc.AutoSize = true; this.TimerDesc.BackColor = System.Drawing.Color.Transparent; - this.TimerDesc.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.TimerDesc.Location = new System.Drawing.Point(28, 318); + this.TimerDesc.Font = new System.Drawing.Font("Segoe UI", 8F); + this.TimerDesc.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(125)))), ((int)(((byte)(135))))); + this.TimerDesc.Location = new System.Drawing.Point(79, 362); this.TimerDesc.Name = "TimerDesc"; - this.TimerDesc.Size = new System.Drawing.Size(406, 13); + this.TimerDesc.Size = new System.Drawing.Size(292, 13); this.TimerDesc.TabIndex = 3; - this.TimerDesc.Text = "Don\'t share free apps. Rookie will extract/upload apps in background."; - this.TimerDesc.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.TimerDesc.Text = "Don\'t share free apps. Upload happens in background."; this.TimerDesc.MouseDown += new System.Windows.Forms.MouseEventHandler(this.DonorsListViewForm_MouseDown); this.TimerDesc.MouseMove += new System.Windows.Forms.MouseEventHandler(this.DonorsListViewForm_MouseMove); this.TimerDesc.MouseUp += new System.Windows.Forms.MouseEventHandler(this.DonorsListViewForm_MouseUp); @@ -300,12 +304,12 @@ namespace AndroidSideloader // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.Gainsboro; - this.ClientSize = new System.Drawing.Size(449, 366); + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(24)))), ((int)(((byte)(29))))); + this.ClientSize = new System.Drawing.Size(460, 420); this.ControlBox = false; this.Controls.Add(this.panel1); this.ForeColor = System.Drawing.Color.White; - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "DonorsListViewForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; @@ -339,4 +343,4 @@ namespace AndroidSideloader private RoundButton SkipButton; private RoundButton skip_forever; } -} +} \ No newline at end of file diff --git a/DonorsListView.cs b/DonorsListView.cs index ac4d70c..56843f8 100644 --- a/DonorsListView.cs +++ b/DonorsListView.cs @@ -1,21 +1,50 @@ using System; using System.Collections.Generic; using System.Drawing; +using System.Drawing.Drawing2D; using System.IO; using System.Linq; +using System.Runtime.InteropServices; using System.Windows.Forms; namespace AndroidSideloader { public partial class DonorsListViewForm : Form { + // Modern theme colors + private static readonly Color BackgroundColor = Color.FromArgb(20, 24, 29); + private static readonly Color BorderColor = Color.FromArgb(70, 80, 100); + private static readonly Color UpdateHighlightColor = Color.FromArgb(0, 79, 97); - private bool mouseDown; - private Point lastLocation; + // Shadow and corner settings + private const int CS_DROPSHADOW = 0x00020000; + private const int WM_NCLBUTTONDOWN = 0xA1; + private const int HT_CAPTION = 0x2; + private const int SHADOW_SIZE = 2; + private const int CONTENT_RADIUS = 10; + + [DllImport("user32.dll")] + private static extern int SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam); + + [DllImport("user32.dll")] + private static extern bool ReleaseCapture(); + + protected override CreateParams CreateParams + { + get + { + CreateParams cp = base.CreateParams; + cp.ClassStyle |= CS_DROPSHADOW; + return cp; + } + } public DonorsListViewForm() { InitializeComponent(); + ApplyModernTheme(); + CenterToScreen(); + Donors.initDonorGames(); var seen = new HashSet(); @@ -38,35 +67,145 @@ namespace AndroidSideloader DonorsListView.EndUpdate(); } + private void ApplyModernTheme() + { + this.FormBorderStyle = FormBorderStyle.None; + this.BackColor = Color.FromArgb(25, 25, 30); + this.Padding = new Padding(5); + + panel1.BackColor = BackgroundColor; + panel1.Location = new Point(6, 6); + panel1.Size = new Size(this.ClientSize.Width - 12, this.ClientSize.Height - 12); + panel1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + + this.Paint += Form_Paint; + + // Close button + var closeButton = new Button + { + Text = "✕", + Font = new Font("Segoe UI", 9F), + ForeColor = Color.White, + BackColor = BackgroundColor, + FlatStyle = FlatStyle.Flat, + Size = new Size(30, 28), + Location = new Point(panel1.Width - 35, 5), + Cursor = Cursors.Hand, + TabStop = false + }; + closeButton.FlatAppearance.BorderSize = 0; + closeButton.FlatAppearance.MouseOverBackColor = Color.FromArgb(200, 60, 60); + closeButton.Click += (s, e) => Close(); + panel1.Controls.Add(closeButton); + closeButton.BringToFront(); + + // Enable dragging + panel1.MouseDown += TitleArea_MouseDown; + foreach (Control ctrl in panel1.Controls) + { + if (ctrl is Label) + { + ctrl.MouseDown += TitleArea_MouseDown; + } + } + } + + private void TitleArea_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Left) + { + ReleaseCapture(); + SendMessage(this.Handle, WM_NCLBUTTONDOWN, (IntPtr)HT_CAPTION, IntPtr.Zero); + } + } + + private void Form_Paint(object sender, PaintEventArgs e) + { + e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; + e.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; + + int w = this.Width; + int h = this.Height; + + // Draw shadow layers + for (int i = SHADOW_SIZE; i >= 1; i--) + { + int alpha = (SHADOW_SIZE - i + 1) * 12; + Rectangle shadowRect = new Rectangle( + SHADOW_SIZE - i, + SHADOW_SIZE - i, + w - (SHADOW_SIZE - i) * 2 - 1, + h - (SHADOW_SIZE - i) * 2 - 1); + + using (Pen shadowPen = new Pen(Color.FromArgb(alpha, 0, 0, 0), 1)) + using (GraphicsPath shadowPath = CreateRoundedRectPath(shadowRect, CONTENT_RADIUS + i)) + { + e.Graphics.DrawPath(shadowPen, shadowPath); + } + } + + // Draw content background + Rectangle contentRect = new Rectangle(SHADOW_SIZE, SHADOW_SIZE, w - SHADOW_SIZE * 2, h - SHADOW_SIZE * 2); + using (GraphicsPath contentPath = CreateRoundedRectPath(contentRect, CONTENT_RADIUS)) + { + using (SolidBrush bgBrush = new SolidBrush(BackgroundColor)) + { + e.Graphics.FillPath(bgBrush, contentPath); + } + + using (Pen borderPen = new Pen(BorderColor, 1f)) + { + e.Graphics.DrawPath(borderPen, contentPath); + } + } + + // Apply rounded region + using (GraphicsPath regionPath = CreateRoundedRectPath(new Rectangle(0, 0, w, h), CONTENT_RADIUS + SHADOW_SIZE)) + { + this.Region = new Region(regionPath); + } + } + + private GraphicsPath CreateRoundedRectPath(Rectangle rect, int radius) + { + GraphicsPath path = new GraphicsPath(); + if (radius <= 0) + { + path.AddRectangle(rect); + return path; + } + + int diameter = Math.Min(radius * 2, Math.Min(rect.Width, rect.Height)); + radius = diameter / 2; + Rectangle arcRect = new Rectangle(rect.Location, new Size(diameter, diameter)); + + path.AddArc(arcRect, 180, 90); + arcRect.X = rect.Right - diameter; + path.AddArc(arcRect, 270, 90); + arcRect.Y = rect.Bottom - diameter; + path.AddArc(arcRect, 0, 90); + arcRect.X = rect.Left; + path.AddArc(arcRect, 90, 90); + path.CloseFigure(); + return path; + } + public static string DonorsLocal = MainForm.donorApps; public static bool ifuploads = false; public static string newAppsForList = ""; - private void DonorsListViewForm_Load(object sender, EventArgs e) { MainForm.updatesNotified = true; - if (MainForm.updates && MainForm.newapps) - { - bothdet.Visible = true; - } - else if (MainForm.updates && !MainForm.newapps) - { - upddet.Visible = true; - } - else - { - newdet.Visible = true; - } + bothdet.Visible = MainForm.updates && MainForm.newapps; + upddet.Visible = MainForm.updates && !MainForm.newapps; + newdet.Visible = !MainForm.updates; foreach (ListViewItem listItem in DonorsListView.Items) { if (listItem.SubItems[Donors.UpdateOrNew].Text.Contains("Update")) - { - listItem.BackColor = Color.FromArgb(0, 79, 97); - } + listItem.BackColor = UpdateHighlightColor; } - } private async void DonateButton_Click(object sender, EventArgs e) @@ -76,48 +215,36 @@ namespace AndroidSideloader bool uncheckednewapps = false; foreach (ListViewItem listItem in DonorsListView.Items) { - if (!listItem.Checked) + if (!listItem.Checked && listItem.SubItems[Donors.UpdateOrNew].Text.Contains("New")) { - if (listItem.SubItems[Donors.UpdateOrNew].Text.Contains("New")) - { - uncheckednewapps = true; - newAppsForList += listItem.SubItems[Donors.GameNameIndex].Text + ";" + listItem.SubItems[Donors.PackageNameIndex].Text + "\n"; - } + uncheckednewapps = true; + newAppsForList += listItem.SubItems[Donors.GameNameIndex].Text + ";" + listItem.SubItems[Donors.PackageNameIndex].Text + "\n"; } } + if (uncheckednewapps) { - - NewApps NewAppForm = new NewApps(); - _ = NewAppForm.ShowDialog(); + new NewApps().ShowDialog(); Hide(); } else { Hide(); } - int count = DonorsListView.CheckedItems.Count; - _ = new string[count]; - for (int i = 0; i < count; i++) + + for (int i = 0; i < DonorsListView.CheckedItems.Count; i++) { ulong vcode = Convert.ToUInt64(DonorsListView.CheckedItems[i].SubItems[Donors.VersionCodeIndex].Text); - if (DonorsListView.CheckedItems[i].SubItems[Donors.UpdateOrNew].Text.Contains("Update")) - { - await Program.form.extractAndPrepareGameToUploadAsync(DonorsListView.CheckedItems[i].SubItems[Donors.GameNameIndex].Text, DonorsListView.CheckedItems[i].SubItems[Donors.PackageNameIndex].Text, vcode, true); - } - else - { - await Program.form.extractAndPrepareGameToUploadAsync(DonorsListView.CheckedItems[i].SubItems[Donors.GameNameIndex].Text, DonorsListView.CheckedItems[i].SubItems[Donors.PackageNameIndex].Text, vcode, false); - } - + bool isUpdate = DonorsListView.CheckedItems[i].SubItems[Donors.UpdateOrNew].Text.Contains("Update"); + await Program.form.extractAndPrepareGameToUploadAsync( + DonorsListView.CheckedItems[i].SubItems[Donors.GameNameIndex].Text, + DonorsListView.CheckedItems[i].SubItems[Donors.PackageNameIndex].Text, + vcode, isUpdate); ifuploads = true; } } - if (ifuploads) - { - MainForm.doUpload(); - } + if (ifuploads) MainForm.doUpload(); Close(); } @@ -125,65 +252,31 @@ namespace AndroidSideloader { SkipButton.Enabled = DonorsListView.CheckedItems.Count == 0; DonateButton.Enabled = !SkipButton.Enabled; - - // Enable skip_forever button only when items are checked skip_forever.Enabled = DonorsListView.CheckedItems.Count > 0; } private void SkipButton_Click(object sender, EventArgs e) { - bool uncheckednewapps = false; foreach (ListViewItem listItem in DonorsListView.Items) { - if (!listItem.Checked) - { - if (listItem.SubItems[Donors.UpdateOrNew].Text.Contains("New")) - { - uncheckednewapps = true; - newAppsForList += listItem.SubItems[Donors.GameNameIndex].Text + ";" + listItem.SubItems[Donors.PackageNameIndex].Text + "\n"; - } - } - } - if (uncheckednewapps) - { - NewApps NewAppForm = new NewApps(); - _ = NewAppForm.ShowDialog(); + if (!listItem.Checked && listItem.SubItems[Donors.UpdateOrNew].Text.Contains("New")) + newAppsForList += listItem.SubItems[Donors.GameNameIndex].Text + ";" + listItem.SubItems[Donors.PackageNameIndex].Text + "\n"; } + + if (!string.IsNullOrEmpty(newAppsForList)) + new NewApps().ShowDialog(); + Close(); } - private void DonorsListViewForm_MouseDown(object sender, MouseEventArgs e) - { - mouseDown = true; - lastLocation = e.Location; - } - - private void DonorsListViewForm_MouseMove(object sender, MouseEventArgs e) - { - if (mouseDown) - { - Location = new Point( - Location.X - lastLocation.X + e.X, Location.Y - lastLocation.Y + e.Y); - Update(); - } - } - - private void DonorsListViewForm_MouseUp(object sender, MouseEventArgs e) - { - mouseDown = false; - } + private void DonorsListViewForm_MouseDown(object sender, MouseEventArgs e) => TitleArea_MouseDown(sender, e); + private void DonorsListViewForm_MouseMove(object sender, MouseEventArgs e) { } + private void DonorsListViewForm_MouseUp(object sender, MouseEventArgs e) { } private void skip_forever_Click(object sender, EventArgs e) { - // Collect selected items from the list - List appsToBlacklist = new List(); - - foreach (ListViewItem listItem in DonorsListView.CheckedItems) - { - // Get the package name from the checked list item - string packageName = listItem.SubItems[Donors.PackageNameIndex].Text; - appsToBlacklist.Add(packageName); - } + var appsToBlacklist = DonorsListView.CheckedItems.Cast() + .Select(item => item.SubItems[Donors.PackageNameIndex].Text).ToList(); if (appsToBlacklist.Count == 0) { @@ -191,81 +284,35 @@ namespace AndroidSideloader return; } - // Confirm with user - DialogResult result = MessageBox.Show( - $"Are you sure you want to permanently skip donation requests for {appsToBlacklist.Count} selected app(s)?\n\nThese apps will not be requested for donation again.", - "Confirm Blacklist", - MessageBoxButtons.YesNo, - MessageBoxIcon.Question); - - if (result != DialogResult.Yes) - { + if (MessageBox.Show( + $"Permanently skip donation requests for {appsToBlacklist.Count} app(s)?", + "Confirm Blacklist", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) return; - } - // Path to local blacklist.json in the main directory string blacklistPath = Path.Combine(Environment.CurrentDirectory, "blacklist.json"); - try { - // Read existing blacklist entries if file exists - HashSet existingBlacklist = new HashSet(StringComparer.OrdinalIgnoreCase); - + var existingBlacklist = new HashSet(StringComparer.OrdinalIgnoreCase); if (File.Exists(blacklistPath)) { - try - { - string jsonContent = File.ReadAllText(blacklistPath); - // Try to parse as JSON array - var jsonArray = Newtonsoft.Json.JsonConvert.DeserializeObject(jsonContent); - if (jsonArray != null) - { - foreach (string entry in jsonArray) - { - if (!string.IsNullOrWhiteSpace(entry)) - { - existingBlacklist.Add(entry.Trim()); - } - } - } - } - catch - { - // If JSON parsing fails, file might be corrupted, start fresh - Logger.Log("Existing blacklist.json is corrupted, creating new file", LogLevel.WARNING); - } + var jsonArray = Newtonsoft.Json.JsonConvert.DeserializeObject(File.ReadAllText(blacklistPath)); + if (jsonArray != null) + foreach (string entry in jsonArray.Where(ee => !string.IsNullOrWhiteSpace(ee))) + existingBlacklist.Add(entry.Trim()); } - // Add new package names to blacklist - foreach (string packageName in appsToBlacklist) - { - existingBlacklist.Add(packageName); - } - - // Write back to file as JSON array - string jsonOutput = Newtonsoft.Json.JsonConvert.SerializeObject(existingBlacklist.ToArray(), Newtonsoft.Json.Formatting.Indented); - File.WriteAllText(blacklistPath, jsonOutput); + foreach (string pkg in appsToBlacklist) existingBlacklist.Add(pkg); + File.WriteAllText(blacklistPath, Newtonsoft.Json.JsonConvert.SerializeObject(existingBlacklist.ToArray(), Newtonsoft.Json.Formatting.Indented)); Logger.Log($"Added {appsToBlacklist.Count} apps to local blacklist"); - - MessageBox.Show( - $"{appsToBlacklist.Count} app(s) have been added to the blacklist.\n\nYou will not be asked to donate these apps again.", - "Success", - MessageBoxButtons.OK, - MessageBoxIcon.Information); - - // Close the form + MessageBox.Show($"{appsToBlacklist.Count} app(s) added to blacklist.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); } catch (Exception ex) { Logger.Log($"Error saving blacklist: {ex.Message}", LogLevel.ERROR); - MessageBox.Show( - $"Error saving blacklist: {ex.Message}", - "Error", - MessageBoxButtons.OK, - MessageBoxIcon.Error); + MessageBox.Show($"Error: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } -} +} \ No newline at end of file diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index 4d328e7..9317730 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -53,9 +53,6 @@ namespace AndroidSideloader this.notesRichTextBox = new System.Windows.Forms.RichTextBox(); this.DragDropLbl = new System.Windows.Forms.Label(); this.lblNotes = new System.Windows.Forms.Label(); - this.adbCmd_background = new System.Windows.Forms.Label(); - this.adbCmd_CommandBox = new System.Windows.Forms.TextBox(); - this.adbCmd_Label = new System.Windows.Forms.Label(); this.gamesPictureBox = new System.Windows.Forms.PictureBox(); this.startsideloadbutton_Tooltip = new System.Windows.Forms.ToolTip(this.components); this.startsideloadbutton = new System.Windows.Forms.Button(); @@ -127,8 +124,6 @@ namespace AndroidSideloader this.gamesGalleryView = new System.Windows.Forms.FlowLayoutPanel(); this.btnViewToggle_Tooltip = new System.Windows.Forms.ToolTip(this.components); this.webViewPlaceholderPanel = new System.Windows.Forms.Panel(); - this.adbCmd_btnSend = new AndroidSideloader.RoundButton(); - this.adbCmd_btnToggleUpdates = new AndroidSideloader.RoundButton(); this.searchPanel = new AndroidSideloader.RoundButton(); this.searchIconPictureBox = new System.Windows.Forms.PictureBox(); this.searchTextBox = new System.Windows.Forms.TextBox(); @@ -161,8 +156,6 @@ namespace AndroidSideloader // m_combo // this.m_combo.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); - this.m_combo.DataBindings.Add(new System.Windows.Forms.Binding("ForeColor", global::AndroidSideloader.Properties.Settings.Default, "FontColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.m_combo.DataBindings.Add(new System.Windows.Forms.Binding("Font", global::AndroidSideloader.Properties.Settings.Default, "FontStyle", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); this.m_combo.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.m_combo.Font = global::AndroidSideloader.Properties.Settings.Default.FontStyle; this.m_combo.ForeColor = global::AndroidSideloader.Properties.Settings.Default.FontColor; @@ -254,8 +247,6 @@ namespace AndroidSideloader // devicesComboBox // this.devicesComboBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); - this.devicesComboBox.DataBindings.Add(new System.Windows.Forms.Binding("ForeColor", global::AndroidSideloader.Properties.Settings.Default, "FontColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.devicesComboBox.DataBindings.Add(new System.Windows.Forms.Binding("Font", global::AndroidSideloader.Properties.Settings.Default, "FontStyle", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); this.devicesComboBox.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.devicesComboBox.Font = global::AndroidSideloader.Properties.Settings.Default.FontStyle; this.devicesComboBox.ForeColor = global::AndroidSideloader.Properties.Settings.Default.FontColor; @@ -272,8 +263,6 @@ namespace AndroidSideloader // remotesList // this.remotesList.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); - this.remotesList.DataBindings.Add(new System.Windows.Forms.Binding("ForeColor", global::AndroidSideloader.Properties.Settings.Default, "FontColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.remotesList.DataBindings.Add(new System.Windows.Forms.Binding("Font", global::AndroidSideloader.Properties.Settings.Default, "FontStyle", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); this.remotesList.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.remotesList.Font = global::AndroidSideloader.Properties.Settings.Default.FontStyle; this.remotesList.ForeColor = global::AndroidSideloader.Properties.Settings.Default.FontColor; @@ -301,9 +290,8 @@ namespace AndroidSideloader this.ReleaseAPKPathIndex, this.VersionNameIndex, this.DownloadsIndex}); - this.gamesListView.DataBindings.Add(new System.Windows.Forms.Binding("ForeColor", global::AndroidSideloader.Properties.Settings.Default, "FontColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); this.gamesListView.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.gamesListView.ForeColor = global::AndroidSideloader.Properties.Settings.Default.FontColor; + this.gamesListView.ForeColor = Color.White; this.gamesListView.HideSelection = false; this.gamesListView.ImeMode = System.Windows.Forms.ImeMode.Off; this.gamesListView.Location = new System.Drawing.Point(258, 44); @@ -417,58 +405,6 @@ namespace AndroidSideloader this.lblNotes.TabIndex = 86; this.lblNotes.Text = "Release Notes"; // - // adbCmd_background - // - this.adbCmd_background.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); - this.adbCmd_background.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.adbCmd_background.Location = new System.Drawing.Point(462, 138); - this.adbCmd_background.Name = "adbCmd_background"; - this.adbCmd_background.Size = new System.Drawing.Size(322, 103); - this.adbCmd_background.TabIndex = 89; - this.adbCmd_background.Visible = false; - // - // adbCmd_CommandBox - // - this.adbCmd_CommandBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.adbCmd_CommandBox.BackColor = global::AndroidSideloader.Properties.Settings.Default.TextBoxColor; - this.adbCmd_CommandBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.adbCmd_CommandBox.DataBindings.Add(new System.Windows.Forms.Binding("BackColor", global::AndroidSideloader.Properties.Settings.Default, "TextBoxColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.adbCmd_CommandBox.DataBindings.Add(new System.Windows.Forms.Binding("Font", global::AndroidSideloader.Properties.Settings.Default, "FontStyle", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.adbCmd_CommandBox.DataBindings.Add(new System.Windows.Forms.Binding("ForeColor", global::AndroidSideloader.Properties.Settings.Default, "FontColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.adbCmd_CommandBox.Font = global::AndroidSideloader.Properties.Settings.Default.FontStyle; - this.adbCmd_CommandBox.ForeColor = global::AndroidSideloader.Properties.Settings.Default.FontColor; - this.adbCmd_CommandBox.Location = new System.Drawing.Point(477, 173); - this.adbCmd_CommandBox.MaximumSize = new System.Drawing.Size(290, 24); - this.adbCmd_CommandBox.MinimumSize = new System.Drawing.Size(290, 24); - this.adbCmd_CommandBox.Name = "adbCmd_CommandBox"; - this.adbCmd_CommandBox.Size = new System.Drawing.Size(290, 23); - this.adbCmd_CommandBox.TabIndex = 5; - this.adbCmd_CommandBox.Visible = false; - this.adbCmd_CommandBox.TextChanged += new System.EventHandler(this.searchTextBox_TextChanged); - this.adbCmd_CommandBox.Enter += new System.EventHandler(this.ADBcommandbox_Enter); - this.adbCmd_CommandBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ADBcommandbox_KeyPress); - this.adbCmd_CommandBox.Leave += new System.EventHandler(this.ADBcommandbox_Leave); - // - // adbCmd_Label - // - this.adbCmd_Label.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.adbCmd_Label.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); - this.adbCmd_Label.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold); - this.adbCmd_Label.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(93)))), ((int)(((byte)(203)))), ((int)(((byte)(173))))); - this.adbCmd_Label.Location = new System.Drawing.Point(500, 147); - this.adbCmd_Label.MaximumSize = new System.Drawing.Size(247, 20); - this.adbCmd_Label.MinimumSize = new System.Drawing.Size(247, 20); - this.adbCmd_Label.Name = "adbCmd_Label"; - this.adbCmd_Label.Size = new System.Drawing.Size(247, 20); - this.adbCmd_Label.TabIndex = 90; - this.adbCmd_Label.Text = "Type ADB Command"; - this.adbCmd_Label.TextAlign = System.Drawing.ContentAlignment.BottomCenter; - this.adbCmd_Label.Visible = false; - // // gamesPictureBox // this.gamesPictureBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(35)))), ((int)(((byte)(35)))), ((int)(((byte)(40))))); @@ -1204,7 +1140,6 @@ namespace AndroidSideloader // questInfoLabel // this.questInfoLabel.BackColor = System.Drawing.Color.Transparent; - this.questInfoLabel.DataBindings.Add(new System.Windows.Forms.Binding("ForeColor", global::AndroidSideloader.Properties.Settings.Default, "FontColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); this.questInfoLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold); this.questInfoLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight; this.questInfoLabel.Location = new System.Drawing.Point(8, 4); @@ -1353,66 +1288,6 @@ namespace AndroidSideloader this.webViewPlaceholderPanel.TabIndex = 103; this.webViewPlaceholderPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.webViewPlaceholderPanel_Paint); // - // adbCmd_btnSend - // - this.adbCmd_btnSend.Active1 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); - this.adbCmd_btnSend.Active2 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); - this.adbCmd_btnSend.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); - this.adbCmd_btnSend.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.adbCmd_btnSend.Cursor = System.Windows.Forms.Cursors.Default; - this.adbCmd_btnSend.DataBindings.Add(new System.Windows.Forms.Binding("BackColor", global::AndroidSideloader.Properties.Settings.Default, "SubButtonColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.adbCmd_btnSend.DataBindings.Add(new System.Windows.Forms.Binding("ForeColor", global::AndroidSideloader.Properties.Settings.Default, "FontColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.adbCmd_btnSend.DataBindings.Add(new System.Windows.Forms.Binding("Font", global::AndroidSideloader.Properties.Settings.Default, "FontStyle", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.adbCmd_btnSend.DialogResult = System.Windows.Forms.DialogResult.OK; - this.adbCmd_btnSend.Disabled1 = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(35)))), ((int)(((byte)(45))))); - this.adbCmd_btnSend.Disabled2 = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(28)))), ((int)(((byte)(35))))); - this.adbCmd_btnSend.DisabledStrokeColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(55)))), ((int)(((byte)(65))))); - this.adbCmd_btnSend.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F); - this.adbCmd_btnSend.ForeColor = global::AndroidSideloader.Properties.Settings.Default.FontColor; - this.adbCmd_btnSend.Inactive1 = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); - this.adbCmd_btnSend.Inactive2 = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); - this.adbCmd_btnSend.Location = new System.Drawing.Point(478, 204); - this.adbCmd_btnSend.Name = "adbCmd_btnSend"; - this.adbCmd_btnSend.Radius = 5; - this.adbCmd_btnSend.Size = new System.Drawing.Size(126, 28); - this.adbCmd_btnSend.Stroke = true; - this.adbCmd_btnSend.StrokeColor = System.Drawing.Color.FromArgb(((int)(((byte)(74)))), ((int)(((byte)(74)))), ((int)(((byte)(74))))); - this.adbCmd_btnSend.TabIndex = 100; - this.adbCmd_btnSend.Text = "Send Command"; - this.adbCmd_btnSend.Transparency = false; - this.adbCmd_btnSend.Visible = false; - this.adbCmd_btnSend.Click += new System.EventHandler(this.adbCmd_btnSend_Click); - // - // adbCmd_btnToggleUpdates - // - this.adbCmd_btnToggleUpdates.Active1 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); - this.adbCmd_btnToggleUpdates.Active2 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); - this.adbCmd_btnToggleUpdates.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); - this.adbCmd_btnToggleUpdates.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.adbCmd_btnToggleUpdates.Cursor = System.Windows.Forms.Cursors.Default; - this.adbCmd_btnToggleUpdates.DataBindings.Add(new System.Windows.Forms.Binding("BackColor", global::AndroidSideloader.Properties.Settings.Default, "SubButtonColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.adbCmd_btnToggleUpdates.DataBindings.Add(new System.Windows.Forms.Binding("ForeColor", global::AndroidSideloader.Properties.Settings.Default, "FontColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.adbCmd_btnToggleUpdates.DataBindings.Add(new System.Windows.Forms.Binding("Font", global::AndroidSideloader.Properties.Settings.Default, "FontStyle", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.adbCmd_btnToggleUpdates.DialogResult = System.Windows.Forms.DialogResult.OK; - this.adbCmd_btnToggleUpdates.Disabled1 = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(35)))), ((int)(((byte)(45))))); - this.adbCmd_btnToggleUpdates.Disabled2 = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(28)))), ((int)(((byte)(35))))); - this.adbCmd_btnToggleUpdates.DisabledStrokeColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(55)))), ((int)(((byte)(65))))); - this.adbCmd_btnToggleUpdates.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F); - this.adbCmd_btnToggleUpdates.ForeColor = global::AndroidSideloader.Properties.Settings.Default.FontColor; - this.adbCmd_btnToggleUpdates.Inactive1 = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); - this.adbCmd_btnToggleUpdates.Inactive2 = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); - this.adbCmd_btnToggleUpdates.Location = new System.Drawing.Point(627, 204); - this.adbCmd_btnToggleUpdates.Name = "adbCmd_btnToggleUpdates"; - this.adbCmd_btnToggleUpdates.Radius = 5; - this.adbCmd_btnToggleUpdates.Size = new System.Drawing.Size(143, 28); - this.adbCmd_btnToggleUpdates.Stroke = true; - this.adbCmd_btnToggleUpdates.StrokeColor = System.Drawing.Color.FromArgb(((int)(((byte)(74)))), ((int)(((byte)(74)))), ((int)(((byte)(74))))); - this.adbCmd_btnToggleUpdates.TabIndex = 99; - this.adbCmd_btnToggleUpdates.Text = "Toggle OS Updates"; - this.adbCmd_btnToggleUpdates.Transparency = false; - this.adbCmd_btnToggleUpdates.Visible = false; - this.adbCmd_btnToggleUpdates.Click += new System.EventHandler(this.adbCmd_btnToggleUpdates_Click); - // // searchPanel // this.searchPanel.Active1 = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(56)))), ((int)(((byte)(70))))); @@ -1631,20 +1506,15 @@ namespace AndroidSideloader this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(35)))), ((int)(((byte)(45))))); this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.ClientSize = new System.Drawing.Size(1254, 721); - this.Controls.Add(this.adbCmd_btnSend); - this.Controls.Add(this.adbCmd_btnToggleUpdates); this.Controls.Add(this.ULLabel); this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.progressDLbtnContainer); - this.Controls.Add(this.adbCmd_CommandBox); - this.Controls.Add(this.adbCmd_Label); this.Controls.Add(this.DragDropLbl); this.Controls.Add(this.lblNotes); this.Controls.Add(this.gamesQueueLabel); this.Controls.Add(this.gamesQueListBox); this.Controls.Add(this.leftNavContainer); this.Controls.Add(this.notesRichTextBox); - this.Controls.Add(this.adbCmd_background); this.Controls.Add(this.gamesListView); this.Controls.Add(this.gamesGalleryView); this.Controls.Add(this.webViewPlaceholderPanel); @@ -1704,9 +1574,6 @@ namespace AndroidSideloader private System.Windows.Forms.RichTextBox notesRichTextBox; private System.Windows.Forms.Label DragDropLbl; private System.Windows.Forms.Label lblNotes; - private System.Windows.Forms.Label adbCmd_background; - private System.Windows.Forms.TextBox adbCmd_CommandBox; - private System.Windows.Forms.Label adbCmd_Label; public System.Windows.Forms.ComboBox remotesList; public System.Windows.Forms.ColumnHeader GameNameIndex; public System.Windows.Forms.ColumnHeader ReleaseNameIndex; @@ -1774,8 +1641,6 @@ namespace AndroidSideloader private Button btnOpenDownloads; private Button btnRunAdbCmd; private Button btnNoDevice; - private RoundButton adbCmd_btnToggleUpdates; - private RoundButton adbCmd_btnSend; private ContextMenuStrip favoriteGame; private ToolStripMenuItem favoriteButton; private RoundButton favoriteSwitcher; diff --git a/MainForm.cs b/MainForm.cs index 2b640f6..68b058b 100755 --- a/MainForm.cs +++ b/MainForm.cs @@ -88,7 +88,6 @@ namespace AndroidSideloader public static string PublicMirrorExtraArgs = " --tpslimit 1.0 --tpslimit-burst 3"; public static string storedIpPath; public static string aaptPath; - private bool manualIP; private System.Windows.Forms.Timer _debounceTimer; private CancellationTokenSource _cts; private List _allItems; @@ -3831,14 +3830,33 @@ Please visit our Telegram (https://t.me/VRPirates) or Discord (https://discord.g if (manual) { - adbCmd_CommandBox.Visible = true; - adbCmd_CommandBox.Clear(); - adbCmd_Label.Visible = true; - adbCmd_Label.Text = "Enter your Quest IP Address"; - adbCmd_background.Visible = true; - manualIP = true; - _ = adbCmd_CommandBox.Focus(); - Program.form.changeTitle("Attempting manual connection...", true); + // Show a simple input dialog for IP address + string ipAddress = ShowManualIPDialog(); + if (!string.IsNullOrEmpty(ipAddress)) + { + string IPcmnd = "connect " + ipAddress + ":5555"; + await Task.Delay(1000); + string errorChecker = ADB.RunAdbCommandToString(IPcmnd).Output; + if (errorChecker.Contains("cannot resolve host") || errorChecker.Contains("cannot connect to")) + { + changeTitle(""); + _ = FlexibleMessageBox.Show(Program.form, "Manual ADB over WiFi Connection failed\nExiting...", "Manual IP Connection Failed!", MessageBoxButtons.OK); + } + else + { + _ = await CheckForDevice(); + showAvailableSpace(); + settings.IPAddress = IPcmnd; + settings.Save(); + try { File.WriteAllText(storedIpPath, IPcmnd); } + catch (Exception ex) { Logger.Log($"Unable to write to StoredIP.txt due to {ex.Message}", LogLevel.ERROR); } + ADB.wirelessadbON = true; + _ = ADB.RunAdbCommandToString("shell settings put global wifi_wakeup_available 1"); + _ = ADB.RunAdbCommandToString("shell settings put global wifi_wakeup_enabled 1"); + changeTitlebarToDevice(); + } + } + Program.form.changeTitle("", true); } else { @@ -3890,6 +3908,51 @@ Please visit our Telegram (https://t.me/VRPirates) or Discord (https://discord.g UpdateWirelessADBButtonText(); } + private string ShowManualIPDialog() + { + using (Form dialog = new Form()) + { + dialog.Text = "Enter Quest IP Address"; + dialog.Size = new Size(350, 150); + dialog.StartPosition = FormStartPosition.CenterParent; + dialog.FormBorderStyle = FormBorderStyle.FixedDialog; + dialog.MaximizeBox = false; + dialog.MinimizeBox = false; + dialog.BackColor = Color.FromArgb(20, 24, 29); + dialog.ForeColor = Color.White; + + var label = new Label + { + Text = "Enter your Quest's IP Address:", + ForeColor = Color.White, + AutoSize = true, + Location = new Point(15, 15) + }; + + var textBox = new TextBox + { + Location = new Point(15, 40), + Size = new Size(300, 24), + BackColor = Color.FromArgb(40, 44, 52), + ForeColor = Color.White, + BorderStyle = BorderStyle.FixedSingle + }; + + var okButton = CreateStyledButton("OK", DialogResult.OK, new Point(155, 75)); + var cancelButton = CreateStyledButton("Cancel", DialogResult.Cancel, new Point(240, 75), false); + + dialog.Controls.AddRange(new Control[] { label, textBox, okButton, cancelButton }); + dialog.AcceptButton = okButton; + dialog.CancelButton = cancelButton; + + if (dialog.ShowDialog(this) == DialogResult.OK) + { + return textBox.Text.Trim(); + } + } + return null; + } + private void UpdateWirelessADBButtonText() { bool isWirelessEnabled = File.Exists(storedIpPath) && !string.IsNullOrEmpty(settings.IPAddress); @@ -3969,28 +4032,10 @@ Please visit our Telegram (https://t.me/VRPirates) or Discord (https://discord.g } } searchTextBox.Visible = false; - adbCmd_background.Visible = false; - - if (adbCmd_CommandBox.Visible) - { - changeTitle($"Entered command: ADB {adbCmd_CommandBox.Text}"); - _ = ADB.RunAdbCommandToString(adbCmd_CommandBox.Text); - changeTitle(""); - } - adbCmd_CommandBox.Visible = false; - adbCmd_Label.Visible = false; - adbCmd_background.Visible = false; - } if (e.KeyChar == (char)Keys.Escape) { searchTextBox.Visible = false; - adbCmd_background.Visible = false; - adbCmd_CommandBox.Visible = false; - adbCmd_btnToggleUpdates.Visible = false; - adbCmd_btnSend.Visible = false; - adbCmd_Label.Visible = false; - adbCmd_background.Visible = false; } } @@ -4001,7 +4046,6 @@ Please visit our Telegram (https://t.me/VRPirates) or Discord (https://discord.g // Show search box. searchTextBox.Clear(); searchTextBox.Visible = true; - adbCmd_background.Visible = true; _ = searchTextBox.Focus(); } if (keyData == (Keys.Control | Keys.L)) @@ -4052,13 +4096,7 @@ Please visit our Telegram (https://t.me/VRPirates) or Discord (https://discord.g } if (keyData == (Keys.Control | Keys.R)) { - adbCmd_CommandBox.Visible = true; - adbCmd_btnToggleUpdates.Visible = true; - adbCmd_btnSend.Visible = true; - adbCmd_CommandBox.Clear(); - adbCmd_Label.Visible = true; - adbCmd_background.Visible = true; - _ = adbCmd_CommandBox.Focus(); + btnRunAdbCmd_Click(this, EventArgs.Empty); } if (keyData == (Keys.Control | Keys.F4)) { @@ -4252,11 +4290,6 @@ CTRL + F4 - Instantly relaunch Rookie Sideloader"); } } - private void ADBcommandbox_Enter(object sender, EventArgs e) - { - _ = adbCmd_CommandBox.Focus(); - } - static string ExtractVideoId(string html) { // We want the first strict 11-char YouTube video ID after /watch?v= @@ -4779,17 +4812,10 @@ function onYouTubeIframeAPIReady() { searchTextBox.Text = "Search..."; searchTextBox.Font = new Font("Segoe UI", 9F, FontStyle.Italic); } - + searchTextBox.ForeColor = Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(180)))), ((int)(((byte)(180))))); - if (searchTextBox.Visible) - { - adbCmd_background.Visible = false; - } - else - { - _ = gamesListView.Focus(); - } + _ = gamesListView.Focus(); } private void gamesListView_KeyPress(object sender, KeyPressEventArgs e) @@ -4841,91 +4867,7 @@ function onYouTubeIframeAPIReady() { btnUpdateAvailable.Click += btnUpdateAvailable_Click; btnNewerThanList.Click += btnNewerThanList_Click; } - - private async void ADBcommandbox_KeyPress(object sender, KeyPressEventArgs e) - { - searchTextBox.KeyPress += new - System.Windows.Forms.KeyPressEventHandler(CheckEnter); - if (e.KeyChar == (char)Keys.Enter) - { - if (manualIP) - { - string IPaddr; - IPaddr = adbCmd_CommandBox.Text; - string IPcmnd = "connect " + IPaddr + ":5555"; - await Task.Delay(1000); - string errorChecker = ADB.RunAdbCommandToString(IPcmnd).Output; - if (errorChecker.Contains("cannot resolve host") | errorChecker.Contains("cannot connect to")) - { - changeTitle(""); - _ = FlexibleMessageBox.Show(Program.form, "Manual ADB over WiFi Connection failed\nExiting...", "Manual IP Connection Failed!", MessageBoxButtons.OK); - manualIP = false; - adbCmd_CommandBox.Visible = false; - adbCmd_btnToggleUpdates.Visible = false; - adbCmd_btnSend.Visible = false; - adbCmd_Label.Visible = false; - adbCmd_background.Visible = false; - adbCmd_Label.Text = "Type ADB Command"; - _ = gamesListView.Focus(); - } - else - { - _ = await Program.form.CheckForDevice(); - Program.form.showAvailableSpace(); - settings.IPAddress = IPcmnd; - settings.Save(); - try { File.WriteAllText(storedIpPath, IPcmnd); } - catch (Exception ex) { Logger.Log($"Unable to write to StoredIP.txt due to {ex.Message}", LogLevel.ERROR); } - ADB.wirelessadbON = true; - _ = ADB.RunAdbCommandToString("shell settings put global wifi_wakeup_available 1"); - _ = ADB.RunAdbCommandToString("shell settings put global wifi_wakeup_enabled 1"); - manualIP = false; - adbCmd_CommandBox.Visible = false; - adbCmd_btnToggleUpdates.Visible = false; - adbCmd_btnSend.Visible = false; - adbCmd_Label.Visible = false; - adbCmd_background.Visible = false; - adbCmd_Label.Text = "Type ADB Command"; - changeTitle(""); - Program.form.changeTitlebarToDevice(); - _ = gamesListView.Focus(); - } - } - else - { - string sentCommand = adbCmd_CommandBox.Text.Replace("adb", ""); - Program.form.changeTitle($"Running ADB command: ADB {sentCommand}"); - string output = ADB.RunAdbCommandToString(adbCmd_CommandBox.Text).Output; - _ = FlexibleMessageBox.Show(Program.form, $"Ran ADB command: ADB {sentCommand}\r\nOutput:\r\n{output}"); - adbCmd_CommandBox.Visible = false; - adbCmd_btnToggleUpdates.Visible = false; - adbCmd_btnSend.Visible = false; - adbCmd_Label.Visible = false; - adbCmd_background.Visible = false; - _ = gamesListView.Focus(); - changeTitle(""); - } - } - if (e.KeyChar == (char)Keys.Escape) - { - adbCmd_CommandBox.Visible = false; - adbCmd_btnToggleUpdates.Visible = false; - adbCmd_btnSend.Visible = false; - adbCmd_Label.Visible = false; - adbCmd_background.Visible = false; - _ = gamesListView.Focus(); - } - } - - private void ADBcommandbox_Leave(object sender, EventArgs e) - { - adbCmd_background.Visible = false; - adbCmd_CommandBox.Visible = false; - adbCmd_btnToggleUpdates.Visible = false; - adbCmd_btnSend.Visible = false; - adbCmd_Label.Visible = false; - } - + private void gamesQueListBox_MouseDown(object sender, MouseEventArgs e) { if (gamesQueListBox.SelectedItem == null) @@ -5223,16 +5165,36 @@ function onYouTubeIframeAPIReady() { _ = searchTextBox.Focus(); } - private async void btnRunAdbCmd_Click(object sender, EventArgs e) + private void btnRunAdbCmd_Click(object sender, EventArgs e) { - adbCmd_CommandBox.Visible = true; - adbCmd_btnToggleUpdates.Visible = true; - adbCmd_btnSend.Visible = true; - adbCmd_CommandBox.Clear(); - adbCmd_Label.Text = "Type ADB Command"; - adbCmd_Label.Visible = true; - adbCmd_background.Visible = true; - _ = adbCmd_CommandBox.Focus(); + using (var adbForm = new AdbCommandForm()) + { + if (adbForm.ShowDialog(this) == DialogResult.OK) + { + string command = adbForm.Command; + if (!string.IsNullOrWhiteSpace(command)) + { + string sentCommand = command.Replace("adb", "").Trim(); + changeTitle($"Running ADB command: ADB {sentCommand}"); + string output = ADB.RunAdbCommandToString(command).Output; + + if (adbForm.ToggleUpdatesClicked) + { + bool isNowDisabled = output.Contains("disabled") || command.Contains("disable"); + string status = isNowDisabled ? "disabled" : "enabled"; + _ = JR.Utils.GUI.Forms.FlexibleMessageBox.Show(this, + $"OS Updates have been {status}.\n\nOutput:\n{output}"); + } + else + { + _ = JR.Utils.GUI.Forms.FlexibleMessageBox.Show(this, + $"Ran ADB command: ADB {sentCommand}\r\nOutput:\r\n{output}"); + } + + changeTitle(""); + } + } + } } private void btnOpenDownloads_Click(object sender, EventArgs e) @@ -5265,32 +5227,6 @@ function onYouTubeIframeAPIReady() { settings.Save(); } - private void adbCmd_btnToggleUpdates_Click(object sender, EventArgs e) - { - string adbResult = ADB.RunAdbCommandToString("adb shell pm list packages -d").Output; - bool isUpdatesDisabled = adbResult.Contains("com.oculus.updater"); - - if (isUpdatesDisabled == true) - { - // Updates are already disabled. Enable them - adbCmd_CommandBox.Text = "adb shell pm enable com.oculus.updater"; - } - else - { - adbCmd_CommandBox.Text = "shell pm disable-user --user 0 com.oculus.updater"; - } - - // adb shell pm enable com.oculus.updater - KeyPressEventArgs enterKeyPressArgs = new KeyPressEventArgs((char)Keys.Enter); - ADBcommandbox_KeyPress(adbCmd_CommandBox, enterKeyPressArgs); - } - - private void adbCmd_btnSend_Click(object sender, EventArgs e) - { - KeyPressEventArgs enterKeyPressArgs = new KeyPressEventArgs((char)Keys.Enter); - ADBcommandbox_KeyPress(adbCmd_CommandBox, enterKeyPressArgs); - } - private ListViewItem _rightClickedItem; private void gamesListView_MouseClick(object sender, MouseEventArgs e) { diff --git a/MainForm.resx b/MainForm.resx index 5f0ed55..277592f 100644 --- a/MainForm.resx +++ b/MainForm.resx @@ -177,6 +177,12 @@ 1320, 17 + + 1165, 17 + + + 428, 54 + 1021, 91 diff --git a/NewApps.Designer.cs b/NewApps.Designer.cs index a31c736..fc8717c 100644 --- a/NewApps.Designer.cs +++ b/NewApps.Designer.cs @@ -33,106 +33,146 @@ namespace AndroidSideloader this.NewAppsListView = new System.Windows.Forms.ListView(); this.GameNameIndex = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.PackageNameIndex = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.panel2 = new System.Windows.Forms.Panel(); - this.label2 = new System.Windows.Forms.Label(); + this.panel1 = new System.Windows.Forms.Panel(); this.NewAppsButton = new AndroidSideloader.RoundButton(); + this.label2 = new System.Windows.Forms.Label(); + this.titleLabel = new System.Windows.Forms.Label(); + this.panel2 = new System.Windows.Forms.Panel(); + this.panel1.SuspendLayout(); this.panel2.SuspendLayout(); this.SuspendLayout(); - // + // // NewAppsListView - // + // this.NewAppsListView.AccessibleRole = System.Windows.Forms.AccessibleRole.None; - this.NewAppsListView.BackColor = global::AndroidSideloader.Properties.Settings.Default.BackColor; + this.NewAppsListView.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(32)))), ((int)(((byte)(38))))); this.NewAppsListView.BorderStyle = System.Windows.Forms.BorderStyle.None; this.NewAppsListView.CausesValidation = false; this.NewAppsListView.CheckBoxes = true; this.NewAppsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.GameNameIndex, this.PackageNameIndex}); - this.NewAppsListView.DataBindings.Add(new System.Windows.Forms.Binding("BackColor", global::AndroidSideloader.Properties.Settings.Default, "BackColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); + this.NewAppsListView.Dock = System.Windows.Forms.DockStyle.Fill; + this.NewAppsListView.Font = new System.Drawing.Font("Segoe UI", 9.5F); this.NewAppsListView.ForeColor = System.Drawing.Color.White; this.NewAppsListView.FullRowSelect = true; this.NewAppsListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; this.NewAppsListView.HideSelection = false; - this.NewAppsListView.Location = new System.Drawing.Point(3, 5); + this.NewAppsListView.Location = new System.Drawing.Point(1, 1); this.NewAppsListView.Name = "NewAppsListView"; - this.NewAppsListView.RightToLeftLayout = true; - this.NewAppsListView.Size = new System.Drawing.Size(288, 167); + this.NewAppsListView.Size = new System.Drawing.Size(298, 168); this.NewAppsListView.TabIndex = 1; this.NewAppsListView.UseCompatibleStateImageBehavior = false; this.NewAppsListView.View = System.Windows.Forms.View.Details; this.NewAppsListView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.label2_MouseDown); this.NewAppsListView.MouseMove += new System.Windows.Forms.MouseEventHandler(this.label2_MouseMove); this.NewAppsListView.MouseUp += new System.Windows.Forms.MouseEventHandler(this.label2_MouseUp); - // + // // GameNameIndex - // - this.GameNameIndex.Text = "Game Name"; - this.GameNameIndex.Width = 284; - // + // + this.GameNameIndex.Text = "App Name"; + this.GameNameIndex.Width = 280; + // // PackageNameIndex - // + // this.PackageNameIndex.Width = 0; - // - // panel2 - // - this.panel2.BackColor = global::AndroidSideloader.Properties.Settings.Default.SubButtonColor; - this.panel2.Controls.Add(this.NewAppsListView); - this.panel2.DataBindings.Add(new System.Windows.Forms.Binding("BackColor", global::AndroidSideloader.Properties.Settings.Default, "SubButtonColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.panel2.Location = new System.Drawing.Point(9, 31); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(295, 175); - this.panel2.TabIndex = 8; - // + // + // panel1 + // + this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(24)))), ((int)(((byte)(29))))); + this.panel1.Controls.Add(this.NewAppsButton); + this.panel1.Controls.Add(this.label2); + this.panel1.Controls.Add(this.titleLabel); + this.panel1.Controls.Add(this.panel2); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(0, 0); + this.panel1.Name = "panel1"; + this.panel1.Padding = new System.Windows.Forms.Padding(16); + this.panel1.Size = new System.Drawing.Size(340, 300); + this.panel1.TabIndex = 10; + this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.label2_MouseDown); + this.panel1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.label2_MouseMove); + this.panel1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.label2_MouseUp); + // + // NewAppsButton + // + this.NewAppsButton.Active1 = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(140)))), ((int)(((byte)(115))))); + this.NewAppsButton.Active2 = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(125)))), ((int)(((byte)(105))))); + this.NewAppsButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.NewAppsButton.BackColor = System.Drawing.Color.Transparent; + this.NewAppsButton.DialogResult = System.Windows.Forms.DialogResult.OK; + this.NewAppsButton.Disabled1 = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(35)))), ((int)(((byte)(45))))); + this.NewAppsButton.Disabled2 = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(28)))), ((int)(((byte)(35))))); + this.NewAppsButton.DisabledStrokeColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(55)))), ((int)(((byte)(65))))); + this.NewAppsButton.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Bold); + this.NewAppsButton.ForeColor = System.Drawing.Color.White; + this.NewAppsButton.Inactive1 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(120)))), ((int)(((byte)(100))))); + this.NewAppsButton.Inactive2 = System.Drawing.Color.FromArgb(((int)(((byte)(35)))), ((int)(((byte)(100)))), ((int)(((byte)(85))))); + this.NewAppsButton.Location = new System.Drawing.Point(20, 252); + this.NewAppsButton.Name = "NewAppsButton"; + this.NewAppsButton.Radius = 4; + this.NewAppsButton.Size = new System.Drawing.Size(300, 36); + this.NewAppsButton.Stroke = true; + this.NewAppsButton.StrokeColor = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(150)))), ((int)(((byte)(125))))); + this.NewAppsButton.TabIndex = 2; + this.NewAppsButton.Text = "Continue"; + this.NewAppsButton.Transparency = false; + this.NewAppsButton.Click += new System.EventHandler(this.DonateButton_Click); + // // label2 - // + // this.label2.AutoSize = true; this.label2.BackColor = System.Drawing.Color.Transparent; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.25F, System.Drawing.FontStyle.Bold); - this.label2.ForeColor = System.Drawing.SystemColors.ControlLightLight; - this.label2.Location = new System.Drawing.Point(28, 7); + this.label2.Font = new System.Drawing.Font("Segoe UI", 9F); + this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(160)))), ((int)(((byte)(165)))), ((int)(((byte)(175))))); + this.label2.Location = new System.Drawing.Point(20, 42); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(256, 17); + this.label2.Size = new System.Drawing.Size(223, 15); this.label2.TabIndex = 9; - this.label2.Text = "Check box of all free/non-VR apps"; - this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label2.Text = "Check the box for all free or non-VR apps"; this.label2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.label2_MouseDown); this.label2.MouseMove += new System.Windows.Forms.MouseEventHandler(this.label2_MouseMove); this.label2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.label2_MouseUp); - // - // NewAppsButton - // - this.NewAppsButton.Active1 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); - this.NewAppsButton.Active2 = System.Drawing.Color.FromArgb(((int)(((byte)(40)))), ((int)(((byte)(40)))), ((int)(((byte)(40))))); - this.NewAppsButton.BackColor = System.Drawing.Color.Transparent; - this.NewAppsButton.DialogResult = System.Windows.Forms.DialogResult.OK; - this.NewAppsButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F); - this.NewAppsButton.ForeColor = System.Drawing.Color.White; - this.NewAppsButton.Inactive1 = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(25)))), ((int)(((byte)(25))))); - this.NewAppsButton.Inactive2 = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(25)))), ((int)(((byte)(25))))); - this.NewAppsButton.Location = new System.Drawing.Point(12, 212); - this.NewAppsButton.Name = "NewAppsButton"; - this.NewAppsButton.Radius = 5; - this.NewAppsButton.Size = new System.Drawing.Size(288, 29); - this.NewAppsButton.Stroke = true; - this.NewAppsButton.StrokeColor = System.Drawing.Color.FromArgb(((int)(((byte)(74)))), ((int)(((byte)(74)))), ((int)(((byte)(74))))); - this.NewAppsButton.TabIndex = 2; - this.NewAppsButton.Text = "Accept"; - this.NewAppsButton.Transparency = false; - this.NewAppsButton.Click += new System.EventHandler(this.DonateButton_Click); - // + // + // titleLabel + // + this.titleLabel.AutoSize = true; + this.titleLabel.BackColor = System.Drawing.Color.Transparent; + this.titleLabel.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Bold); + this.titleLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(93)))), ((int)(((byte)(203)))), ((int)(((byte)(173))))); + this.titleLabel.Location = new System.Drawing.Point(20, 15); + this.titleLabel.Name = "titleLabel"; + this.titleLabel.Size = new System.Drawing.Size(129, 20); + this.titleLabel.TabIndex = 11; + this.titleLabel.Text = "New Apps Found"; + this.titleLabel.MouseDown += new System.Windows.Forms.MouseEventHandler(this.label2_MouseDown); + this.titleLabel.MouseMove += new System.Windows.Forms.MouseEventHandler(this.label2_MouseMove); + this.titleLabel.MouseUp += new System.Windows.Forms.MouseEventHandler(this.label2_MouseUp); + // + // panel2 + // + this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.panel2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(32)))), ((int)(((byte)(38))))); + this.panel2.Controls.Add(this.NewAppsListView); + this.panel2.Location = new System.Drawing.Point(20, 70); + this.panel2.Name = "panel2"; + this.panel2.Padding = new System.Windows.Forms.Padding(1); + this.panel2.Size = new System.Drawing.Size(300, 170); + this.panel2.TabIndex = 8; + // // NewApps - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = global::AndroidSideloader.Properties.Settings.Default.BackColor; - this.ClientSize = new System.Drawing.Size(313, 248); + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(24)))), ((int)(((byte)(29))))); + this.ClientSize = new System.Drawing.Size(340, 300); this.ControlBox = false; - this.Controls.Add(this.NewAppsButton); - this.Controls.Add(this.label2); - this.Controls.Add(this.panel2); - this.DataBindings.Add(new System.Windows.Forms.Binding("BackColor", global::AndroidSideloader.Properties.Settings.Default, "BackColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; + this.Controls.Add(this.panel1); + this.ForeColor = System.Drawing.Color.White; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "NewApps"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; @@ -140,9 +180,10 @@ namespace AndroidSideloader this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.label2_MouseDown); this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.label2_MouseMove); this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.label2_MouseUp); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); this.panel2.ResumeLayout(false); this.ResumeLayout(false); - this.PerformLayout(); } @@ -150,9 +191,11 @@ namespace AndroidSideloader private System.Windows.Forms.ListView NewAppsListView; private System.Windows.Forms.ColumnHeader GameNameIndex; + private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label titleLabel; private System.Windows.Forms.ColumnHeader PackageNameIndex; private RoundButton NewAppsButton; } -} +} \ No newline at end of file diff --git a/NewApps.cs b/NewApps.cs index 6e1448e..9458057 100644 --- a/NewApps.cs +++ b/NewApps.cs @@ -1,57 +1,180 @@ using System; using System.Collections.Generic; using System.Drawing; +using System.Drawing.Drawing2D; +using System.Runtime.InteropServices; using System.Windows.Forms; namespace AndroidSideloader { public partial class NewApps : Form { - private bool mouseDown; - private Point lastLocation; + // Modern theme colors + private static readonly Color BackgroundColor = Color.FromArgb(20, 24, 29); + private static readonly Color BorderColor = Color.FromArgb(70, 80, 100); + + // Shadow and corner settings + private const int CS_DROPSHADOW = 0x00020000; + private const int WM_NCLBUTTONDOWN = 0xA1; + private const int HT_CAPTION = 0x2; + private const int SHADOW_SIZE = 2; + private const int CONTENT_RADIUS = 10; + + [DllImport("user32.dll")] + private static extern int SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam); + + [DllImport("user32.dll")] + private static extern bool ReleaseCapture(); + + protected override CreateParams CreateParams + { + get + { + CreateParams cp = base.CreateParams; + cp.ClassStyle |= CS_DROPSHADOW; + return cp; + } + } public NewApps() { InitializeComponent(); + ApplyModernTheme(); + CenterToScreen(); } - private void label2_MouseDown(object sender, MouseEventArgs e) + private void ApplyModernTheme() { - mouseDown = true; - lastLocation = e.Location; - } + this.FormBorderStyle = FormBorderStyle.None; + this.BackColor = Color.FromArgb(25, 25, 30); + this.Padding = new Padding(5); - private void label2_MouseMove(object sender, MouseEventArgs e) - { - if (mouseDown) + panel1.BackColor = BackgroundColor; + panel1.Location = new Point(6, 6); + panel1.Size = new Size(this.ClientSize.Width - 12, this.ClientSize.Height - 12); + panel1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + + this.Paint += Form_Paint; + + // Close button + var closeButton = new Button { - Location = new Point( - Location.X - lastLocation.X + e.X, Location.Y - lastLocation.Y + e.Y); + Text = "✕", + Font = new Font("Segoe UI", 9F), + ForeColor = Color.White, + BackColor = BackgroundColor, + FlatStyle = FlatStyle.Flat, + Size = new Size(30, 28), + Location = new Point(panel1.Width - 35, 5), + Cursor = Cursors.Hand, + TabStop = false + }; + closeButton.FlatAppearance.BorderSize = 0; + closeButton.FlatAppearance.MouseOverBackColor = Color.FromArgb(200, 60, 60); + closeButton.Click += (s, e) => Close(); + panel1.Controls.Add(closeButton); + closeButton.BringToFront(); - Update(); + // Enable dragging + panel1.MouseDown += TitleArea_MouseDown; + label2.MouseDown += TitleArea_MouseDown; + titleLabel.MouseDown += TitleArea_MouseDown; + } + + private void TitleArea_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Left) + { + ReleaseCapture(); + SendMessage(this.Handle, WM_NCLBUTTONDOWN, (IntPtr)HT_CAPTION, IntPtr.Zero); } } - private void label2_MouseUp(object sender, MouseEventArgs e) + private void Form_Paint(object sender, PaintEventArgs e) { - mouseDown = false; + e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; + e.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; + + int w = this.Width; + int h = this.Height; + + // Draw shadow layers + for (int i = SHADOW_SIZE; i >= 1; i--) + { + int alpha = (SHADOW_SIZE - i + 1) * 12; + Rectangle shadowRect = new Rectangle( + SHADOW_SIZE - i, + SHADOW_SIZE - i, + w - (SHADOW_SIZE - i) * 2 - 1, + h - (SHADOW_SIZE - i) * 2 - 1); + + using (Pen shadowPen = new Pen(Color.FromArgb(alpha, 0, 0, 0), 1)) + using (GraphicsPath shadowPath = CreateRoundedRectPath(shadowRect, CONTENT_RADIUS + i)) + { + e.Graphics.DrawPath(shadowPen, shadowPath); + } + } + + // Draw content background + Rectangle contentRect = new Rectangle(SHADOW_SIZE, SHADOW_SIZE, w - SHADOW_SIZE * 2, h - SHADOW_SIZE * 2); + using (GraphicsPath contentPath = CreateRoundedRectPath(contentRect, CONTENT_RADIUS)) + { + using (SolidBrush bgBrush = new SolidBrush(BackgroundColor)) + { + e.Graphics.FillPath(bgBrush, contentPath); + } + + using (Pen borderPen = new Pen(BorderColor, 1f)) + { + e.Graphics.DrawPath(borderPen, contentPath); + } + } + + // Apply rounded region + using (GraphicsPath regionPath = CreateRoundedRectPath(new Rectangle(0, 0, w, h), CONTENT_RADIUS + SHADOW_SIZE)) + { + this.Region = new Region(regionPath); + } } + private GraphicsPath CreateRoundedRectPath(Rectangle rect, int radius) + { + GraphicsPath path = new GraphicsPath(); + if (radius <= 0) + { + path.AddRectangle(rect); + return path; + } + + int diameter = Math.Min(radius * 2, Math.Min(rect.Width, rect.Height)); + radius = diameter / 2; + Rectangle arcRect = new Rectangle(rect.Location, new Size(diameter, diameter)); + + path.AddArc(arcRect, 180, 90); + arcRect.X = rect.Right - diameter; + path.AddArc(arcRect, 270, 90); + arcRect.Y = rect.Bottom - diameter; + path.AddArc(arcRect, 0, 90); + arcRect.X = rect.Left; + path.AddArc(arcRect, 90, 90); + path.CloseFigure(); + return path; + } + + private void label2_MouseDown(object sender, MouseEventArgs e) => TitleArea_MouseDown(sender, e); + private void label2_MouseMove(object sender, MouseEventArgs e) { } + private void label2_MouseUp(object sender, MouseEventArgs e) { } + private void DonateButton_Click(object sender, EventArgs e) { string HWID = SideloaderUtilities.UUID(); foreach (ListViewItem listItem in NewAppsListView.Items) { if (listItem.Checked) - { Properties.Settings.Default.NonAppPackages += listItem.SubItems[Donors.PackageNameIndex].Text + ";" + HWID + "\n"; - Properties.Settings.Default.Save(); - } else - { Properties.Settings.Default.AppPackages += listItem.SubItems[Donors.PackageNameIndex].Text + "\n"; - Properties.Settings.Default.Save(); - } + Properties.Settings.Default.Save(); } MainForm.newPackageUpload(); Close(); @@ -61,20 +184,16 @@ namespace AndroidSideloader { NewAppsListView.Items.Clear(); Donors.initNewApps(); - List NewAppList = new List(); + var NewAppList = new List(); foreach (string[] release in Donors.newApps) { ListViewItem NGame = new ListViewItem(release); if (!NewAppList.Contains(NGame)) - { NewAppList.Add(NGame); - } } - ListViewItem[] arr = NewAppList.ToArray(); NewAppsListView.BeginUpdate(); - NewAppsListView.Items.Clear(); - NewAppsListView.Items.AddRange(arr); + NewAppsListView.Items.AddRange(NewAppList.ToArray()); NewAppsListView.EndUpdate(); } } -} +} \ No newline at end of file diff --git a/RoundButton.cs b/RoundButton.cs index 0eec832..138f202 100644 --- a/RoundButton.cs +++ b/RoundButton.cs @@ -109,7 +109,7 @@ namespace AndroidSideloader #endregion #region Drawing - e.Graphics.SmoothingMode = SmoothingMode.HighQuality; + e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; roundedRect = new RoundedRectangleF(Width, Height, radius); e.Graphics.FillRectangle(Brushes.Transparent, ClientRectangle); diff --git a/UpdateForm.cs b/UpdateForm.cs index ff6d47c..61fcd9e 100644 --- a/UpdateForm.cs +++ b/UpdateForm.cs @@ -94,7 +94,7 @@ namespace AndroidSideloader private void Panel1_Paint(object sender, PaintEventArgs e) { var panel = sender as Panel; - e.Graphics.SmoothingMode = SmoothingMode.HighQuality; + e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; e.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; int radius = 12; @@ -125,7 +125,7 @@ namespace AndroidSideloader private void Panel3_Paint(object sender, PaintEventArgs e) { var panel = sender as Panel; - e.Graphics.SmoothingMode = SmoothingMode.HighQuality; + e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; e.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; int radius = 10; @@ -155,7 +155,7 @@ namespace AndroidSideloader private void UpdateForm_Paint(object sender, PaintEventArgs e) { - e.Graphics.SmoothingMode = SmoothingMode.HighQuality; + e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; int w = this.ClientSize.Width; int h = this.ClientSize.Height; diff --git a/UsernameForm.Designer.cs b/UsernameForm.Designer.cs index 0e164ef..d2114a7 100644 --- a/UsernameForm.Designer.cs +++ b/UsernameForm.Designer.cs @@ -36,8 +36,6 @@ // textBox1 // this.textBox1.BackColor = global::AndroidSideloader.Properties.Settings.Default.TextBoxColor; - this.textBox1.DataBindings.Add(new System.Windows.Forms.Binding("BackColor", global::AndroidSideloader.Properties.Settings.Default, "TextBoxColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.textBox1.DataBindings.Add(new System.Windows.Forms.Binding("Font", global::AndroidSideloader.Properties.Settings.Default, "FontStyle", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); this.textBox1.Font = global::AndroidSideloader.Properties.Settings.Default.FontStyle; this.textBox1.ForeColor = System.Drawing.Color.White; this.textBox1.Location = new System.Drawing.Point(13, 13); @@ -75,7 +73,6 @@ this.ClientSize = new System.Drawing.Size(443, 100); this.Controls.Add(this.button1); this.Controls.Add(this.textBox1); - this.DataBindings.Add(new System.Windows.Forms.Binding("BackColor", global::AndroidSideloader.Properties.Settings.Default, "BackColor", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); this.ForeColor = System.Drawing.Color.White; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximumSize = new System.Drawing.Size(459, 139);