public static void saveSettingOnFile() { try { //Pass the filepath and filename to the StreamWriter Constructor StreamWriter sw = new StreamWriter("Settings.txt"); //Write a line of text sw.WriteLine(Const.isItalian.ToString()); sw.WriteLine(Const.currentLevel.difficulty); if (isItalian == 0) { sw.WriteLine(Const.convertTextIngToIT(Const.ButtonColor.Name)); sw.WriteLine(Const.convertTextIngToIT(Const.BackgroundColor.Name)); sw.WriteLine(Const.convertTextIngToIT(Const.TextColor.Name)); } else { sw.WriteLine(Const.ButtonColor.Name); sw.WriteLine(Const.BackgroundColor.Name); sw.WriteLine(Const.TextColor.Name); } //Close the file sw.Close(); } catch (Exception e) { Console.WriteLine("Exception: " + e.Message); } }
public void defineCBox() { //vado a impostare adesso i vari colori selzionabili nelle varie barre cBoxLeanguage.Items.AddRange(Const.getRow(Const.LanguagePossible, Const.isItalian)); cBoxLeanguage.SelectedItem = Const.getRow(Const.LanguagePossible, Const.isItalian)[Const.isItalian]; cBoxLevel.Items.AddRange(Const.LevelPossible); cBoxLevel.SelectedItem = Const.currentLevel.difficulty.ToString(); cBoxBackground.Items.AddRange(Const.getRow(Const.ColorBackGroundPossibile, Const.isItalian)); cBoxBackground.SelectedItem = Const.convertTextIngToIT(Const.BackgroundColor.Name); cBoxBBeckground.Items.AddRange(Const.getRow(Const.ColorButtonBackground, Const.isItalian)); cBoxBBeckground.SelectedItem = Const.convertTextIngToIT(Const.ButtonColor.Name); cBoxBText.Items.AddRange(Const.getRow(Const.ColorButtonText, Const.isItalian)); cBoxBText.SelectedItem = Const.convertTextIngToIT(Const.TextColor.Name); }