deadmoon 2 năm trước cách đây
mục cha
commit
77eec8e2c9

+ 2 - 0
Optimizer/Controls/MoonTabs.cs

@@ -67,6 +67,8 @@ namespace Optimizer
 
 
             Margin = new Padding(0);
             Margin = new Padding(0);
             Padding = new Point(0, 0);
             Padding = new Point(0, 0);
+
+            this.SizeMode = TabSizeMode.Normal;
         }
         }
 
 
         private void SetDragState() => bDrag = (CanDrag && bMouseDown && bShiftKey);
         private void SetDragState() => bDrag = (CanDrag && bMouseDown && bShiftKey);

+ 1 - 1
Optimizer/Controls/ToggleCard.Designer.cs

@@ -38,7 +38,7 @@ namespace Optimizer
             // Label
             // Label
             // 
             // 
             this.Label.AutoSize = true;
             this.Label.AutoSize = true;
-            this.Label.Location = new System.Drawing.Point(52, 2);
+            this.Label.Location = new System.Drawing.Point(52, 1);
             this.Label.Name = "Label";
             this.Label.Name = "Label";
             this.Label.Size = new System.Drawing.Size(45, 19);
             this.Label.Size = new System.Drawing.Size(45, 19);
             this.Label.TabIndex = 1;
             this.Label.TabIndex = 1;

+ 36 - 0
Optimizer/FontHelper.cs

@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Drawing.Text;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Optimizer
+{
+    internal static class FontHelper
+    {
+        [System.Runtime.InteropServices.DllImport("gdi32.dll")]
+        private static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, uint cbFont,
+            IntPtr pdv, [System.Runtime.InteropServices.In] ref uint pcFonts);
+
+        static PrivateFontCollection fonts = new PrivateFontCollection();
+
+        internal static Font Poppins15;
+
+        internal static void LoadFont()
+        {
+            byte[] fontData = Properties.Resources.Poppins_Regular;
+            IntPtr fontPtr = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(fontData.Length);
+            System.Runtime.InteropServices.Marshal.Copy(fontData, 0, fontPtr, fontData.Length);
+
+            uint dummy = 0;
+
+            fonts.AddMemoryFont(fontPtr, Properties.Resources.Poppins_Regular.Length);
+            AddFontMemResourceEx(fontPtr, (uint)Properties.Resources.Poppins_Regular.Length, IntPtr.Zero, ref dummy);
+            System.Runtime.InteropServices.Marshal.FreeCoTaskMem(fontPtr);
+
+            Poppins15 = new Font(fonts.Families[0], 15f);
+        }
+    }
+}

+ 2 - 28
Optimizer/Forms/AboutForm.Designer.cs

@@ -32,7 +32,6 @@
             this.pictureBox1 = new System.Windows.Forms.PictureBox();
             this.pictureBox1 = new System.Windows.Forms.PictureBox();
             this.l1 = new System.Windows.Forms.Label();
             this.l1 = new System.Windows.Forms.Label();
             this.l2 = new System.Windows.Forms.LinkLabel();
             this.l2 = new System.Windows.Forms.LinkLabel();
-            this.btnAbout = new System.Windows.Forms.Button();
             this.t1 = new System.Windows.Forms.Timer(this.components);
             this.t1 = new System.Windows.Forms.Timer(this.components);
             this.t2 = new System.Windows.Forms.Timer(this.components);
             this.t2 = new System.Windows.Forms.Timer(this.components);
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
@@ -52,12 +51,12 @@
             // l1
             // l1
             // 
             // 
             this.l1.AutoSize = true;
             this.l1.AutoSize = true;
-            this.l1.Font = new System.Drawing.Font("Segoe UI Semibold", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+            this.l1.Font = new System.Drawing.Font("Segoe UI Semibold", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
             this.l1.ForeColor = System.Drawing.Color.White;
             this.l1.ForeColor = System.Drawing.Color.White;
             this.l1.Location = new System.Drawing.Point(102, 10);
             this.l1.Location = new System.Drawing.Point(102, 10);
             this.l1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.l1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.l1.Name = "l1";
             this.l1.Name = "l1";
-            this.l1.Size = new System.Drawing.Size(0, 25);
+            this.l1.Size = new System.Drawing.Size(0, 28);
             this.l1.TabIndex = 3;
             this.l1.TabIndex = 3;
             // 
             // 
             // l2
             // l2
@@ -73,26 +72,6 @@
             this.l2.Tag = "themeable";
             this.l2.Tag = "themeable";
             this.l2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.l2_LinkClicked);
             this.l2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.l2_LinkClicked);
             // 
             // 
