Skip to content

Commit 6274c6a

Browse files
Added auto updater
Added a utility program that automatically checks for updates.
1 parent 9cac240 commit 6274c6a

File tree

9 files changed

+41
-57
lines changed

9 files changed

+41
-57
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,4 @@ _ReSharper*/
7373
*.DotSettings.user
7474
*.pfx
7575
*.exe
76+
CSGO Font Manager/ProtectedSettings.cs

CSGO Font Manager/CSGO Font Manager.csproj

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@
101101
<Compile Include="Program.cs" />
102102
<Compile Include="Properties\AssemblyInfo.cs" />
103103
<Compile Include="JsonManager.cs" />
104+
<Compile Include="Properties\Resources.Designer.cs">
105+
<AutoGen>True</AutoGen>
106+
<DesignTime>True</DesignTime>
107+
<DependentUpon>Resources.resx</DependentUpon>
108+
</Compile>
109+
<Compile Include="ProtectedSettings.cs" />
104110
<Compile Include="Settings.cs" />
105111
<EmbeddedResource Include="Form1.resx">
106112
<DependentUpon>Form1.cs</DependentUpon>
@@ -115,11 +121,6 @@
115121
<Generator>SettingsSingleFileGenerator</Generator>
116122
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
117123
</None>
118-
<Compile Include="Properties\Resources.Designer.cs">
119-
<AutoGen>True</AutoGen>
120-
<DesignTime>True</DesignTime>
121-
<DependentUpon>Resources.resx</DependentUpon>
122-
</Compile>
123124
<Compile Include="Properties\Settings.Designer.cs">
124125
<AutoGen>True</AutoGen>
125126
<DependentUpon>Settings.settings</DependentUpon>
@@ -141,17 +142,14 @@
141142
<ItemGroup>
142143
<None Include="Resources\Thumbnail.png" />
143144
</ItemGroup>
144-
<ItemGroup>
145-
<None Include="Resources\Thumbnail %282%29.png" />
146-
</ItemGroup>
147145
<ItemGroup>
148146
<Content Include="fonmanager_icon.ico" />
149147
<None Include="Resources\fonmanager_icon-5.png" />
150148
<None Include="Resources\add_retro.png" />
151149
<None Include="Resources\remove_retro.png" />
150+
<Content Include="Resources\updater.exe" />
152151
<Content Include="stableVersion.txt" />
153152
<None Include="Resources\FontReg.exe" />
154-
<None Include="Resources\drop your font here.png" />
155153
</ItemGroup>
156154
<ItemGroup>
157155
<BootstrapperPackage Include=".NETFramework,Version=v4.5.2">

CSGO Font Manager/Form1.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CSGO Font Manager/Form1.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ public partial class Form1 : Form
3131
public static string FontManagerFolder = HomeFolder + @"Font Manager\";
3232
public static string FontsFolder = FontManagerFolder + @"Fonts\";
3333
public static string DataPath = FontManagerFolder + @"Data\";
34+
3435
private static string SettingsFile = DataPath + "settings.json";
36+
private static string UpdaterFile = DataPath + "updater.exe";
3537

3638
public static Settings Settings;
3739
public static JsonManager<Settings> SettingsManager;
@@ -91,6 +93,7 @@ private void AutoFocusRunningInstance()
9193

9294
private void checkForUpdates()
9395
{
96+
/*
9497
string versionPattern = @"(\d+\.)(\d+\.?)+";
9598
9699
// Get new version
@@ -137,6 +140,24 @@ private void checkForUpdates()
137140
Settings.HideNewVersions = VersionNumber;
138141
}
139142
}
143+
*/
144+
145+
// Call updater.exe
146+
string fmExe = System.Reflection.Assembly.GetExecutingAssembly().Location;
147+
var processInfo = new ProcessStartInfo
148+
{
149+
UseShellExecute = false,
150+
RedirectStandardError = true,
151+
RedirectStandardOutput = true,
152+
CreateNoWindow = true,
153+
FileName = UpdaterFile,
154+
Arguments = $"\"{ProtectedSettings.Token}\" \"{VersionNumber}\" \"{fmExe}\""
155+
};
156+
Process p = Process.Start(processInfo);
157+
p.WaitForExit();
158+
159+
string output = p.StandardOutput.ReadLine();
160+
string err = p.StandardError.ReadLine();
140161
}
141162

142163
private static void SetupFolderStructure()
@@ -146,6 +167,9 @@ private static void SetupFolderStructure()
146167
Directory.CreateDirectory(FontManagerFolder);
147168
Directory.CreateDirectory(FontsFolder);
148169
Directory.CreateDirectory(DataPath);
170+
171+
// Extract updater
172+
File.WriteAllBytes(UpdaterFile, Properties.Resources.updater);
149173
}
150174
else
151175
{

CSGO Font Manager/Properties/Resources.Designer.cs

Lines changed: 4 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CSGO Font Manager/Properties/Resources.resx

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,6 @@
124124
<data name="FontReg" type="System.Resources.ResXFileRef, System.Windows.Forms">
125125
<value>..\Resources\FontReg.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
126126
</data>
127-
<data name="add_retro1" type="System.Resources.ResXFileRef, System.Windows.Forms">
128-
<value>..\Resources\add_retro.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
129-
</data>
130-
<data name="Thumbnail2" type="System.Resources.ResXFileRef, System.Windows.Forms">
131-
<value>..\Resources\Thumbnail (2).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
132-
</data>
133127
<data name="fontmanager" type="System.Resources.ResXFileRef, System.Windows.Forms">
134128
<value>..\Resources\fontmanager.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
135129
</data>
@@ -142,16 +136,13 @@
142136
<data name="add_retro" type="System.Resources.ResXFileRef, System.Windows.Forms">
143137
<value>..\Resources\add_retro.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
144138
</data>
145-
<data name="drophere" type="System.Resources.ResXFileRef, System.Windows.Forms">
146-
<value>..\Resources\drop your font here.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
147-
</data>
148-
<data name="remove_retro" type="System.Resources.ResXFileRef, System.Windows.Forms">
149-
<value>..\Resources\remove_retro.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
150-
</data>
151139
<data name="fonmanager_icon-5" type="System.Resources.ResXFileRef, System.Windows.Forms">
152140
<value>..\Resources\fonmanager_icon-5.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
153141
</data>
154-
<data name="remove_retro1" type="System.Resources.ResXFileRef, System.Windows.Forms">
142+
<data name="remove_retro" type="System.Resources.ResXFileRef, System.Windows.Forms">
155143
<value>..\Resources\remove_retro.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
156144
</data>
145+
<data name="updater" type="System.Resources.ResXFileRef, System.Windows.Forms">
146+
<value>..\Resources\updater.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
147+
</data>
157148
</root>
-709 KB
Binary file not shown.
-60.2 KB
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)