diff --git a/CSGO Font Manager/CSGO Font Manager.csproj b/CSGO Font Manager/CSGO Font Manager.csproj index 7c0ba3a..e6e4e83 100644 --- a/CSGO Font Manager/CSGO Font Manager.csproj +++ b/CSGO Font Manager/CSGO Font Manager.csproj @@ -8,7 +8,7 @@ WinExe Properties CSGO_Font_Manager - CSGO Font Manager + Font Manager v4.5.2 512 true diff --git a/CSGO Font Manager/Form1.cs b/CSGO Font Manager/Form1.cs index 93ed81b..635faf6 100644 --- a/CSGO Font Manager/Form1.cs +++ b/CSGO Font Manager/Form1.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.Drawing.Text; @@ -18,13 +19,15 @@ namespace CSGO_Font_Manager { public partial class Form1 : Form { - public const string AssemblyVersion = "3.2.0.0"; - public static string VersionNumber = "3.2"; // Remember to update stableVersion.txt when releasing a new stable update. + public const string AssemblyVersion = "3.3.0.0"; + public static string VersionNumber = "3.3"; // Remember to update stableVersion.txt when releasing a new stable update. // This will notify all Font Manager 2.0 clients that there is an update available. // To push the notification, commit and push to the master repository on GitHub. private readonly string CurrentVersion = "https://raw.githubusercontent.com/WilliamRagstad/Font-Manager/master/CSGO%20Font%20Manager/stableVersion.txt"; - - public static string HomeFolder = $@"C:\Users\{Environment.UserName}\Documents\"; + + public static string OldFontManagerFolder = $@"C:\Users\{Environment.UserName}\Documents\Font Manager\"; + public static string HomeFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\"; + public static string FontManagerFolder = HomeFolder + @"Font Manager\"; public static string FontsFolder = FontManagerFolder + @"Fonts\"; public static string DataPath = FontManagerFolder + @"Data\"; @@ -59,7 +62,7 @@ private void Form1_Load(object sender, EventArgs e) version_label.Text = "Version " + VersionNumber; SetupFolderStructure(); - + SettingsManager = new JsonManager(SettingsFile); Settings = SettingsManager.Load(); @@ -71,8 +74,18 @@ private void Form1_Load(object sender, EventArgs e) switchView(FormViews.Main); } + [DllImport("user32.dll")] + public static extern int SetForegroundWindow(IntPtr hwnd); + private void AutoFocusRunningInstance() { + string title = Process.GetCurrentProcess().ProcessName; + Process[] runningFM = Process.GetProcessesByName(title); + if (runningFM.Length > 1) + { + SetForegroundWindow(runningFM[0].MainWindowHandle); + Environment.Exit(0); + } // Not implemented } @@ -91,7 +104,7 @@ private void checkForUpdates() using(var reader = new StreamReader(content)){ newVersion = reader.ReadToEnd().Replace("\n",""); - + if (newVersion == Settings.HideNewVersions) return; } } catch (Exception e) @@ -121,54 +134,48 @@ private void checkForUpdates() "Do you want to continue getting update notifications?", "Update Available", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No) { - Settings.hideNewVersions = VersionNumber; + Settings.HideNewVersions = VersionNumber; } } } private static void SetupFolderStructure() { - new FileIOPermission(FileIOPermissionAccess.Write, HomeFolder).Demand(); - new FileIOPermission(FileIOPermissionAccess.Write, FontManagerFolder).Demand(); - new FileIOPermission(FileIOPermissionAccess.Write, FontsFolder).Demand(); - new FileIOPermission(FileIOPermissionAccess.Write, DataPath).Demand(); - - ObtainFolderPermission(HomeFolder); - ObtainFolderPermission(FontManagerFolder); - - try + if (Directory.Exists(HomeFolder)) { - Directory.CreateDirectory(HomeFolder); Directory.CreateDirectory(FontManagerFolder); Directory.CreateDirectory(FontsFolder); Directory.CreateDirectory(DataPath); } - catch + else { - System.Windows.Forms.DialogResult dr = MessageBox.Show("Font Manager does not seem to have permission to the document directory!", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error); - if (dr == DialogResult.Retry) SetupFolderStructure(); + MessageBox.Show("Appdata does not exist... You're not running this on linux or mac huh..", "No can do"); + Application.Exit(new CancelEventArgs()); } - } - - public static void ObtainFolderPermission(string folderPath) - { - var directoryInfo = new DirectoryInfo(folderPath); - var directorySecurity = directoryInfo.GetAccessControl(); - var currentUserIdentity = System.Security.Principal.WindowsIdentity.GetCurrent(); - - foreach (IdentityReference group in currentUserIdentity.Groups) + + // Transfer all files from old (if existing) FontManager folder to the new one in AppData + if (Directory.Exists(OldFontManagerFolder)) { - var fileSystemRule = new System.Security.AccessControl.FileSystemAccessRule(group, - System.Security.AccessControl.FileSystemRights.Read, - System.Security.AccessControl.InheritanceFlags.ObjectInherit | - System.Security.AccessControl.InheritanceFlags.ContainerInherit, - System.Security.AccessControl.PropagationFlags.None, - System.Security.AccessControl.AccessControlType.Allow); - - directorySecurity.AddAccessRule(fileSystemRule); + if (Directory.Exists(OldFontManagerFolder + @"Fonts\")) + foreach (string fontFolder in Directory.GetFileSystemEntries(OldFontManagerFolder + @"Fonts\")) + { + string dir = FontsFolder + Path.GetFileName(fontFolder) + @"\"; + if (Directory.Exists(dir)) continue; + Directory.CreateDirectory(dir); + foreach (string file in Directory.GetFiles(fontFolder)) + { + string dst = dir + Path.GetFileName(file); + if (!File.Exists(dst)) + File.Copy(file, dst); + } + } + + if (File.Exists(OldFontManagerFolder + @"Data\settings.json") && !File.Exists(SettingsFile)) + File.Copy(OldFontManagerFolder + @"Data\settings.json", SettingsFile); + + if (Directory.Exists(OldFontManagerFolder)) + Directory.Delete(OldFontManagerFolder, true); } - - directoryInfo.SetAccessControl(directorySecurity); } private void listBox1_Click(object sender, EventArgs e) @@ -240,10 +247,10 @@ private void showFontPreview() private void addFont_button_Click(object sender, EventArgs e) { - if (Settings.proTips) + if (Settings.ProTips) { MessageBox.Show("Protip: If you want you can also just drag-and-drop fonts inside the font list.", "Drag and Drop!", MessageBoxButtons.OK, MessageBoxIcon.Information); - Settings.proTips = false; + Settings.ProTips = false; } switchView(FormViews.AddSystemFont); @@ -378,7 +385,7 @@ private void button2_Click(object sender, EventArgs e) private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { - Process.Start("https://github.com/WilliamRagstad/Font-Manager"); + Process.Start("https://github.com/WilliamRagstad/Font-Manager/blob/master/README.md#introduction"); } private void donate_button_Click(object sender, EventArgs e) @@ -392,15 +399,20 @@ private void donate_button_Click(object sender, EventArgs e) private void refreshFontList() { + int activeFontIndex = 0; //refresh list of fonts string[] dirs = Directory.GetDirectories(FontsFolder); listBox1.Items.Clear(); + int index = 0; foreach (string dir in dirs) { + index++; + string foldername = Path.GetFileName(dir); if (File.Exists(dir + "\\fonts.conf")) { listBox1.Items.Add(foldername); + if (Settings.ActiveFont != null && Settings.ActiveFont.Equals(foldername)) activeFontIndex = index; // Add the font to the private font collection foreach (string file in Directory.GetFiles(dir)) @@ -424,7 +436,7 @@ private void refreshFontList() // Add default font listBox1.Items.Insert(0, defaultFontName); - listBox1.SelectedIndex = 0; + listBox1.SelectedIndex = activeFontIndex; } private List GetFiles(string path, string pattern) @@ -456,7 +468,7 @@ private void apply_button_Click(object sender, EventArgs e) { //Get the csgo path (home folder...) if data file not found... - if (Settings.csgoPath != null) + if (Settings.CsgoPath != null) { // Make sure the folders exists string csgoConfD = csgoFontsFolder + "\\conf.d"; @@ -517,6 +529,8 @@ private void apply_button_Click(object sender, EventArgs e) MessageBox.Show($"Successfully applied {listBox1.SelectedItem}!" + (csgoIsRunning ? "\n\nRestart CS:GO for the font to take effect." : ""), "Font Applied!", MessageBoxButtons.OK, MessageBoxIcon.Information); + + Settings.ActiveFont = listBox1.SelectedItem.ToString(); } else { @@ -604,7 +618,7 @@ private void apply_button_Click(object sender, EventArgs e) public static void LoadCSGOFolder(bool manual = false) { - if (Settings.csgoPath != null) csgoFontsFolder = Settings.csgoPath + @"\csgo\panorama\fonts"; + if (Settings.CsgoPath != null) csgoFontsFolder = Settings.CsgoPath + @"\csgo\panorama\fonts"; else { string csgoPath = tryLocatingCSGOFolder(); @@ -623,7 +637,7 @@ public static void LoadCSGOFolder(bool manual = false) "Path Found!", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { SetupFolderStructure(); // Make sure all folders exists... - Settings.csgoPath = csgoPath; + Settings.CsgoPath = csgoPath; LoadCSGOFolder(); // Update the csgo fonts folder path } else @@ -756,7 +770,7 @@ public static void AddFont(byte[] fontBytes) private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (MessageBox.Show("This will only restore the path to Counter Strike: Global Offensive and restore utility programs (in case they need to be updated). If you want to delete all fonts, you must do so through the program.\n\n" + - "Current CS:GO Folder: " + Settings.csgoPath + "\n\nAre you sure you want to reset Font Manager?", "Reset?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) + "Current CS:GO Folder: " + Settings.CsgoPath + "\n\nAre you sure you want to reset Font Manager?", "Reset?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { Directory.Delete(DataPath, true); LoadCSGOFolder(); @@ -854,7 +868,8 @@ void insertAt(int index) private void Form1_FormClosing(object sender, FormClosingEventArgs e) { // Save settings - SettingsManager.Save(Settings); + if (Settings != null) + SettingsManager.Save(Settings); } } } diff --git a/CSGO Font Manager/JsonManager.cs b/CSGO Font Manager/JsonManager.cs index c6ec377..daa0929 100644 --- a/CSGO Font Manager/JsonManager.cs +++ b/CSGO Font Manager/JsonManager.cs @@ -21,6 +21,7 @@ public T Load() public void Save(T Data) { string json = JsonConvert.SerializeObject(Data, Formatting.Indented); + (new FileInfo(_targetFile)).Directory.Create(); File.WriteAllText(_targetFile, json); } } diff --git a/CSGO Font Manager/Settings.cs b/CSGO Font Manager/Settings.cs index 46779a8..3f7340d 100644 --- a/CSGO Font Manager/Settings.cs +++ b/CSGO Font Manager/Settings.cs @@ -8,8 +8,9 @@ namespace CSGO_Font_Manager { public class Settings { - public string csgoPath { get; set; } - public bool proTips { get; set; } = true; - public string hideNewVersions { get; set; } + public string CsgoPath { get; set; } + public bool ProTips { get; set; } = true; + public string HideNewVersions { get; set; } + public string ActiveFont { get; set; } } } \ No newline at end of file diff --git a/CSGO Font Manager/bin/Debug/CSGO Font Manager.exe b/CSGO Font Manager/bin/Debug/CSGO Font Manager.exe deleted file mode 100644 index 2b6bcc3..0000000 Binary files a/CSGO Font Manager/bin/Debug/CSGO Font Manager.exe and /dev/null differ diff --git a/CSGO Font Manager/bin/Debug/CSGO Font Manager.pdb b/CSGO Font Manager/bin/Debug/CSGO Font Manager.pdb deleted file mode 100644 index 4de6735..0000000 Binary files a/CSGO Font Manager/bin/Debug/CSGO Font Manager.pdb and /dev/null differ diff --git a/CSGO Font Manager/obj/Debug/CSGO Font Manager.csproj.FileListAbsolute.txt b/CSGO Font Manager/obj/Debug/CSGO Font Manager.csproj.FileListAbsolute.txt index 345f436..1c29ca8 100644 --- a/CSGO Font Manager/obj/Debug/CSGO Font Manager.csproj.FileListAbsolute.txt +++ b/CSGO Font Manager/obj/Debug/CSGO Font Manager.csproj.FileListAbsolute.txt @@ -10,9 +10,6 @@ C:\Users\ewr0327\Google Drive (william.ragstad@gmail.com)\- Programming Projects C:\Users\ewr0327\Google Drive (william.ragstad@gmail.com)\- Programming Projects\Font-Manager\CSGO Font Manager\obj\Debug\CSGO Font Manager.csproj.CoreCompileInputs.cache C:\Users\ewr0327\Google Drive (william.ragstad@gmail.com)\- Programming Projects\Font-Manager\CSGO Font Manager\obj\Debug\CSGO Font Manager.exe C:\Users\ewr0327\Google Drive (william.ragstad@gmail.com)\- Programming Projects\Font-Manager\CSGO Font Manager\obj\Debug\CSGO Font Manager.pdb -D:\Documents\Visual Studio repos\CSGO Font Manager\CSGO Font Manager\bin\Debug\CSGO Font Manager.exe.config -D:\Documents\Visual Studio repos\CSGO Font Manager\CSGO Font Manager\bin\Debug\CSGO Font Manager.exe -D:\Documents\Visual Studio repos\CSGO Font Manager\CSGO Font Manager\bin\Debug\CSGO Font Manager.pdb D:\Documents\Visual Studio repos\CSGO Font Manager\CSGO Font Manager\bin\Debug\ActiproSoftware.Shared.WinForms.dll D:\Documents\Visual Studio repos\CSGO Font Manager\CSGO Font Manager\bin\Debug\ActiproSoftware.SyntaxEditor.WinForms.dll D:\Documents\Visual Studio repos\CSGO Font Manager\CSGO Font Manager\bin\Debug\Newtonsoft.Json.dll @@ -24,5 +21,9 @@ D:\Documents\Visual Studio repos\CSGO Font Manager\CSGO Font Manager\obj\Debug\C D:\Documents\Visual Studio repos\CSGO Font Manager\CSGO Font Manager\obj\Debug\CSGO Font Manager.csproj.GenerateResource.cache D:\Documents\Visual Studio repos\CSGO Font Manager\CSGO Font Manager\obj\Debug\CSGO Font Manager.csproj.CoreCompileInputs.cache D:\Documents\Visual Studio repos\CSGO Font Manager\CSGO Font Manager\obj\Debug\CSGO Font Manager.csproj.CopyComplete -D:\Documents\Visual Studio repos\CSGO Font Manager\CSGO Font Manager\obj\Debug\CSGO Font Manager.exe -D:\Documents\Visual Studio repos\CSGO Font Manager\CSGO Font Manager\obj\Debug\CSGO Font Manager.pdb +D:\Documents\Visual Studio repos\CSGO Font Manager\CSGO Font Manager\obj\Debug\CSGO Font Manager.csprojAssemblyReference.cache +D:\Documents\Visual Studio repos\CSGO Font Manager\CSGO Font Manager\bin\Debug\Font Manager.exe.config +D:\Documents\Visual Studio repos\CSGO Font Manager\CSGO Font Manager\bin\Debug\Font Manager.exe +D:\Documents\Visual Studio repos\CSGO Font Manager\CSGO Font Manager\bin\Debug\Font Manager.pdb +D:\Documents\Visual Studio repos\CSGO Font Manager\CSGO Font Manager\obj\Debug\Font Manager.exe +D:\Documents\Visual Studio repos\CSGO Font Manager\CSGO Font Manager\obj\Debug\Font Manager.pdb 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 a6adc66..f436186 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 diff --git a/CSGO Font Manager/obj/Debug/CSGO Font Manager.exe b/CSGO Font Manager/obj/Debug/CSGO Font Manager.exe deleted file mode 100644 index 2b6bcc3..0000000 Binary files a/CSGO Font Manager/obj/Debug/CSGO Font Manager.exe and /dev/null differ diff --git a/CSGO Font Manager/obj/Debug/CSGO Font Manager.pdb b/CSGO Font Manager/obj/Debug/CSGO Font Manager.pdb deleted file mode 100644 index 4de6735..0000000 Binary files a/CSGO Font Manager/obj/Debug/CSGO Font Manager.pdb and /dev/null differ diff --git a/CSGO Font Manager/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/CSGO Font Manager/obj/Debug/DesignTimeResolveAssemblyReferences.cache index bbf28fc..fdd1748 100644 Binary files a/CSGO Font Manager/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/CSGO Font Manager/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/CSGO Font Manager/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/CSGO Font Manager/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index 4aeaba4..9712462 100644 Binary files a/CSGO Font Manager/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/CSGO Font Manager/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/CSGO Font Manager/stableVersion.txt b/CSGO Font Manager/stableVersion.txt index 6690191..9111f8e 100644 --- a/CSGO Font Manager/stableVersion.txt +++ b/CSGO Font Manager/stableVersion.txt @@ -1 +1 @@ -3.2 \ No newline at end of file +3.3 \ No newline at end of file diff --git a/README.md b/README.md index 6f1c81b..c04c450 100644 --- a/README.md +++ b/README.md @@ -3,39 +3,44 @@
GitHub release (latest by date) GitHub All Releases + GitHub contributors + GitHub Release Date
-> ## Install + + + +> ## Quick Install +> > [Direct download](https://github.com/WilliamRagstad/Font-Manager/releases/latest/download/FontManager.exe) the latest version, or view all releases [here](https://github.com/WilliamRagstad/Font-Manager/releases). +> --- + + + + # Introduction **Font Manager** is a software designed to simplify switching between different custom fonts for CS:GO. -It features a "Drag-and-Drop" system which allows you to add new fonts in seconds. This software is safe to use and is completely VAC free. +It features a "Drag-and-Drop" system which allows you to add new fonts in seconds. This software is safe to use and is completely VAC safe. #### Features: -- Easy font management! -- Drag and drop to add new fonts! -- Add already installed system fonts -- One click font removal -- **Support for the new panorama update!** - -> Just take me to the [installation](#Install)... +- Easy font management +- Drag and drop to add fonts +- Add any system font +- One click font removal +- Support for the new panorama update -## Videos +## Video
[![BananaGaming](https://img.youtube.com/vi/3xToNTtdmME/0.jpg)](https://www.youtube.com/watch?v=3xToNTtdmME) -[![Tutorial](https://img.youtube.com/vi/MhOnvkEIy1k/0.jpg)](https://www.youtube.com/watch?v=MhOnvkEIy1k) - -(Outdated) -
diff --git a/faq.md b/faq.md index de6e591..51acaf7 100644 --- a/faq.md +++ b/faq.md @@ -8,9 +8,9 @@ FAQ Long explanation: - *"Certain files are VAC protected. If you modify these files, you can be VAC banned. But you can change things like the mini-map graphics without being banned. Generally speaking, players can be banned for making changes to core game files in CSGO. There are also numerous guides on Steam CSGO community hub that detail how to change various parts of the UI including fonts. I doubt that it would have got 1000 upvotes if it was telling players to do something that would get them VAC banned."* - **BossGalaga**'s answer to the question in [this discussion](https://steamcommunity.com/discussions/forum/9/135513901704720033/). - - *"So im using a font right now and i haven't been vac banned yet xD and i guess i wont get one cuz a lot of people also use one and don't get a ban."* - **stayyCS**. - - *"Font styles can be changed. No, fonts don't get you vac banned."* - **xKodaCSGO**. - - *"Nope no vac ban look on my account"* - **spddl**. + - *"Nope no VAC ban look on my account"* - **spddl**. + - *"So I'm using a font right now and I haven't been VAC banned yet xD and I guess I wont get one cuz a lot of people also use one and don't get a ban."* - **stayyCS**. + - *"Font styles can be changed. No, fonts don't get you VAC banned."* - **xKodaCSGO**. *(If you are still not convinced, I can point out that many famous youtubers use unofficial fonts in CS:GO all the time.)* @@ -32,11 +32,11 @@ A: It depends on if you're running Font Manager as Administrator, in such case, - **Q: How do I rename fonts in Font Manager?** -- A: There is no way to do it inside the program itself. Therefore you'll just need to rename the font directory itself inside the following folder: `C:\Users\[USERNAME]\Documents\Font Manager\Fonts` +- A: There is no way to do it inside the program itself. Therefore you'll just need to rename the font directory itself inside the following folder: `C:\Users\[USERNAME]\AppData\Roaming\Font Manager\Fonts` - **Q: How do I uninstall Font Manager?** - A: Well, there is not uninstaller. So you must delete the folder and the program yourself: - 1. Delete the folder: `C:\Users\[USERNAME]\Documents\Font Manager` + 1. Delete the folder: `C:\Users\[USERNAME]\AppData\Roaming\Font Manager` 2. Delete: `Font Manager.exe` 3. **Done!** It's all gone :) diff --git a/todo.md b/todo.md index d01ce69..8370d44 100644 --- a/todo.md +++ b/todo.md @@ -2,15 +2,6 @@ Here is all the things we are working on to add in future releases! -* Highlight currently active CS:GO font -* Collect all settings into one JSON file -* Autofocus on already running Font Manager incase a new instance is started -* Change font scaling -* Remove autoupdate exe -* Notify about new updates beside version number -* Make folders in Documents more compact -* Autodetect outdated CS:GO path - ### Maybe - New UI in DevExpress (?)