-            // btnAbout
-            // 
-            this.btnAbout.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
-            this.btnAbout.BackColor = System.Drawing.Color.DodgerBlue;
-            this.btnAbout.DialogResult = System.Windows.Forms.DialogResult.Cancel;
-            this.btnAbout.FlatAppearance.BorderSize = 0;
-            this.btnAbout.FlatAppearance.MouseDownBackColor = System.Drawing.Color.RoyalBlue;
-            this.btnAbout.FlatAppearance.MouseOverBackColor = System.Drawing.Color.RoyalBlue;
-            this.btnAbout.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
-            this.btnAbout.ForeColor = System.Drawing.Color.White;
-            this.btnAbout.Location = new System.Drawing.Point(274, 10);
-            this.btnAbout.Margin = new System.Windows.Forms.Padding(2);
-            this.btnAbout.Name = "btnAbout";
-            this.btnAbout.Size = new System.Drawing.Size(103, 31);
-            this.btnAbout.TabIndex = 36;
-            this.btnAbout.Tag = "themeable";
-            this.btnAbout.Text = "OK";
-            this.btnAbout.UseVisualStyleBackColor = false;
-            this.btnAbout.Click += new System.EventHandler(this.button7_Click);
-            // 
             // t1
             // t1
             // 
             // 
             this.t1.Interval = 350;
             this.t1.Interval = 350;
@@ -105,17 +84,13 @@
             // 
             // 
             // AboutForm
             // AboutForm
             // 
             // 
-            this.AcceptButton = this.btnAbout;
             this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
             this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
-            this.CancelButton = this.btnAbout;
             this.ClientSize = new System.Drawing.Size(387, 108);
             this.ClientSize = new System.Drawing.Size(387, 108);
-            this.Controls.Add(this.btnAbout);
             this.Controls.Add(this.l2);
             this.Controls.Add(this.l2);
             this.Controls.Add(this.l1);
             this.Controls.Add(this.l1);
             this.Controls.Add(this.pictureBox1);
             this.Controls.Add(this.pictureBox1);
-            this.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(161)));
             this.ForeColor = System.Drawing.Color.White;
             this.ForeColor = System.Drawing.Color.White;
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
             this.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
             this.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
@@ -138,7 +113,6 @@
         private System.Windows.Forms.PictureBox pictureBox1;
         private System.Windows.Forms.PictureBox pictureBox1;
         private System.Windows.Forms.Label l1;
         private System.Windows.Forms.Label l1;
         private System.Windows.Forms.LinkLabel l2;
         private System.Windows.Forms.LinkLabel l2;
-        private System.Windows.Forms.Button btnAbout;
         private System.Windows.Forms.Timer t1;
         private System.Windows.Forms.Timer t1;
         private System.Windows.Forms.Timer t2;
         private System.Windows.Forms.Timer t2;
     }
     }

+ 0 - 7
Optimizer/Forms/AboutForm.cs

@@ -32,13 +32,6 @@ namespace Optimizer
                     pictureBox1.Image = Properties.Resources.logoAmethyst;
                     pictureBox1.Image = Properties.Resources.logoAmethyst;
                     break;
                     break;
             }
             }
-
-            btnAbout.Text = Options.TranslationList["btnAbout"].ToString();
-        }
-
-        private void button7_Click(object sender, EventArgs e)
-        {
-            this.Close();
         }
         }
 
 
         private void About_Load(object sender, EventArgs e)
         private void About_Load(object sender, EventArgs e)

+ 3 - 19
Optimizer/Forms/SplashForm.Designer.cs

@@ -32,9 +32,7 @@ namespace Optimizer
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SplashForm));
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SplashForm));
             this.LoadingStatus = new System.Windows.Forms.Label();
             this.LoadingStatus = new System.Windows.Forms.Label();
             this.pictureBox2 = new System.Windows.Forms.PictureBox();
             this.pictureBox2 = new System.Windows.Forms.PictureBox();
-            this.pictureBox1 = new System.Windows.Forms.PictureBox();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
             this.SuspendLayout();
             this.SuspendLayout();
             // 
             // 
             // LoadingStatus
             // LoadingStatus
