コード例 #1
0
        private void Restore_Worker(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker      = sender as BackgroundWorker;
            List <string>    args        = e.Argument as List <string>;
            string           projName    = args[0];
            string           iniFilename = args[1];

            // open the ini file
            MOG_Ini ini = new MOG_Ini(iniFilename);

            if (ini != null)
            {
                // make sure projName is a deleted project
                if (ini.SectionExist(projName + ".Deleted"))
                {
                    // Attempt to move the project's directory
                    if (DosUtils.DirectoryMoveFast(MOG_ControllerSystem.GetSystemDeletedProjectsPath() + "\\" + projName, MOG_ControllerSystem.GetSystemProjectsPath() + "\\" + projName, true))
                    {
                        // Restore the project to the active projects list
                        ini.PutString("Projects", projName, "");
                        ini.RemoveString("Projects.Deleted", projName);
                        ini.RenameSection(projName + ".Deleted", projName);

                        // Restore the project's database
                        MOG_ControllerSystem.GetDB().VerifyTables(projName);
                        MOG_Database.ImportProjectTables(projName, this.mogProjectsPath + "\\" + projName);
                    }

                    BlankInfoBox();

                    ini.Save();
                }

                ini.Close();

                LoadIniFile(iniFilename);
            }
        }