public static void ReadHotkeySettings() { if (File.Exists (Program.AppPath+"hotkeys.ini")==false) { StreamWriter sw=new StreamWriter (Program.AppPath+"hotkeys.ini"); for (int i=0; i<=10; i++) { sw.WriteLine ("["+i.ToString ()+"]"); sw.WriteLine ("On=False"); sw.WriteLine ("Value="); } sw.Close (); } hHotkeys=new List <object> (); Ini ini=new Ini (Program.AppPath+"hotkeys.ini"); for (int i=0; i<=10; i++) { HotkeyData hkd=new HotkeyData (); hkd.IsActive=Convert.ToBoolean (ini.IniRead (i.ToString (), "On")); if (hkd.IsActive) { Keys k=Keys.None; Enum.TryParse <Keys> (ini.IniRead (i.ToString (), "Value"), true, out k); if (k!=Keys.None) hkd.Hotkey=k; } hHotkeys.Add (hkd); } }
public static void ReadConfig () { //read config if (File.Exists (AppPath+"config.ini")==false) { MessageBox.Show ("config.ini file do not exist"); Application.Exit (); } else { //remember to set your url to api and the api key in config.ini! Ini i=new Ini (AppPath+"config.ini"); Url=i.IniRead ("Api", "Url"); Key=i.IniRead ("Api", "Key"); Chevereto3=false; string s=i.IniRead ("Api", "Ver3"); if (s!=null&&s!="") Chevereto3=bool.Parse (s); } }
public static void ReadSets() { if (System.IO.File.Exists (".\\sets")==false) { System.IO.File.WriteAllBytes (".\\sets", Properties.Resources.sets); } s=new Ini (".\\sets"); //read the settings _StartOnStartup=Convert.ToBoolean (s.IniRead ("General", "startup")); _CopyAfterUpload=Convert.ToBoolean (s.IniRead ("General", "copyafter")); _ProxyOn=Convert.ToBoolean (s.IniRead ("Proxy", "on")); _ProxyServer=s.IniRead ("Proxy", "adress"); _ProxyPort=s.IniRead ("Proxy", "port"); _Bug563Fix=Convert.ToBoolean (s.IniRead ("Bugfix", "Bug563")); _SaveScreenshots=Convert.ToBoolean (s.IniRead ("General", "savescr")); }
public static void WriteHotkeySetting(int AppFunctionIndex) { Ini i=new Ini (Program.AppPath+"hotkeys.ini"); HotkeyData hkd=(HotkeyData)hHotkeys[AppFunctionIndex]; i.IniWrite (AppFunctionIndex.ToString (), "On", hkd.IsActive.ToString ()); i.IniWrite (AppFunctionIndex.ToString (), "Value", hkd.Hotkey.ToString ()); }