@@ -42,9 +40,9 @@ namespace Optimizer
             this.LoadingStatus.Dock = System.Windows.Forms.DockStyle.Bottom;
             this.LoadingStatus.Dock = System.Windows.Forms.DockStyle.Bottom;
             this.LoadingStatus.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
             this.LoadingStatus.Font = new System.Drawing.Font("Segoe UI Semibold", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
             this.LoadingStatus.ForeColor = System.Drawing.Color.Silver;
             this.LoadingStatus.ForeColor = System.Drawing.Color.Silver;
-            this.LoadingStatus.Location = new System.Drawing.Point(0, 284);
+            this.LoadingStatus.Location = new System.Drawing.Point(0, 244);
             this.LoadingStatus.Name = "LoadingStatus";
             this.LoadingStatus.Name = "LoadingStatus";
-            this.LoadingStatus.Size = new System.Drawing.Size(429, 39);
+            this.LoadingStatus.Size = new System.Drawing.Size(429, 43);
             this.LoadingStatus.TabIndex = 2;
             this.LoadingStatus.TabIndex = 2;
             this.LoadingStatus.Text = "loading settings ...";
             this.LoadingStatus.Text = "loading settings ...";
             this.LoadingStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             this.LoadingStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -59,24 +57,12 @@ namespace Optimizer
             this.pictureBox2.TabIndex = 1;
             this.pictureBox2.TabIndex = 1;
             this.pictureBox2.TabStop = false;
             this.pictureBox2.TabStop = false;
             // 
             // 
-            // pictureBox1
-            // 
-            this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
-            this.pictureBox1.Image = global::Optimizer.Properties.Resources.loadingAmethyst;
-            this.pictureBox1.Location = new System.Drawing.Point(164, 190);
-            this.pictureBox1.Name = "pictureBox1";
-            this.pictureBox1.Size = new System.Drawing.Size(96, 96);
-            this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
-            this.pictureBox1.TabIndex = 3;
-            this.pictureBox1.TabStop = false;
-            // 
             // SplashForm
             // SplashForm
             // 
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
             this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
-            this.ClientSize = new System.Drawing.Size(429, 323);
-            this.Controls.Add(this.pictureBox1);
+            this.ClientSize = new System.Drawing.Size(429, 287);
             this.Controls.Add(this.LoadingStatus);
             this.Controls.Add(this.LoadingStatus);
             this.Controls.Add(this.pictureBox2);
             this.Controls.Add(this.pictureBox2);
             this.DoubleBuffered = true;
             this.DoubleBuffered = true;
@@ -89,7 +75,6 @@ namespace Optimizer
             this.Name = "SplashForm";
             this.Name = "SplashForm";
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
             this.ResumeLayout(false);
             this.ResumeLayout(false);
 
 
         }
         }
@@ -97,6 +82,5 @@ namespace Optimizer
         #endregion
         #endregion
         protected internal System.Windows.Forms.Label LoadingStatus;
         protected internal System.Windows.Forms.Label LoadingStatus;
         private System.Windows.Forms.PictureBox pictureBox2;
         private System.Windows.Forms.PictureBox pictureBox2;
-        private System.Windows.Forms.PictureBox pictureBox1;
     }
     }
 }
 }

+ 9 - 6
Optimizer/Forms/SplashForm.cs

