private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { if (treeView1.SelectedNode.Tag != null && treeView1.SelectedNode.Tag is int) { textBox1.Text = DataHolder.GetBackups()[(int)treeView1.SelectedNode.Tag].GetDescription(); } }
private void UpdateBackupList() { treeView1.Nodes.Clear(); foreach (IBackupFormat format in BackupLoader.formats) { TreeNode node = new TreeNode(format.GetType().Name); foreach (IBackup backup in DataHolder.GetBackups()) { if (backup.GetFormat().GetType() == format.GetType()) { node.Nodes.Add(backup.GetName()); } } treeView1.Nodes.Add(node); } }
private static void Main() { Data.CheckStartupFolders(); PluginLoader.LoadPlugins(); if (File.Exists(Data.logininfo)) { DataHolder.SetLoginInfo(LoginInfo.Load(Data.logininfo)); } DataHolder.SetBackups(BackupLoader.LoadBackups()); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); BackupLoader.SaveBackups(DataHolder.GetBackups()); if (DataHolder.HasLoginInfo) { DataHolder.GetLoginInfo().Save(Data.logininfo); } else { File.Delete(Data.logininfo); } }
public void UpdateBackupList() { treeView1.Nodes.Clear(); foreach (IBackupFormat format in BackupLoader.formats) { TreeNode node = new TreeNode(format.GetFormatName()); node.ToolTipText = format.GetFormatName(); int i = 0; foreach (IBackup backup in DataHolder.GetBackups()) { if (backup.GetFormat().GetType() == format.GetType()) { TreeNode n = new TreeNode(backup.GetName()); n.Tag = DataHolder.GetBackups().IndexOf(backup); n.ToolTipText = backup.GetDescription(); n.Tag = i; n.ImageKey = format.GetImageName(); node.Nodes.Add(n); } i++; } treeView1.Nodes.Add(node); } }
private void btnRestoreBackup_Click(object sender, EventArgs e) { DataHolder.GetBackups()[(int)treeView1.SelectedNode.Tag].Extract(); MessageBox.Show("Backup restored"); }
private void btnRestoreBackup_Click(object sender, EventArgs e) { DataHolder.GetBackups().FindAll(b => treeView1.SelectedNode.Text == b.GetName()).ForEach(b => b.Extract()); }
private static void Main() { //Init windows visuals Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //Init data & load plugins Data.CheckStartupFolders(); PluginLoader.LoadPlugins(); DataHolder.LoadConfigs(); DataHolder.LoadImages(); //Check for updates if (!DataHolder.GetConfig().Has("autoupdate")) { DataHolder.GetConfig().Set("autoupdate", Plugin_API.Config.Type.Bool, false); } if ((bool)DataHolder.GetConfig().Get("autoupdate")) { Thread updateThread = new Thread(() => { Data.CheckForUpdate(); DataHolder.UpdatePlugins(); Data.PreformUpdate(); if (Data.updateData.ToString() != "") { DialogResult r = MessageBox.Show("New Update Available! Download?", "Update", MessageBoxButtons.YesNo); if (r == DialogResult.Yes) { Process.Start(Data.updaterExe); Thread.Sleep(100); Application.Exit(); } } }); updateThread.Start(); } if (File.Exists(Data.logininfo)) { DataHolder.SetLoginInfo(LoginInfo.Load(Data.logininfo)); } DataHolder.SetBackups(BackupLoader.LoadBackups()); //try //{ DataHolder.mainWindow = new MainWindow(); Application.Run(DataHolder.mainWindow); DataHolder.StopPlugins(); //} //catch (Exception ex) //{ // ErrorPage ep = new ErrorPage(ex.ToString()); // Application.Run(ep); //} BackupLoader.SaveBackups(DataHolder.GetBackups()); if (DataHolder.HasLoginInfo) { DataHolder.GetLoginInfo().Save(Data.logininfo); } else { if (File.Exists(Data.logininfo)) { File.Delete(Data.logininfo); } } DataHolder.SaveConfigs(); }