diff --git a/.gitignore b/.gitignore index bf766c7..373546a 100644 --- a/.gitignore +++ b/.gitignore @@ -73,3 +73,4 @@ _ReSharper*/ *.DotSettings.user *.pfx *.exe +CSGO Font Manager/ProtectedSettings.cs diff --git a/CSGO Font Manager/CSGO Font Manager.csproj b/CSGO Font Manager/CSGO Font Manager.csproj index e6e4e83..0cf2cd4 100644 --- a/CSGO Font Manager/CSGO Font Manager.csproj +++ b/CSGO Font Manager/CSGO Font Manager.csproj @@ -101,6 +101,12 @@ + + True + True + Resources.resx + + Form1.cs @@ -115,11 +121,6 @@ SettingsSingleFileGenerator Settings.Designer.cs - - True - True - Resources.resx - True Settings.settings @@ -141,17 +142,14 @@ - - - + - diff --git a/CSGO Font Manager/Form1.Designer.cs b/CSGO Font Manager/Form1.Designer.cs index c77a810..b977b65 100644 --- a/CSGO Font Manager/Form1.Designer.cs +++ b/CSGO Font Manager/Form1.Designer.cs @@ -184,7 +184,7 @@ private void InitializeComponent() // this.remove_button.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.remove_button.BackColor = System.Drawing.Color.Transparent; - this.remove_button.BackgroundImage = global::CSGO_Font_Manager.Properties.Resources.remove_retro1; + this.remove_button.BackgroundImage = global::CSGO_Font_Manager.Properties.Resources.remove_retro; this.remove_button.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; this.remove_button.FlatAppearance.BorderSize = 0; this.remove_button.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); diff --git a/CSGO Font Manager/Form1.cs b/CSGO Font Manager/Form1.cs index 7ff1403..4d6ac1e 100644 --- a/CSGO Font Manager/Form1.cs +++ b/CSGO Font Manager/Form1.cs @@ -31,7 +31,9 @@ public partial class Form1 : Form public static string FontManagerFolder = HomeFolder + @"Font Manager\"; public static string FontsFolder = FontManagerFolder + @"Fonts\"; public static string DataPath = FontManagerFolder + @"Data\"; + private static string SettingsFile = DataPath + "settings.json"; + private static string UpdaterFile = DataPath + "updater.exe"; public static Settings Settings; public static JsonManager SettingsManager; @@ -91,6 +93,7 @@ private void AutoFocusRunningInstance() private void checkForUpdates() { + /* string versionPattern = @"(\d+\.)(\d+\.?)+"; // Get new version @@ -137,6 +140,24 @@ private void checkForUpdates() Settings.HideNewVersions = VersionNumber; } } + */ + + // Call updater.exe + string fmExe = System.Reflection.Assembly.GetExecutingAssembly().Location; + var processInfo = new ProcessStartInfo + { + UseShellExecute = false, + RedirectStandardError = true, + RedirectStandardOutput = true, + CreateNoWindow = true, + FileName = UpdaterFile, + Arguments = $"\"{ProtectedSettings.Token}\" \"{VersionNumber}\" \"{fmExe}\"" + }; + Process p = Process.Start(processInfo); + p.WaitForExit(); + + string output = p.StandardOutput.ReadLine(); + string err = p.StandardError.ReadLine(); } private static void SetupFolderStructure() @@ -146,6 +167,9 @@ private static void SetupFolderStructure() Directory.CreateDirectory(FontManagerFolder); Directory.CreateDirectory(FontsFolder); Directory.CreateDirectory(DataPath); + + // Extract updater + File.WriteAllBytes(UpdaterFile, Properties.Resources.updater); } else { diff --git a/CSGO Font Manager/Properties/Resources.Designer.cs b/CSGO Font Manager/Properties/Resources.Designer.cs index 2863219..12408a4 100644 --- a/CSGO Font Manager/Properties/Resources.Designer.cs +++ b/CSGO Font Manager/Properties/Resources.Designer.cs @@ -70,26 +70,6 @@ public static System.Drawing.Bitmap add_retro { } } - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap add_retro1 { - get { - object obj = ResourceManager.GetObject("add_retro1", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap drophere { - get { - object obj = ResourceManager.GetObject("drophere", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -140,16 +120,6 @@ public static System.Drawing.Bitmap remove_retro { } } - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap remove_retro1 { - get { - object obj = ResourceManager.GetObject("remove_retro1", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -171,12 +141,12 @@ public static System.Drawing.Bitmap Thumbnail1 { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Looks up a localized resource of type System.Byte[]. /// - public static System.Drawing.Bitmap Thumbnail2 { + public static byte[] updater { get { - object obj = ResourceManager.GetObject("Thumbnail2", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); + object obj = ResourceManager.GetObject("updater", resourceCulture); + return ((byte[])(obj)); } } } diff --git a/CSGO Font Manager/Properties/Resources.resx b/CSGO Font Manager/Properties/Resources.resx index 57b2fc6..50f8a4d 100644 --- a/CSGO Font Manager/Properties/Resources.resx +++ b/CSGO Font Manager/Properties/Resources.resx @@ -124,12 +124,6 @@ ..\Resources\FontReg.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\Resources\add_retro.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\Thumbnail (2).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\fontmanager.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -142,16 +136,13 @@ ..\Resources\add_retro.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\drop your font here.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\remove_retro.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\fonmanager_icon-5.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - + ..\Resources\remove_retro.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\updater.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file diff --git a/CSGO Font Manager/Resources/Thumbnail (2).png b/CSGO Font Manager/Resources/Thumbnail (2).png deleted file mode 100644 index 1191b64..0000000 Binary files a/CSGO Font Manager/Resources/Thumbnail (2).png and /dev/null differ diff --git a/CSGO Font Manager/Resources/drop your font here.png b/CSGO Font Manager/Resources/drop your font here.png deleted file mode 100644 index 3730d24..0000000 Binary files a/CSGO Font Manager/Resources/drop your font here.png and /dev/null differ diff --git a/CSGO Font Manager/obj/Debug/CSGO Font Manager.csproj.GenerateResource.cache b/CSGO Font Manager/obj/Debug/CSGO Font Manager.csproj.GenerateResource.cache index 298d5b9..3fca277 100644 Binary files a/CSGO Font Manager/obj/Debug/CSGO Font Manager.csproj.GenerateResource.cache and b/CSGO Font Manager/obj/Debug/CSGO Font Manager.csproj.GenerateResource.cache differ