@@ -7,33 +7,36 @@ namespace Optimizer
         public SplashForm()
         public SplashForm()
         {
         {
             InitializeComponent();
             InitializeComponent();
+
             this.DoubleBuffered = true;
             this.DoubleBuffered = true;
             CheckForIllegalCrossThreadCalls = false;
             CheckForIllegalCrossThreadCalls = false;
 
 
+            LoadingStatus.Font = FontHelper.Poppins15;
+
             switch (Options.CurrentOptions.Color)
             switch (Options.CurrentOptions.Color)
             {
             {
                 case Theme.Amber:
                 case Theme.Amber:
-                    pictureBox1.Image = Properties.Resources.loadingAmber;
+                    //pictureBox1.Image = Properties.Resources.loadingAmber;
                     pictureBox2.Image = Properties.Resources.bannerAmber;
                     pictureBox2.Image = Properties.Resources.bannerAmber;
                     break;
                     break;
                 case Theme.Jade:
                 case Theme.Jade:
-                    pictureBox1.Image = Properties.Resources.loadingJade;
+                    //pictureBox1.Image = Properties.Resources.loadingJade;
                     pictureBox2.Image = Properties.Resources.bannerJade;
                     pictureBox2.Image = Properties.Resources.bannerJade;
                     break;
                     break;
                 case Theme.Ruby:
                 case Theme.Ruby:
-                    pictureBox1.Image = Properties.Resources.loadingRuby;
+                    //pictureBox1.Image = Properties.Resources.loadingRuby;
                     pictureBox2.Image = Properties.Resources.bannerRuby;
                     pictureBox2.Image = Properties.Resources.bannerRuby;
                     break;
                     break;
                 case Theme.Silver:
                 case Theme.Silver:
-                    pictureBox1.Image = Properties.Resources.loadingSilver;
+                    //pictureBox1.Image = Properties.Resources.loadingSilver;
                     pictureBox2.Image = Properties.Resources.bannerSilver;
                     pictureBox2.Image = Properties.Resources.bannerSilver;
                     break;
                     break;
                 case Theme.Azurite:
                 case Theme.Azurite:
-                    pictureBox1.Image = Properties.Resources.loadingAzurite;
+                    //pictureBox1.Image = Properties.Resources.loadingAzurite;
                     pictureBox2.Image = Properties.Resources.bannerAzurite;
                     pictureBox2.Image = Properties.Resources.bannerAzurite;
                     break;
                     break;
                 case Theme.Amethyst:
                 case Theme.Amethyst:
-                    pictureBox1.Image = Properties.Resources.loadingAmethyst;
+                    //pictureBox1.Image = Properties.Resources.loadingAmethyst;
                     pictureBox2.Image = Properties.Resources.bannerAmethyst;
                     pictureBox2.Image = Properties.Resources.bannerAmethyst;
                     break;
                     break;
             }
             }

+ 2 - 0
Optimizer/Optimizer.csproj

@@ -112,6 +112,7 @@
       <DependentUpon>ToggleCard.cs</DependentUpon>
       <DependentUpon>ToggleCard.cs</DependentUpon>
     </Compile>
     </Compile>
     <Compile Include="FileHandleHelper.cs" />
     <Compile Include="FileHandleHelper.cs" />
+    <Compile Include="FontHelper.cs" />
     <Compile Include="Forms\AboutForm.cs">
     <Compile Include="Forms\AboutForm.cs">
       <SubType>Form</SubType>
       <SubType>Form</SubType>
     </Compile>
     </Compile>
@@ -294,6 +295,7 @@
     <None Include="Resources\i18n\PL.json" />
     <None Include="Resources\i18n\PL.json" />
     <None Include="Resources\i18n\KU.json" />
     <None Include="Resources\i18n\KU.json" />
     <None Include="Resources\i18n\RO.json" />
     <None Include="Resources\i18n\RO.json" />
+    <None Include="Resources\Fonts\Poppins-Regular.ttf" />
     <None Include="Resources\Scripts\AddOpenWithCMD.reg" />
     <None Include="Resources\Scripts\AddOpenWithCMD.reg" />
     <None Include="Resources\i18n\CN.json" />
     <None Include="Resources\i18n\CN.json" />
     <None Include="Resources\i18n\CZ.json" />
     <None Include="Resources\i18n\CZ.json" />

+ 1 - 1
Optimizer/Options.cs

@@ -127,7 +127,7 @@ namespace Optimizer
             Utilities.GetSelfAndChildrenRecursive(f).ToList().ForEach(x =>
             Utilities.GetSelfAndChildrenRecursive(f).ToList().ForEach(x =>
             {
             {
                 c = x;
                 c = x;
-
+            
                 if (x is Button)
                 if (x is Button)
                 {
                 {
                     c.BackColor = c1;
                     c.BackColor = c1;

+ 2 - 0
Optimizer/Program.cs

@@ -131,6 +131,8 @@ namespace Optimizer
                                 Environment.Exit(0);
                                 Environment.Exit(0);
                             }
                             }
 
 
+                            FontHelper.LoadFont();
+
                             for (int z = 0; z < switches.Length; z++) switches[z] = switches[z].ToLowerInvariant();
                             for (int z = 0; z < switches.Length; z++) switches[z] = switches[z].ToLowerInvariant();
 
 
                             // checking for silent config argument
                             // checking for silent config argument

+ 10 - 0
Optimizer/Properties/Resources.Designer.cs

@@ -956,6 +956,16 @@ namespace Optimizer.Properties {
             }
             }
         }
         }
         
         
+        /// <summary>
+        ///   Looks up a localized resource of type System.Byte[].
+        /// </summary>
+        internal static byte[] Poppins_Regular {
+            get {
+                object obj = ResourceManager.GetObject("Poppins_Regular", resourceCulture);
+                return ((byte[])(obj));
+            }
+        }
+        
         /// <summary>
         /// <summary>
         ///   Looks up a localized string similar to Windows Registry Editor Version 5.00
         ///   Looks up a localized string similar to Windows Registry Editor Version 5.00
         ///
         ///

+ 3 - 0
Optimizer/Properties/Resources.resx

@@ -361,4 +361,7 @@
   <data name="silver" type="System.Resources.ResXFileRef, System.Windows.Forms">
   <data name="silver" type="System.Resources.ResXFileRef, System.Windows.Forms">
     <value>..\Resources\Assets\silver.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
     <value>..\Resources\Assets\silver.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>
   </data>
+  <data name="Poppins_Regular" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resources\Fonts\Poppins-Regular.ttf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
 </root>
 </root>

BIN
Optimizer/Resources/Fonts/Poppins-Regular.ttf