コード例 #1
0
        private void Purge_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)
            {
                bool bFailed = false;

                // Attempt to remove the project
                if (DosUtils.DirectoryExist(MOG_ControllerSystem.GetSystemDeletedProjectsPath() + "\\" + projName))
                {
                    if (!DosUtils.DirectoryDeleteFast(MOG_ControllerSystem.GetSystemDeletedProjectsPath() + "\\" + projName))
                    {
                        Utils.ShowMessageBoxExclamation("Can't purge " + projName + ", probably because of a sharing violation", "Project Removal Failure");
                        bFailed = true;
                    }
                }

                if (!bFailed)
                {
                    // make sure projName is a deleted project
                    if (ini.SectionExist(projName + ".Deleted"))
                    {
                        // Remove the project from the list of deleted projects
                        ini.RemoveString("Projects.Deleted", projName);
                        ini.RemoveSection(projName + ".Deleted");

                        BlankInfoBox();

                        ini.Save();
                    }
                }

                ini.Close();

                LoadIniFile(iniFilename);
            }
        }