public static void BackupRegistryData(string regfile) { var key = RegistryAccess.GetDefaultRegKeyPath(); string arg = string.Format("/e \"{0}\" \"{1}\"", regfile, key); System.Diagnostics.Process.Start("regedit.exe", arg).WaitForExit(); }
public static void LoadCategories() { var index = Functions.GetCategoryIndex(); foreach (string key in index.Keys) { bool ok = LoadCategoryData(key); if (ok) { RegistryAccess.SetCategoryVersion(key, index[key]); } else { RegistryAccess.SetCategoryVersion(key, 0); } } }
static void Main() { //enable application styles Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //add header to log file string dat = Environment.NewLine; for (int i = 0; i < 80; ++i) { dat += '*'; } dat += Environment.NewLine; System.IO.File.AppendAllText(LocalDirectory.GetLogFile(), dat); //load user-names LocalDatabase.usernames = RegistryAccess.GetAllUsers(); if (string.IsNullOrEmpty(RegistryAccess.DefaultUsername) || Properties.Settings.Default.AskForUsernameEverytime) { UsernameForm uf = new UsernameForm(); Application.Run(uf); } //task queue TaskQueue.StartTimer(); try { //launch application Interactivity.mainForm = new MainForm(); Application.Run(Interactivity.mainForm); } catch (Exception ex) { Logger.Add("Error in main form => ", ex.Message + " => " + ex.StackTrace); Application.Exit(); } //end of application works Interactivity.CloseAllOpenedForms(); Properties.Settings.Default.Save(); UVA_Arena.Elements.CodeCompiler.ForceStopTask(); }
/// <summary> /// Load downloaded categories /// </summary> /// <param name="wait">True to wait until problem database is not ready</param> public static void LoadCategories() { try { foreach (ProblemInfo plist in problem_list) { //add custom category List <string> tags = RegistryAccess.GetTags(plist.pnum); foreach (string cat in tags) { string path = cat.Substring((NodeRoot + CategoryNode.SEPARATOR).Length); category_root[path].AddProblem(plist); } } } catch (Exception ex) { Logger.Add(ex.Message, "LocalDatabase|LoadCategory()"); } }
private void save_Button_Click(object sender, EventArgs e) { foreach (string cat in problem.categories) { string path = cat.Substring(root.Length); LocalDatabase.category_root[path].RemoveProblem(problem); } problem.categories.Clear(); SaveAllCategory(); RemoveEmptyNodes(LocalDatabase.category_root); RegistryAccess.SetTags(problem.pnum, problem.categories); LocalDatabase.LoadCategories(); Interactivity.problems.LoadCategory(); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }