diff --git a/PuzzlePlayer/App.config b/PuzzlePlayer/App.config new file mode 100644 index 0000000000000000000000000000000000000000..78b587e0706738df81be63599c2a42d4832dfdbc --- /dev/null +++ b/PuzzlePlayer/App.config @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8" ?> +<configuration> + <configSections> + <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > + <section name="PuzzlePlayer_Namespace.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> + </sectionGroup> + </configSections> + <userSettings> + <PuzzlePlayer_Namespace.Properties.Settings> + <setting name="ThemeName" serializeAs="String"> + <value>Dark</value> + </setting> + <setting name="FontName" serializeAs="String"> + <value>Gotham</value> + </setting> + <setting name="Money" serializeAs="String"> + <value>100</value> + </setting> + </PuzzlePlayer_Namespace.Properties.Settings> + </userSettings> +</configuration> \ No newline at end of file diff --git a/PuzzlePlayer/Properties/Settings.Designer.cs b/PuzzlePlayer/Properties/Settings.Designer.cs new file mode 100644 index 0000000000000000000000000000000000000000..c36b6676858d0cdbb9576454b0a89ba88763991d --- /dev/null +++ b/PuzzlePlayer/Properties/Settings.Designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace PuzzlePlayer_Namespace.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.11.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Dark")] + public string ThemeName { + get { + return ((string)(this["ThemeName"])); + } + set { + this["ThemeName"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("Gotham")] + public string FontName { + get { + return ((string)(this["FontName"])); + } + set { + this["FontName"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("100")] + public int Money { + get { + return ((int)(this["Money"])); + } + set { + this["Money"] = value; + } + } + } +} diff --git a/PuzzlePlayer/Properties/Settings.settings b/PuzzlePlayer/Properties/Settings.settings new file mode 100644 index 0000000000000000000000000000000000000000..5b860f4fdcb5afb4cc560d86eed93a9fe2bffb1c --- /dev/null +++ b/PuzzlePlayer/Properties/Settings.settings @@ -0,0 +1,15 @@ +<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="PuzzlePlayer_Namespace.Properties" GeneratedClassName="Settings"> + <Profiles /> + <Settings> + <Setting Name="ThemeName" Type="System.String" Scope="User"> + <Value Profile="(Default)">Dark</Value> + </Setting> + <Setting Name="FontName" Type="System.String" Scope="User"> + <Value Profile="(Default)">Gotham</Value> + </Setting> + <Setting Name="Money" Type="System.Int32" Scope="User"> + <Value Profile="(Default)">100</Value> + </Setting> + </Settings> +</SettingsFile> \ No newline at end of file diff --git a/PuzzlePlayer/PuzzleForm.cs b/PuzzlePlayer/PuzzleForm.cs index bb7ca2ace6b2d2ef7c5ca62110fd9682f247ea3b..4b2fbfe93e2a67380ceb238520e7e147c158ea1e 100644 --- a/PuzzlePlayer/PuzzleForm.cs +++ b/PuzzlePlayer/PuzzleForm.cs @@ -41,7 +41,7 @@ namespace PuzzlePlayer_Namespace if (s == default) s = new Size(700, 420); this.Size = this.MinimumSize = s; this.WindowState = FormWindowState.Maximized; - this.BackColor = SettingForm.primaryColor; + this.BackColor = UserDataManager.Theme.primaryColor; this.Text = "PuzzlePlayer"; bufferedGraphics = BufferedGraphicsManager.Current.Allocate(this.CreateGraphics(), this.DisplayRectangle); bufferedGraphics.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; @@ -82,12 +82,12 @@ namespace PuzzlePlayer_Namespace { MenuStrip menuStrip = new MenuStrip { - BackColor = SettingForm.secondaryColor, - ForeColor = SettingForm.secondaryColor, + BackColor = UserDataManager.Theme.secondaryColor, + ForeColor = UserDataManager.Theme.secondaryColor, Name = "Main menu", Text = "Main Menu", Dock = DockStyle.Top, - Font = SettingForm.mainFont, + Font = UserDataManager.MainFont, }; ToolStripMenuItem menuSettings = new ToolStripMenuItem { @@ -95,7 +95,7 @@ namespace PuzzlePlayer_Namespace ForeColor = Color.Black, Text = "Settings", TextAlign = ContentAlignment.BottomRight, - Font = SettingForm.mainFont, + Font = UserDataManager.MainFont, }; menuStrip.Items.Add(menuSettings); this.Controls.Add(menuStrip); @@ -107,12 +107,12 @@ namespace PuzzlePlayer_Namespace settingForm.FormClosed += (object s, FormClosedEventArgs args) => { - this.BackColor = SettingForm.primaryColor; - this.ForeColor = SettingForm.tertiaryColor; + this.BackColor = UserDataManager.Theme.primaryColor; + this.ForeColor = UserDataManager.Theme.tertiaryColor; foreach (Control control in this.Controls) { - SettingForm.UpdateSettings(control); + SettingForm.UpdateControl(control); } bufferedGraphics.Graphics.Clear(this.BackColor); @@ -187,8 +187,8 @@ namespace PuzzlePlayer_Namespace informationbox.Text = board.description; informationbox.Font = new Font("Verdana", 10); - this.BackColor = SettingForm.primaryColor; - this.ForeColor = SettingForm.tertiaryColor; + this.BackColor = UserDataManager.Theme.primaryColor; + this.ForeColor = UserDataManager.Theme.tertiaryColor; UpdateUI(); } diff --git a/PuzzlePlayer/PuzzlePlayer.cs b/PuzzlePlayer/PuzzlePlayer.cs index cb920c42ec577e9612680ecee48ab146094b8b48..add7f2315a518fcd8e8f59a8af0137f7f73df192 100644 --- a/PuzzlePlayer/PuzzlePlayer.cs +++ b/PuzzlePlayer/PuzzlePlayer.cs @@ -34,20 +34,18 @@ namespace PuzzlePlayer_Namespace private void SetUpUI() { - // -- List<RoundedButton> buttons = new List<RoundedButton>(); - this.ClientSize = new Size(1115, 755); - this.BackColor = SettingForm.primaryColor; + this.BackColor = UserDataManager.Theme.primaryColor; this.Text = "PuzzlePlayer"; MenuStrip menuStrip = new MenuStrip { - BackColor = SettingForm.secondaryColor, - ForeColor = SettingForm.secondaryColor, + BackColor = UserDataManager.Theme.secondaryColor, + ForeColor = UserDataManager.Theme.secondaryColor, Name = "Main menu", Text = "Main Menu", Dock = DockStyle.Top, - Font = SettingForm.mainFont, + Font = UserDataManager.MainFont, }; ToolStripMenuItem menuSettings = new ToolStripMenuItem @@ -56,7 +54,7 @@ namespace PuzzlePlayer_Namespace ForeColor = Color.Black, Text = "Settings", TextAlign = ContentAlignment.BottomRight, - Font = SettingForm.mainFont, + Font = UserDataManager.MainFont, }; menuSettings.Click += (object o, EventArgs e) => @@ -66,12 +64,12 @@ namespace PuzzlePlayer_Namespace settingForm.FormClosed += (object s, FormClosedEventArgs args) => { - this.BackColor = SettingForm.primaryColor; - this.ForeColor = SettingForm.tertiaryColor; + this.BackColor = UserDataManager.Theme.primaryColor; + this.ForeColor = UserDataManager.Theme.tertiaryColor; foreach (Control control in this.Controls) { - SettingForm.UpdateSettings(control); + SettingForm.UpdateControl(control); } this.Show(); @@ -98,7 +96,7 @@ namespace PuzzlePlayer_Namespace { string image = puzzleForms[i].puzzleType; - Image normalImage = SettingForm.GetEmbeddedImage(image + ".jpg"); // Image.FromFile(image + ".jpg"); + Image normalImage = SettingForm.GetEmbeddedImage(image + ".jpg"); Image grayImage = SettingForm.GetEmbeddedImage(image + "Gray.jpg"); // Set the name of the button @@ -110,7 +108,7 @@ namespace PuzzlePlayer_Namespace Width = 345, Image = normalImage, FlatStyle = FlatStyle.Flat, - Font = SettingForm.mainFont, + Font = new Font(UserDataManager.MainFont.Name, UserDataManager.MainFont.Size * 2), Name = i.ToString() }; @@ -132,12 +130,12 @@ namespace PuzzlePlayer_Namespace PuzzleForm puzzleForm = puzzleForms[int.Parse(rb.Name)]; puzzleForm.FormClosed += (object o, FormClosedEventArgs fcea) => { - this.BackColor = SettingForm.primaryColor; - this.ForeColor = SettingForm.tertiaryColor; + this.BackColor = UserDataManager.Theme.primaryColor; + this.ForeColor = UserDataManager.Theme.tertiaryColor; foreach (Control control in this.Controls) { - SettingForm.UpdateSettings(control); + SettingForm.UpdateControl(control); } this.Show(); @@ -174,18 +172,18 @@ namespace PuzzlePlayer_Namespace blackJackButton.Width = 345; blackJackButton.Image = SettingForm.GetEmbeddedImage("bj.jpg"); blackJackButton.FlatStyle = FlatStyle.Flat; - blackJackButton.Font = SettingForm.mainFont; + blackJackButton.Font = UserDataManager.MainFont; blackJackButton.Click += (object o, EventArgs e) => { this.Hide(); bj.FormClosed += (object o, FormClosedEventArgs fcea) => { - this.BackColor = SettingForm.primaryColor; - this.ForeColor = SettingForm.tertiaryColor; + this.BackColor = UserDataManager.Theme.primaryColor; + this.ForeColor = UserDataManager.Theme.tertiaryColor; foreach (Control control in this.Controls) { - SettingForm.UpdateSettings(control); + SettingForm.UpdateControl(control); } this.Show(); diff --git a/PuzzlePlayer/PuzzlePlayer.csproj b/PuzzlePlayer/PuzzlePlayer.csproj index ff26550e41b347c6dd217155ec82fde08d1972fe..0756c671a7d944a1adac31e742d25b3041b1f580 100644 --- a/PuzzlePlayer/PuzzlePlayer.csproj +++ b/PuzzlePlayer/PuzzlePlayer.csproj @@ -70,6 +70,7 @@ <None Remove="Resources\MazeGray.jpg" /> <None Remove="Resources\Sudoku.jpg" /> <None Remove="Resources\SudokuGray.jpg" /> + <None Remove="Resources\Themes.txt" /> </ItemGroup> <ItemGroup> @@ -133,6 +134,22 @@ <EmbeddedResource Include="Resources\MazeGray.jpg" /> <EmbeddedResource Include="Resources\Sudoku.jpg" /> <EmbeddedResource Include="Resources\SudokuGray.jpg" /> + <EmbeddedResource Include="Resources\Themes.txt" /> + </ItemGroup> + + <ItemGroup> + <Compile Update="Properties\Settings.Designer.cs"> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + </Compile> + </ItemGroup> + + <ItemGroup> + <None Update="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> </ItemGroup> </Project> \ No newline at end of file diff --git a/PuzzlePlayer/Resources/Themes.txt b/PuzzlePlayer/Resources/Themes.txt new file mode 100644 index 0000000000000000000000000000000000000000..296637a8c2c8f2705b3c4a9b5dd350a583b17856 --- /dev/null +++ b/PuzzlePlayer/Resources/Themes.txt @@ -0,0 +1,3 @@ +THEME|Dark|66|69|73|54|57|62|0|0|0|True +THEME|Light|228|229|241|210|211|219|72|75|106|True +THEME|Pink|255|209|220|252|178|197|251|199|255|True \ No newline at end of file diff --git a/PuzzlePlayer/SettingForm.cs b/PuzzlePlayer/SettingForm.cs index 0b9fc16703fac7fa5b1db99f9876bf9f134d0721..40fcb081f62516170256e2479fb714cdf63067ac 100644 --- a/PuzzlePlayer/SettingForm.cs +++ b/PuzzlePlayer/SettingForm.cs @@ -8,34 +8,40 @@ using System.Windows.Forms; namespace PuzzlePlayer_Namespace { + // form to display the settings in internal class SettingForm : Form { // Public variables for all settings - public static Color primaryColor = Color.FromArgb(66, 69, 73); - public static Color secondaryColor = Color.FromArgb(54, 57, 62); - public static Color tertiaryColor = Color.FromArgb(0, 0, 0); - public static int fontSize = 16; - public static Font mainFont = new Font("Gotham", fontSize); + // Currently they are set to their default values + //public static Color primaryColor = Color.FromArgb(66, 69, 73); + //public static Color secondaryColor = Color.FromArgb(54, 57, 62); + //public static Color tertiaryColor = Color.FromArgb(0, 0, 0); + //public static int fontSize = 16; + //public static string mainFontName = "Gotham"; + //public static Font mainFont = new Font(mainFontName, fontSize); public static FlowLayoutPanel settingsPanel; public SettingForm() { - SetUpUi(); + this.ClientSize = new Size(1115, 755); + this.BackColor = UserDataManager.Theme.primaryColor; + this.Text = "PuzzlePlayer"; - this.BackColor = primaryColor; + SetUpUI(); foreach (Control control in Controls) { - UpdateSettings(control); + UpdateControl(control); //cheeky dw } Invalidate(); } - private void SetUpUi() + private void SetUpUI() { - this.ClientSize = new Size(1115, 755); - this.BackColor = SettingForm.primaryColor; - this.Text = "PuzzlePlayer"; + Theme theme = UserDataManager.Theme; + Color primaryColor = theme.primaryColor; + Color secondaryColor = theme.secondaryColor; + Color tertiaryColor = theme.tertiaryColor; MenuStrip menuStrip = new MenuStrip { @@ -66,66 +72,20 @@ namespace PuzzlePlayer_Namespace Name = "Theme", Height = 25, Width = 250, - BackColor = SettingForm.secondaryColor, + BackColor = secondaryColor, ForeColor = Color.Black, Margin = new Padding(20) }; - themeSelector.Items.Add("Dark"); - themeSelector.Items.Add("Light"); - themeSelector.Items.Add("Pink"); - - themeSelector.SelectedIndexChanged += (object o, EventArgs e) => - { - switch (themeSelector.Text) - { - case "Dark": - SettingForm.primaryColor = Color.FromArgb(66, 69, 73); - SettingForm.secondaryColor = Color.FromArgb(54, 57, 62); - SettingForm.tertiaryColor = Color.FromArgb(0, 0, 0); - break; - case "Light": - SettingForm.primaryColor = Color.FromArgb(228, 229, 241); - SettingForm.secondaryColor = Color.FromArgb(210, 211, 219); - SettingForm.tertiaryColor = Color.FromArgb(72, 75, 106); - break; - case "Pink": - SettingForm.primaryColor = Color.FromArgb(255, 209, 220); - SettingForm.secondaryColor = Color.FromArgb(252, 178, 197); - SettingForm.tertiaryColor = Color.FromArgb(251, 199, 255); - break; - } - }; - ComboBox sizeSelector = new ComboBox + List<Theme> themeList = UserDataManager.GetThemes(); + foreach(Theme t in themeList) { - Text = "Size", - Name = "Size", - Height = 25, - Width = 250, - BackColor = SettingForm.secondaryColor, - ForeColor = Color.Black, - Margin = new Padding(20), - }; - sizeSelector.Items.Add("Small"); - sizeSelector.Items.Add("Medium"); - sizeSelector.Items.Add("Large"); + themeSelector.Items.Add(t.name); + } - sizeSelector.SelectedIndexChanged += (object o, EventArgs e) => + themeSelector.SelectedIndexChanged += (object o, EventArgs e) => { - switch (sizeSelector.Text) - { - case "Small": - fontSize = 8; - break; - case "Medium": - fontSize = 16; - break; - case "Large": - fontSize = 24; - break; - } - mainFont = new Font("Gotham", fontSize); - settingsPanel.PerformLayout(); + UserDataManager.SetCurrentTheme(themeSelector.Text); }; settingsPanel = new FlowLayoutPanel @@ -146,7 +106,7 @@ namespace PuzzlePlayer_Namespace Name = "Save", Height = 100, Width = 350, - BackColor = SettingForm.secondaryColor, + BackColor = secondaryColor, ForeColor = Color.Black, Location = new Point(10, ClientSize.Height - 110), Anchor = AnchorStyles.Left | AnchorStyles.Bottom, @@ -156,14 +116,14 @@ namespace PuzzlePlayer_Namespace saveButton.Click += (object o, EventArgs e) => { - this.BackColor = primaryColor; + this.BackColor = UserDataManager.Theme.primaryColor; foreach (Control control in Controls) { - UpdateSettings(control); + UpdateControl(control); } - settingsPanel.BackColor = primaryColor; + settingsPanel.BackColor = UserDataManager.Theme.primaryColor; Invalidate(); }; @@ -173,7 +133,6 @@ namespace PuzzlePlayer_Namespace this.Controls.Add(saveButton); settingsPanel.Controls.Add(themeSelector); - settingsPanel.Controls.Add(sizeSelector); menuStrip.Items.Add(menuBack); @@ -182,8 +141,13 @@ namespace PuzzlePlayer_Namespace saveButton.BringToFront(); } - public static void UpdateSettings(Control control) + public static void UpdateControl(Control control) { + Theme theme = UserDataManager.Theme; + Color primaryColor = theme.primaryColor; + Color secondaryColor = theme.secondaryColor; + Color tertiaryColor = theme.tertiaryColor; + if (control is not FlowLayoutPanel) { control.BackColor = secondaryColor; @@ -194,11 +158,11 @@ namespace PuzzlePlayer_Namespace control.BackColor = primaryColor; } - control.Font = mainFont; + control.Font = UserDataManager.MainFont; foreach (Control childControl in control.Controls) { - UpdateSettings(childControl); + UpdateControl(childControl); } if (control is MenuStrip menuStrip) @@ -212,9 +176,14 @@ namespace PuzzlePlayer_Namespace public static void UpdateToolStripSettings(ToolStripItem item) { + Theme theme = UserDataManager.Theme; + Color primaryColor = theme.primaryColor; + Color secondaryColor = theme.secondaryColor; + Color tertiaryColor = theme.tertiaryColor; + item.BackColor = secondaryColor; item.ForeColor = tertiaryColor; - item.Font = mainFont; + item.Font = UserDataManager.MainFont; if (item is ToolStripMenuItem menuItem) { diff --git a/PuzzlePlayer/UserDataManager.cs b/PuzzlePlayer/UserDataManager.cs new file mode 100644 index 0000000000000000000000000000000000000000..e48d021196698cb9a79e8ee1098fe4fd8f722d34 --- /dev/null +++ b/PuzzlePlayer/UserDataManager.cs @@ -0,0 +1,150 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.IO; +using System.Reflection; +using PuzzlePlayer_Namespace.Properties; // for accessing user settings + +namespace PuzzlePlayer_Namespace +{ + // struct for saving themes + internal struct Theme(string s, Color col1, Color col2, Color col3, bool isUnlockedByDefault) + { + public const string prefix = "THEME"; + public string name = s; + public Color primaryColor = col1; + public Color secondaryColor = col2; + public Color tertiaryColor = col3; + public bool unlocked = isUnlockedByDefault; // keeps track if this theme is unlocked + + public override string ToString() + { + return $"{prefix}|{name}|{primaryColor.R}|{primaryColor.G}|{primaryColor.B}|{secondaryColor.R}|{secondaryColor.G}|{secondaryColor.B}|{tertiaryColor.R}|{tertiaryColor.G}|{tertiaryColor.B}|{unlocked}"; + } + + public static Theme? FromString(string s) + { + string[] split = s.Split('|'); + if (split[0] != prefix) + return null; + try + { + Color c1 = Color.FromArgb(int.Parse(split[2]),int.Parse(split[3]),int.Parse(split[4])); + Color c2 = Color.FromArgb(int.Parse(split[5]),int.Parse(split[6]),int.Parse(split[7])); + Color c3 = Color.FromArgb(int.Parse(split[8]),int.Parse(split[9]),int.Parse(split[10])); + + return new Theme(split[1], c1, c2, c3, bool.Parse(split[11])); + } + catch (Exception) + { + return null; + } + } + + public void Unlock() + { + unlocked = true; + } + } + + // Class for managing and storing user data + static internal class UserDataManager + { + // properties for getting various settings + static public int Money { get { return Settings.Default.Money; } set { SetMoney(value); } } + static public Font MainFont { get { return GetMainFont(); } } + static public Theme Theme { get { return GetCurrentTheme(); } } + + static private List<Theme> allThemes = GetThemes(); + + private const string themeFilePath = "PuzzlePlayer_Namespace.Resources.Themes.txt"; + + public const int FONTSIZE = 16; + + static public List<Theme> GetThemes() + { + List<Theme> result = new List<Theme>(); + + using(Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(themeFilePath)) + { + using(StreamReader sr = new StreamReader(stream)) + { + while (!sr.EndOfStream) + { + Theme? t = Theme.FromString(sr.ReadLine()); + if (t == null) + throw new Exception("blijf van de theme file af kkr djalla, ga t zelf maar fixen"); + else + result.Add((Theme)t); + } + } + } + return result; + } + + static private void SetMoney(int newValue) + { + if (newValue < 0) + return; + + Settings.Default.Money = newValue; + Settings.Default.Save(); + } + + static private Font GetMainFont() + { + string fontName = Settings.Default.FontName; + + return new Font(fontName, FONTSIZE); + } + + static public void SetMainFont(string fontName) + { + Settings.Default.FontName = fontName; + Settings.Default.Save(); + } + + static private Theme GetCurrentTheme() + { + string currentThemeName = Settings.Default.ThemeName; + foreach (Theme t in allThemes) + { + if (t.unlocked && currentThemeName == t.name) + return t; + } + throw new Exception("can't find the selected theme in unlocked themes"); + } + + static public void SetCurrentTheme(string newThemeName) + { + foreach (Theme t in allThemes) + { + if(t.unlocked && newThemeName == t.name) + { + Settings.Default.ThemeName = newThemeName; + Settings.Default.Save(); + return; + } + } + } + + static public void UnlockTheme(string ThemeToUnlock) + { + // update the unlockedThemes list + for (int i = 0; i < allThemes.Count; i++) + { + if (allThemes[i].name == ThemeToUnlock) + { + allThemes[i].Unlock(); + return; + } + } + + // write the data back to the file + using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(themeFilePath)) + using (StreamWriter writer = new StreamWriter(stream)) + foreach(Theme t in allThemes) + writer.WriteLine(t.ToString()); + } + } +}