예제 #1
0
        private void loadConfigButton_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckSaved())
            {
                Globals.LogWarning(Components.Stacker, "Config not saved, prompting quit confirmation");
                if (MessageBox.Show("The Config in Stacker wasn't saved.\nAre you sure you want to load another config?",
                                    "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
                {
                    return;
                }
            }

            // Create new instance of stacker
            Current = (ConfigViewModel)configsListView.SelectedItem; // Set Current Config

            if (Current != null)
            {
                if (Current.Remote)
                {
                    Globals.LogError(Components.ConfigManager, "The config was pulled from a remote source and cannot be edited!", true);
                    Current = null;
                    return;
                }

                Globals.LogInfo(Components.ConfigManager, "Loading config: " + Current.Name);

                Globals.mainWindow.ConfigsPage.menuOptionStacker.IsEnabled      = true;
                Globals.mainWindow.ConfigsPage.menuOptionOtherOptions.IsEnabled = true;
                var newStacker = new Stacker(Current);
                if (Globals.mainWindow.ConfigsPage.StackerPage != null)
                {
                    newStacker.vm.TestData  = Globals.mainWindow.ConfigsPage.StackerPage.vm.TestData;
                    newStacker.vm.TestProxy = Globals.mainWindow.ConfigsPage.StackerPage.vm.TestProxy;
                    newStacker.vm.ProxyType = Globals.mainWindow.ConfigsPage.StackerPage.vm.ProxyType;
                }
                Globals.mainWindow.ConfigsPage.StackerPage = newStacker;                    // Create a Stacker instance
                Globals.LogInfo(Components.ConfigManager, "Created and assigned a new Stacker instance");
                Globals.mainWindow.ConfigsPage.OtherOptionsPage = new ConfigOtherOptions(); // Create an Other Options instance
                Globals.LogInfo(Components.ConfigManager, "Created and assigned a new Other Options instance");
                Globals.mainWindow.ConfigsPage.menuOptionStacker_MouseDown(this, null);     // Switch to Stacker

                // Save the last state of the config
                Globals.mainWindow.ConfigsPage.StackerPage.SetScript();
                SaveState();
            }
            else
            {
                Globals.LogError(Components.ConfigManager, "No config selected for loading", true);
            }
        }
예제 #2
0
        public void CreateConfig(string name, string category, string author)
        {
            // Build the filename
            var path = Globals.configFolder + "\\" + (category == "Default" ? "" : (category + "\\")) + name + ".loli";

            // Create the Category folder if it doesn't exist
            if (category != "Default")
            {
                var categoryFolder = System.IO.Path.Combine(Directory.GetCurrentDirectory(), Globals.configFolder, category);
                if (!Directory.Exists(categoryFolder))
                {
                    Directory.CreateDirectory(categoryFolder);
                }
            }

            // Build the base config structure
            var settings = new ConfigSettings();

            settings.Name             = name;
            settings.Author           = author;
            settings.AllowedWordlist1 = "MailPass";
            Globals.LogInfo(Components.ConfigManager, "Setting up the new Config object, with path '" + path + "'");
            Current = new ConfigViewModel(path, category, new Config(settings, ""), 1);

            var newStacker = new Stacker(Current);

            if (Globals.mainWindow.ConfigsPage.StackerPage != null) // Maintain the previous stacker settings
            {
                newStacker.vm.TestData  = Globals.mainWindow.ConfigsPage.StackerPage.vm.TestData;
                newStacker.vm.TestProxy = Globals.mainWindow.ConfigsPage.StackerPage.vm.TestProxy;
                newStacker.vm.ProxyType = Globals.mainWindow.ConfigsPage.StackerPage.vm.ProxyType;
            }
            Globals.mainWindow.ConfigsPage.StackerPage = newStacker;                    // Create a Stacker instance
            Globals.LogInfo(Components.ConfigManager, "Created and assigned a new Stacker instance");
            Globals.mainWindow.ConfigsPage.OtherOptionsPage = new ConfigOtherOptions(); // Create an Other Options instance
            Globals.LogInfo(Components.ConfigManager, "Created and assigned a new Other Options instance");
            Globals.mainWindow.ConfigsPage.menuOptionStacker_MouseDown(this, null);     // Switch to Stacker

            // Save to disk
            saveConfigButton_Click(this, null);

            vm.RefreshList();

            // Create new instance of stacker
            Globals.mainWindow.ConfigsPage.StackerPage = new Stacker(Current);
            Globals.mainWindow.ConfigsPage.menuOptionStacker_MouseDown(this, null); // Switch to Stacker
        }