private void buttonActions_Click(object sender, EventArgs e) { EDDiscovery.EDDOptions opt = EDDiscovery.EDDOptions.Instance; string apfolder = opt.ActionsAppDirectory(); if (MessageBox.Show(this, "Current Action Pack folder is located at:" + Environment.NewLine + apfolder + Environment.NewLine + Environment.NewLine + "Do you wish to delete all Action Packs?", "Delete Action Packs", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK) { var dir = new DirectoryInfo(apfolder); foreach (var file in dir.EnumerateFiles("*.act")) { try { file.Delete(); } catch { } } } }
private void buttonRemoveDLLs_Click(object sender, EventArgs e) { EDDiscovery.EDDOptions opt = EDDiscovery.EDDOptions.Instance; string dllfolder = opt.DLLAppDirectory(); if (MessageBox.Show(this, "Current add on DLL folder is located at:" + Environment.NewLine + dllfolder + Environment.NewLine + Environment.NewLine + "Do you wish to delete all DLLs?", "Delete Extension DLLs", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK) { var dir = new DirectoryInfo(dllfolder); foreach (var file in dir.EnumerateFiles("*.dll")) { try { file.Delete(); } catch { } } } }
private void buttonResetDBLoc_Click(object sender, EventArgs e) { EDDiscovery.EDDOptions opt = EDDiscovery.EDDOptions.Instance; if (File.Exists(opt.DbOptionsFile())) { if (MessageBox.Show(this, "Current databases are located at:" + Environment.NewLine + Environment.NewLine + "User: "******"System: " + opt.SystemDatabasePath + Environment.NewLine + Environment.NewLine + "Do you wish to change their back to the default in " + EDDiscovery.EDDOptions.Instance.AppDataDirectory + "?", "Reset Databases", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK) { BaseUtils.FileHelpers.DeleteFileNoError(opt.DbOptionsFile()); EDDiscovery.EDDOptions.Instance.ResetSystemDatabasePath(); EDDiscovery.EDDOptions.Instance.ResetUserDatabasePath(); } } else { MessageBox.Show(this, "There is no dboptions.txt file present to override the DB locations", "Reset Database", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void buttonDeleteUserDB_Click(object sender, EventArgs e) { EDDiscovery.EDDOptions opt = EDDiscovery.EDDOptions.Instance; if (File.Exists(opt.UserDatabasePath)) { if (MessageBox.Show(this, "Current user database is located at:" + Environment.NewLine + Environment.NewLine + "User: "******"Do you wish to delete this and let EDD rebuild it" + Environment.NewLine + "**All user settings will be lost**" + Environment.NewLine + "Afterwards, Exit and restart EDD", "Delete/Rebuild User Database", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK) { File.Delete(opt.UserDatabasePath); buttonRun.Visible = false; // can't run, must exit } } else { MessageBox.Show(this, "You need to run EDD first and let it create the dBs before it can delete any!", "Delete/Rebuild User Database", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void buttonDbs_Click(object sender, EventArgs e) { EDDiscovery.EDDOptions opt = EDDiscovery.EDDOptions.Instance; if (File.Exists(opt.UserDatabasePath) && File.Exists(opt.SystemDatabasePath)) { if (MessageBox.Show(this, "Current databases are located at:" + Environment.NewLine + Environment.NewLine + "User: "******"System: " + opt.SystemDatabasePath + Environment.NewLine + Environment.NewLine + "Do you wish to change their location?", "Move Databases", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK) { buttonRun.Visible = false; // can't run, must exit FolderBrowserDialog fbd = new FolderBrowserDialog(); fbd.Description = "Select new folder"; if (fbd.ShowDialog(this) == DialogResult.OK) { string pathto = fbd.SelectedPath; //string pathto = @"c:\code"; // debug string userfilename = Path.Combine(pathto, Path.GetFileName(opt.UserDatabasePath)); string systemfilename = Path.Combine(pathto, Path.GetFileName(opt.SystemDatabasePath)); string optionfile = Path.Combine(opt.AppDataDirectory, "dboptions.txt"); ExtendedControls.MessageBoxTheme mbt = ExtendedControls.MessageBoxTheme.ShowModeless(this, "Copying User DB", "Copy databases", MessageBoxIcon.Information, this.Icon); try { File.Copy(opt.UserDatabasePath, userfilename, true); mbt.MessageText = "Copying System DB"; File.Copy(opt.SystemDatabasePath, systemfilename, true); // this file tells us where they are now, placed in the appdatadirectory File.WriteAllLines(optionfile, new string[] { "userdbpath " + userfilename, "systemsdbpath " + systemfilename }); mbt.Close(); if (MessageBox.Show(this, "Copy of databases to " + pathto + " succeeded." + Environment.NewLine + "EDD will use the databases from this location from now on." + Environment.NewLine + Environment.NewLine + "Confirm you wish to delete the DB from their old location?", "Move Databases", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK) { File.Delete(opt.UserDatabasePath); File.Delete(opt.SystemDatabasePath); EDDOptions.Instance.ReRead(); } } catch { mbt.Close(); MessageBox.Show(this, "Copy failed! Check Path", "EDDiscovery", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } } else { MessageBox.Show(this, "You need to run EDD first and let it create the dBs before it can move them!", "Move Databases", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }