示例#1
0
        private void b_Other_ChangeDir_Click(object sender, EventArgs e)
        {
            bool confirm = Tools.ShowPopup("Moving the directory will reset app configuration AND WILL ALSO DELETE ALL FILES WITHIN THE OLD APP FOLDER!\nYou will have the option to save these files.\nAre you sure you want to continue?", "Warning", null, false);

            if (confirm)
            {
                bool   moveFiles    = Tools.ShowPopup("Would you like to move all current directory files to the new directory too?", "Move files?", null, false);
                string oldAppFolder = ConfigControl.appFolder;

                FileStuff.ChooseNewDirectory();
                ConfigControl.SetToDefaults();
                FileStuff.CreateConfigFiles();

                if (oldAppFolder != ConfigControl.appFolder && oldAppFolder != ConfigControl.appFolder + @"SSUtility\")
                {
                    if (moveFiles)
                    {
                        Tools.CopyFiles(ConfigControl.appFolder, Directory.GetFiles(oldAppFolder));
                    }

                    Tools.DeleteDirectory(oldAppFolder);
                }
                MessageBox.Show("Finished changing directories!");
            }

            l_Other_Dir.Text = "Current Directory: " + ConfigControl.appFolder;
            MainForm.m.col.recentSavedLocations.Clear();
            MainForm.m.col.AddDefaultSavedLocations();
        }
示例#2
0
        public static async Task ImportConfig(string name, bool dragdrop)
        {
            try {
                MainForm.m.finishedLoading = false;
                string configFile = ConfigControl.appFolder + ConfigControl.config;
                if (name != configFile)
                {
                    ResetFile(configFile);

                    string[] lines   = File.ReadAllLines(name);
                    bool     isValid = false;
                    foreach (string line in lines)
                    {
                        string val = line.ToLower();
                        if (val.Contains("ssutility2.0") && val.Contains("config"))
                        {
                            isValid = true;
                            break;
                        }
                    }

                    if (!isValid)
                    {
                        MessageBox.Show("Text file is not a config file!");
                        MainForm.m.finishedLoading = true;
                        return;
                    }
                    else if (dragdrop && !ShowPopup("Config file detected!\n(" + name + ")\nImport new settings, replacing current config?", "New Config Detected!", "", false))
                    {
                        MainForm.m.finishedLoading = true;
                        return;
                    }

                    foreach (string line in lines)
                    {
                        File.AppendAllText(configFile, line + "\n");
                    }

                    RTSPPresets.Reload(true);
                    ConfigControl.SetToDefaults();
                    await ConfigControl.SearchForVarsAsync(ConfigControl.appFolder + ConfigControl.config);

                    MainForm.m.setPage.LoadSettings();
                    MessageBox.Show("Updated config file!\n(" + configFile + ")");
                    MainForm.m.AttachPlayers();
                }
                else
                {
                    if (name == configFile)
                    {
                        MessageBox.Show("Please don't try to replace the config file with itself!");
                    }
                }
            } catch (Exception e) {
                ShowPopup("Failed to import config!\nShow more?", "Error Occurred!", e.ToString());
            }

            MainForm.m.finishedLoading = true;
        }
示例#3
0
        private void b_Settings_Default_Click(object sender, EventArgs e)
        {
            DialogResult d = MessageBox.Show("Are you sure you want to reset all settings?",
                                             "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (d == DialogResult.Yes)
            {
                ConfigControl.SetToDefaults();
                LoadSettings();
                MainForm.m.mainPlayer.DestroyAll();
            }
        }
示例#4
0
        public static async Task <bool> FileWork()
        {
            try {
                bool firstTime = CheckForNewDir();
                if (!firstTime)
                {
                    CheckForMultipleConfigs();
                }

                ConfigControl.SetToDefaults();

                CreateConfigFiles();

                await ConfigControl.SearchForVarsAsync(ConfigControl.appFolder + ConfigControl.config);

                MainForm.m.custom.HideButtons();

                if (ConfigControl.portableMode.boolVal)
                {
                    MainForm.m.Menu_Final.Dispose();
                }

                if (AppDomain.CurrentDomain.FriendlyName.ToLower().Contains("lite"))
                {
                    return(true);
                }

                if (firstTime)
                {
                    FirstTimeSetup();
                }

                return(false);
            } catch (Exception e) {
                Tools.ShowPopup("File work error occurred!\nShow more?", "Error Occurred!", e.ToString());
                return(false);
            }
        }