Exemple #1
0
        private void HandlePossibleConfigOnlyDirs(Registry registry, HashSet <string> possibleConfigOnlyDirs)
        {
            if (possibleConfigOnlyDirs != null)
            {
                // Check again for registered files, since we may
                // just have installed or upgraded some
                possibleConfigOnlyDirs.RemoveWhere(
                    d => Directory.EnumerateFileSystemEntries(d, "*", SearchOption.AllDirectories)
                    .Any(f => registry.FileOwner(CurrentInstance.ToRelativeGameDir(f)) != null));
                if (possibleConfigOnlyDirs.Count > 0)
                {
                    AddStatusMessage("");
                    tabController.ShowTab("DeleteDirectoriesTabPage", 4);
                    tabController.SetTabLock(true);

                    DeleteDirectories.LoadDirs(CurrentInstance, possibleConfigOnlyDirs);

                    // Wait here for the GUI process to finish dealing with the user
                    if (DeleteDirectories.Wait(out HashSet <string> toDelete))
                    {
                        foreach (string dir in toDelete)
                        {
                            try
                            {
                                Directory.Delete(dir, true);
                            }
                            catch
                            {
                                // Don't worry if it doesn't work, just keep going
                            }
                        }
                    }

                    tabController.ShowTab("WaitTabPage");
                    tabController.HideTab("DeleteDirectoriesTabPage");
                    tabController.SetTabLock(false);
                }
            }
        }