private static void ToDefaults() { try { RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE", true); key = key.CreateSubKey("NIDE"); key = key.CreateSubKey("settings"); foreach (var def in defaults) { key.SetValue(def.Key, def.Value); } } catch (Exception e) { ProgramData.Log("Registry", "Unable to restore default settings: " + e.Message, ProgramData.LOG_STYLE_WARN); } }
internal static void PreLoad() { try { key = Registry.CurrentUser.OpenSubKey("SOFTWARE", true); if (!key.GetSubKeyNames().Contains("NIDE")) { throw new Exception("You have to install NIDE to use it correctly!"); } key = key.OpenSubKey("NIDE", true); RegistryKey subKey = key.OpenSubKey("settings"); if (subKey.GetValueNames().Contains("Culture")) { CultureInfo savedCulture = new CultureInfo((string)subKey.GetValue("Culture")); Thread.CurrentThread.CurrentCulture = savedCulture; Thread.CurrentThread.CurrentUICulture = savedCulture; } } catch (Exception e) { ProgramData.Log("RegistryWorker", e.Message, ProgramData.LOG_STYLE_ERROR); } }
private void log(object iString) { ProgramData.Log("JsRunner", iString.ToString(), ProgramData.LOG_STYLE_NORMAL); }