Пример #1
0
        public static void ActuallyDoStuff(string path)
        {
            try
            {
                // start by creating the loading bar
                LoadingBar loadingBar = new LoadingBar(MainForm.instance);

                // then the background worker
                BackgroundWorker pleaseSpareMyLife = new BackgroundWorker();
                pleaseSpareMyLife.WorkerReportsProgress = true;
                pleaseSpareMyLife.ProgressChanged      += loadingBar.ReportProgress;
                pleaseSpareMyLife.DoWork += DoStuff;

                // run
                pleaseSpareMyLife.RunWorkerAsync(new SetupArgs(path, loadingBar));
            }
            catch (Exception ex)
            {
                ExceptionMessage.New(ex, true, "OneShot ModLoader will now close.");

                if (MainForm.instance.InvokeRequired)
                {
                    MainForm.instance.Invoke(new Action(() => MainForm.instance.Close()));
                }
                else
                {
                    MainForm.instance.Close();
                }
            }
        }
Пример #2
0
        protected override void OnClick(EventArgs e)
        {
            Logger.WriteLine("doin the unpiracyifier");
            DevToolsForm.instance.Controls.Clear();

            // bring up a folder browser to browse to the mod's path
            if (Program.doneSetup)
            {
                using (FolderBrowserDialog browse = new FolderBrowserDialog())
                {
                    browse.Description = "Please navigate to your mod's path.";
                    browse.ShowDialog();

                    if (browse.SelectedPath != string.Empty)
                    {
                        try
                        {
                            modPath = browse.SelectedPath;
                            CompareToBaseOS(modPath);
                        }
                        catch (Exception ex)
                        {
                            ExceptionMessage.New(ex, true);
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("A base oneshot could not be found. Please open the setup page and follow the instructions.");
                DevToolsForm.instance.Init();
            }
        }
Пример #3
0
        public OCIForm(string[] things)
        {
            try
            {
                Logger.WriteLine("OCIForm intialized with args: ");
                foreach (string s in things)
                {
                    Logger.WriteLine(" " + s);
                }
                if (!Program.doneSetup)
                {
                    Logger.WriteLine("base os not found, attempting to close oci form");
                    MessageBox.Show("A base oneshot could not be found. Please open the setup page and follow the instructions.");
                    Close();
                    return;
                }

                ghajshdfjhjahskgkdjfahajsldkfGoodVariableName = true;
                instance = this;

                modPath = new FileInfo(things[0]);

                FormBorderStyle = FormBorderStyle.FixedSingle;
                Text            = "One-Click Install";
                Size            = new Size(500, 400);
                SetTheme();
                Icon = new Icon(Static.spritesPath + "oci_icon.ico");

                MaximizeBox = false;
                MinimizeBox = false;
                HelpButton  = true;

                Show();
                Audio.PlaySound("bgm_oci", false);

                // text
                Label text = new Label
                {
                    Text      = "OneShot ModLoader\nOne-Click Install\n" + modPath.Name,
                    Location  = new Point(10, 10),
                    Font      = Static.GetTerminusFont(16),
                    AutoSize  = true,
                    ForeColor = Color.White,
                    BackColor = Color.Transparent,
                };

                Controls.Add(new OCIDoneButton());
                Controls.Add(new OCIDirectApply());
                Controls.Add(new OCIDeleteExisting());
                Controls.Add(text);
            }
            catch (Exception ex)
            {
                ExceptionMessage.New(ex, true, "\nOneShot ModLoader will now close.");
                Close();
            }
        }
Пример #4
0
        // i am actually going to cry
        public static void MultithreadStuff(bool directApply, LoadingBar loadingBar, DirectoryInfo mod = null, bool uninstallExisting = true)
        {
            try
            {
                // then the background worker
                BackgroundWorker pleaseSpareMyLife = new BackgroundWorker();
                pleaseSpareMyLife.WorkerReportsProgress = true;
                pleaseSpareMyLife.ProgressChanged      += loadingBar.ReportProgress;

                if (directApply)
                {
                    if (mod is null)
                    {
                        throw new ArgumentNullException("Tried to call DirectApply, but the mod is null");
                    }
                    else
                    {
                        pleaseSpareMyLife.DoWork += DirectApply;

                        // run
                        pleaseSpareMyLife.RunWorkerAsync(new DirectApplyArgs(loadingBar, mod, uninstallExisting));
                    }
                }
                else
                {
                    pleaseSpareMyLife.DoWork += Apply;

                    // run
                    pleaseSpareMyLife.RunWorkerAsync(new ApplyArgs(pleaseSpareMyLife, loadingBar));
                }
            }
            catch (Exception ex)
            {
                ExceptionMessage.New(ex, true, "OneShot ModLoader will now close.");

                if (MainForm.instance.InvokeRequired)
                {
                    MainForm.instance.Invoke(new Action(() => MainForm.instance.Close()));
                }
                else
                {
                    MainForm.instance.Close();
                }
            }
        }
Пример #5
0
        public async void DeleteFiles(object sender, EventArgs e)
        {
            Logger.WriteLine("deleting unchanged files");

            try
            {
                // kill each active file matches.txt process
                matchesProcesses.ForEach((Process p) => { if (!p.HasExited)
                                                          {
                                                              p.Kill();
                                                          }
                                         });

                string file = Static.GetOrCreateTempDirectory().FullName + "\\file matches.txt";

                // reset loading bar progress
                formLoadingBar.ResetProgress();
                formLoadingBar.SetLoadingStatus("deleting unchanged files");

                // get files
                string[] files = File.ReadAllLines(Static.GetOrCreateTempDirectory().FullName + "\\file matches.txt");
                formLoadingBar.progress.Maximum = files.Length; // set maximum progress

                foreach (string s in files)
                {
                    Logger.WriteLine($"deleting {s}");
                    File.Delete(s);
                    //await formLoadingBar.UpdateProgress();
                }

                // done!
                Logger.WriteLine("done!");
                MessageBox.Show("All done!");

                // clear controls
                DevToolsForm.instance.Controls.Clear();
                DevToolsForm.instance.Init();
            }
            catch (Exception ex)
            {
                ExceptionMessage.New(ex, true);
            }
        }
Пример #6
0
        protected override async void OnClick(EventArgs e)
        {
            DevToolsForm.instance.Controls.Clear();

            using (FolderBrowserDialog browse = new FolderBrowserDialog())
            {
                browse.Description = "Please navigate to your mod's path.";
                browse.ShowDialog();

                if (browse.SelectedPath != string.Empty)
                {
                    try
                    {
                        LoadingBar loadingBar = new LoadingBar(DevToolsForm.instance);
                        Audio.PlaySound(loadingBar.GetLoadingBGM(), false);
                        loadingBar.SetLoadingStatus("Please wait a moment...");

                        await Task.Run(() =>
                        {
                            ZipFile.CreateFromDirectory(browse.SelectedPath, browse.SelectedPath + ".osml");
                        });

                        Console.Beep();
                        MessageBox.Show("All done!");

                        loadingBar.text.Dispose();
                        Audio.Stop();
                    }
                    catch (Exception ex)
                    {
                        ExceptionMessage.New(ex, true);
                    }
                }
            }

            DevToolsForm.instance.Init();
        }
Пример #7
0
        protected override void OnClick(EventArgs e)
        {
            DevToolsForm.instance.Controls.Clear();

            using (FolderBrowserDialog browse = new FolderBrowserDialog())
            {
                browse.Description = "Please navigate to your mod's path.";
                browse.ShowDialog();

                if (browse.SelectedPath != string.Empty)
                {
                    try
                    {
                        new MMDForm(browse.SelectedPath);
                    }
                    catch (Exception ex)
                    {
                        ExceptionMessage.New(ex, true);
                    }
                }
            }

            DevToolsForm.instance.Init();
        }
Пример #8
0
        public async void CompareToBaseOS(string modPath)
        {
            try
            {
                DirectoryInfo   mod      = new DirectoryInfo(modPath);
                FileInfo[]      modFiles = mod.GetFiles("*", SearchOption.AllDirectories); // get files
                List <FileInfo> matches  = new List <FileInfo>();

                formLoadingBar = new LoadingBar(DevToolsForm.instance);

                formLoadingBar.progress.Maximum = modFiles.Length; // set maximum progress

                foreach (FileInfo f in modFiles)
                {
                    // compare each file
                    Logger.WriteLine("comparing file to base os: " + f.FullName);

                    string fileName = Static.baseOneShotPath + f.FullName.Replace(modPath, string.Empty);

                    // if a file of the same name exists in base oneshot, add it to the matches list
                    if (File.Exists(fileName) &&
                        File.ReadAllText(fileName) == File.ReadAllText(f.FullName))
                    {
                        Logger.WriteLine("unchanged file found! " + f.FullName);
                        matches.Add(f);
                    }
                    //await formLoadingBar.UpdateProgress();
                }

                // make string array from file matches
                List <string> matchNames = new List <string>();
                // convert all of the files in the matches list to their string values by creating a converter
                // that refers to the FileInfoToString method
                matchNames.AddRange(matches.ConvertAll <string>(new Converter <FileInfo, string>(FileInfoToString)));

                Logger.WriteLine("all done! creating dialog");
                formLoadingBar.SetLoadingStatus("done!");

                // create temp directory
                Logger.WriteLine("also creating temp directory lol");
                File.WriteAllLines(Static.GetOrCreateTempDirectory().FullName + "\\file matches.txt", matchNames);

                // then create dialog form
                Console.Beep();
                Form dialog = new Form
                {
                    Text            = "All done!",
                    FormBorderStyle = FormBorderStyle.FixedDialog,
                    Size            = new Size(400, 200)
                };

                Label text = new Label
                {
                    AutoSize = true,
                    Text     = $"OneShot ModLoader found {matchNames.Count} unchanged files. What would you like to do?",
                    Location = new Point(10, 0),
                    Font     = new Font(FontFamily.GenericSansSerif, 8),
                };

                // initialize buttons
                Button deleteFiles = new Button
                {
                    Text     = "Delete",
                    Location = new Point(10, 25),
                    Size     = new Size(50, 20)
                };
                Button moveFiles = new Button
                {
                    Text     = "Move to ModName-Unchanged\\",
                    Location = new Point(10, 50),
                    Size     = new Size(50, 20)
                };
                Button listFiles = new Button
                {
                    Text     = "List",
                    Location = new Point(10, 75),
                    Size     = new Size(50, 20),
                };

                // hook events to the associated methods
                deleteFiles.Click  += DeleteFiles;
                moveFiles.Click    += MoveFiles;
                listFiles.Click    += ListFiles;
                dialog.FormClosing += CloseDialog;

                // add controls
                dialog.Controls.Add(text);
                dialog.Controls.Add(deleteFiles);
                dialog.Controls.Add(moveFiles);
                dialog.Controls.Add(listFiles);

                dialog.ShowDialog(DevToolsForm.instance);
            }
            catch (Exception ex)
            {
                ExceptionMessage.New(ex, true);
            }
        }
Пример #9
0
        public void MoveFiles(object sender, EventArgs e)
        {
            Logger.WriteLine("moving unchanged files");

            try
            {
                // kill each active file matches.txt process
                matchesProcesses.ForEach((Process p) => { if (!p.HasExited)
                                                          {
                                                              p.Kill();
                                                          }
                                         });

                string file = Static.GetOrCreateTempDirectory().FullName + "\\file matches.txt";

                // reset loading bar progress
                formLoadingBar.ResetProgress();
                formLoadingBar.SetLoadingStatus("moving unchanged files");

                // get files
                string[] files = File.ReadAllLines(Static.GetOrCreateTempDirectory().FullName + "\\file matches.txt");
                formLoadingBar.progress.Maximum = files.Length; // set maximum progress

                // get modPath's parent directory by initializing a DirectoryInfo and getting the parent's full name
                DirectoryInfo mod    = new DirectoryInfo(modPath);
                string        parent = mod.Parent.FullName;

                string moveFilesHere = string.Empty;

                // not commenting this lmao
                for (int i = 0; ; i++)
                {
                    string dir = parent + $"\\{mod.Name}-Unchanged{i}\\";
                    if (!Directory.Exists(dir))
                    {
                        moveFilesHere = dir;
                        Logger.WriteLine($"creating directory: {dir}");
                        Directory.CreateDirectory(dir);
                        break;
                    }
                }

                foreach (string s in files)
                {
                    string moveTo = moveFilesHere + $"\\{s.Replace(modPath, string.Empty)}";
                    Logger.WriteLine($"moving {s} to {moveTo}");
                    File.Move(s, moveTo);

                    //formLoadingBar.UpdateProgress();
                }

                // done!
                Logger.WriteLine("done!");
                MessageBox.Show("All done!");

                // clear controls
                DevToolsForm.instance.Controls.Clear();
                DevToolsForm.instance.Init();
            }
            catch (Exception ex)
            {
                ExceptionMessage.New(ex, true);
            }
        }
Пример #10
0
        /// ===================================================================
        ///                         Apply Changes
        /// ===================================================================
        public static async void Apply(object sender, DoWorkEventArgs e)
        {
            // get the parameter from the event args
            ApplyArgs?bogus = e.Argument as ApplyArgs?;

            if (bogus is null)
            {
                throw new Exception("absolutely no idea how you did that but good work");
            }

            // set field stuff
            BackgroundWorker backgroundWorker = bogus.Value.backgroundWorker; // provide this as an argument into DirectApplyArgs
            LoadingBar       loadingBar       = bogus.Value.loadingBar;       // self explanatory i guess

            // start bgm
            Audio.PlaySound(loadingBar.GetLoadingBGM(), true);

            // if there is just one mod queued, wrap to DirectApply and return
            if (ActiveMods.instance.Nodes.Count == 1)
            {
                Logger.WriteLine("ActiveMods tree only has 1 mod, switching to DirectApply instead");

                MultithreadStuff(true, loadingBar, new DirectoryInfo(Static.modsPath + ActiveMods.instance.Nodes[0].Text));
                return;
            }

            Logger.WriteLine("applying changes");
            await Task.Delay(1);

            List <string> activeMods = new List <string>();

            try
            {
                // using a string as the progress parameter sets the loading status
                loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(0, "creating temp directory"));

                DirectoryInfo tempDir = new DirectoryInfo(Static.GetOrCreateTempDirectory().FullName + "\\MODCOPY\\");
                DirectoryInfo baseOs  = new DirectoryInfo(Static.baseOneShotPath);

                // create the temp directory
                if (tempDir.Exists)
                {
                    tempDir.Delete(true);                 // just in case it crashed previously
                }
                if (!Directory.Exists(tempDir.FullName))
                {
                    Directory.CreateDirectory(tempDir.FullName);
                }

                // delete the base os path
                if (baseOs.Exists)
                {
                    baseOs.Delete(true);
                }

                // now we do the cool stuff
                foreach (TreeNode t in ActiveMods.instance.Nodes)
                {
                    loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(0, $"mod {t.Index + 1} out of {ActiveMods.instance.Nodes.Count}: {t.Text}"));
                    loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(0, LoadingBar.ProgressType.ResetProgress));

                    activeMods.Add(t.Text);

                    DirectoryInfo mod = new DirectoryInfo(Static.directory + "Mods\\" + t.Text);

                    // get the files and directories from the mod
                    DirectoryInfo[] directories = mod.GetDirectories("*", SearchOption.AllDirectories);
                    FileInfo[]      files       = mod.GetFiles("*", SearchOption.AllDirectories);

                    // set the maximum value of the progress bar to the sum of the directories/files
                    loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(directories.Length + files.Length, LoadingBar.ProgressType.SetMaximumProgress));

                    Logger.WriteLine($"mod {t.Index + 1} out of {ActiveMods.instance.Nodes.Count}: {mod.FullName}");

                    foreach (DirectoryInfo d in directories)
                    {
                        string shorten = Static.directory + "Mods\\" + t.Text + "\\";
                        string create  = tempDir.FullName + d.FullName.Replace(shorten, string.Empty); // the full name of the directory to create

                        if (!Directory.Exists(create))
                        {
                            Logger.WriteLine("creating directory: " + create);
                            Directory.CreateDirectory(create);

                            // update progress
                            loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(1, LoadingBar.ProgressType.UpdateProgress));
                            if (loadingBar.displayType == LoadingBar.LoadingBarType.Detailed)
                            {
                                loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(1, $"mod {t.Index + 1} out of {ActiveMods.instance.Nodes.Count}: {create}"));
                            }
                        }
                    }

                    foreach (FileInfo f in files)
                    {
                        string shorten     = Static.directory + "Mods\\" + t.Text + "\\";
                        string destination = tempDir.FullName + f.FullName.Replace(shorten, string.Empty);

                        if (!File.Exists(destination))
                        {
                            Logger.WriteLine($"copying {f.FullName} to {destination}");
                            f.CopyTo(destination, true);

                            // update progress
                            loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(1, LoadingBar.ProgressType.UpdateProgress));
                            if (loadingBar.displayType == LoadingBar.LoadingBarType.Detailed)
                            {
                                loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(0, $"mod {t.Index + 1} out of {ActiveMods.instance.Nodes.Count}: {f.FullName}"));
                            }
                        }
                    }
                }
                Logger.WriteLine("finished up in temp");

                loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(0, "finalizing, please wait"));
                loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(0, LoadingBar.ProgressType.ResetProgress));

                // now we copy everything in temp to the oneshot path

                // get the directories and files
                DirectoryInfo[] directories2 = tempDir.GetDirectories("*", SearchOption.AllDirectories);
                FileInfo[]      files2       = tempDir.GetFiles("*", SearchOption.AllDirectories);

                // set the maximum value of the progress bar to the sum of the directories and files
                loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(directories2.Length + files2.Length, LoadingBar.ProgressType.SetMaximumProgress));

                foreach (DirectoryInfo d in directories2)
                {
                    string shorten = Static.directory + "temp DO NOT OPEN\\MODCOPY\\";
                    string create  = baseOs.FullName + "\\" + d.FullName.Replace(shorten, string.Empty);

                    if (!Directory.Exists(create))
                    {
                        Logger.WriteLine("creating directory: " + create);
                        Directory.CreateDirectory(create);

                        // update progress
                        loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(1, LoadingBar.ProgressType.UpdateProgress));
                        if (loadingBar.displayType == LoadingBar.LoadingBarType.Detailed)
                        {
                            loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(0, "final: " + create));
                        }
                    }
                }

                // and then finally, the files
                foreach (FileInfo f in files2)
                {
                    string shorten     = Static.directory + "temp DO NOT OPEN\\MODCOPY";
                    string destination = baseOs.FullName + f.FullName.Replace(shorten, string.Empty);

                    if (!File.Exists(destination))
                    {
                        Logger.WriteLine($"copying {f.FullName} to {destination}");
                        f.CopyTo(destination, true);

                        // update progress
                        loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(1, LoadingBar.ProgressType.UpdateProgress));
                        if (loadingBar.displayType == LoadingBar.LoadingBarType.Detailed)
                        {
                            loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(0, "final: " + destination));
                        }
                    }
                }

                // done!
                loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(0, "almost done!"));

                Logger.WriteLine("finished copying files");

                Static.GetOrCreateTempDirectory().Delete(true);
                Logger.WriteLine("successfully deleted temp");

                Logger.WriteLine("activeMods.Count " + activeMods.Count);
                // write the active mods to a file
                if (File.Exists(Static.appDataPath + "activemods.molly"))
                {
                    File.Delete(Static.appDataPath + "activemods.molly");
                }
                File.WriteAllLines(Static.appDataPath + "activemods.molly", activeMods);

                Console.Beep();

                /*
                 * DialogResult dr = MessageBox.Show("All done! Would you like to launch OneShot?", string.Empty, MessageBoxButtons.YesNo);
                 * if (dr == DialogResult.Yes)
                 *  Static.LaunchOneShot();*/
                MessageBox.Show("All done!");

                loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(0, LoadingBar.ProgressType.Dispose));

                Logger.WriteLine("finished applying changes");

                Audio.Stop();

                MainForm.instance.Invoke(new Action(() => { MainForm.instance.ClearControls(true); }));
                MainForm.instance.Invoke(new Action(() => { MainForm.instance.InitStartMenu(); }));
            }
            catch (Exception ex)
            {
                ExceptionMessage.New(ex, true, "OneShot ModLoader will now close.");
                loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(0, LoadingBar.ProgressType.Forcequit));
            }
        }
Пример #11
0
        /// ===================================================================
        ///                         Direct Apply
        /// ===================================================================
        public static void DirectApply(object sender, DoWorkEventArgs e)
        {
            // get parameter from event args
            DirectApplyArgs?thingy = e.Argument as DirectApplyArgs?;

            if (thingy is null)
            {
                throw new Exception("absolutely no idea how you did that but good work");
            }

            // make local stuff from the DirectApplyArgs
            LoadingBar    loadingBar        = thingy.Value.loadingBar;
            DirectoryInfo mod               = thingy.Value.mod;
            bool          uninstallExisting = thingy.Value.uninstallExisting;

            try
            {
                DirectoryInfo baseOs = new DirectoryInfo(Static.baseOneShotPath);
                if (uninstallExisting && baseOs.Exists)
                {
                    baseOs.Delete(true);
                }
                if (!Directory.Exists(Static.baseOneShotPath))
                {
                    Directory.CreateDirectory(Static.baseOneShotPath);
                }

                string shorten = mod.FullName;

                // get the files and directories from the mod
                DirectoryInfo[] directories = mod.GetDirectories("*", SearchOption.AllDirectories);
                FileInfo[]      files       = mod.GetFiles("*", SearchOption.AllDirectories);

                // set the maximum value of the progress bar to the sum of the directories/files
                loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(directories.Length + files.Length, LoadingBar.ProgressType.SetMaximumProgress));

                loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(0, "working, please wait (via direct apply)"));

                // first, create the directories
                foreach (DirectoryInfo d in directories)
                {
                    string newDir = d.FullName.Replace(shorten, string.Empty);

                    if (!Directory.Exists(Static.baseOneShotPath + newDir))
                    {
                        Directory.CreateDirectory(Static.baseOneShotPath + newDir);
                        Logger.WriteLine($"creating directory {Static.baseOneShotPath + newDir}");

                        // update progress
                        loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(1, LoadingBar.ProgressType.UpdateProgress));
                        if (loadingBar.displayType == LoadingBar.LoadingBarType.Detailed)
                        {
                            loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(0, $"creating directory {newDir}"));
                        }
                    }
                }

                // then copy the files
                foreach (FileInfo f in files)
                {
                    string newLocation = Static.baseOneShotPath + f.FullName.Replace(shorten, string.Empty);
                    if (!File.Exists(newLocation))
                    {
                        File.Copy(f.FullName, newLocation);
                        Logger.WriteLine($"copied {f.FullName} to {newLocation}");

                        // update progress
                        loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(1, LoadingBar.ProgressType.UpdateProgress));
                        if (loadingBar.displayType == LoadingBar.LoadingBarType.Detailed)
                        {
                            loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(0, newLocation));
                        }
                    }
                }

                loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(0, LoadingBar.ProgressType.ResetProgress));

                /// ===================================================================
                ///                       Copy Base OS Stuff
                /// ===================================================================

                // if the user chose to uninstall any existing mods, we copy over the stuff from the base oneshot path too
                DirectoryInfo cool = new DirectoryInfo(Static.modsPath + "base oneshot/");
                shorten = cool.FullName;

                // get the files and directories from the mod
                DirectoryInfo[] directories2 = cool.GetDirectories("*", SearchOption.AllDirectories);
                FileInfo[]      files2       = cool.GetFiles("*", SearchOption.AllDirectories);

                // set the maximum value of the progress bar to the sum of the directories/files
                loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(directories.Length + files.Length, LoadingBar.ProgressType.SetMaximumProgress));

                if (uninstallExisting)
                {
                    // the directories
                    foreach (DirectoryInfo d in directories2)
                    {
                        string newDir = d.FullName.Replace(shorten, string.Empty);
                        if (!Directory.Exists(Static.baseOneShotPath + "/" + newDir))
                        {
                            Logger.WriteLine("creating directory " + Directory.CreateDirectory(Static.baseOneShotPath + "/" + newDir).ToString());

                            // update progress
                            loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(1, LoadingBar.ProgressType.UpdateProgress));
                            if (loadingBar.displayType == LoadingBar.LoadingBarType.Detailed)
                            {
                                loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(0, $"final: creating directory: {newDir}"));
                            }
                        }
                    }

                    // the files
                    foreach (FileInfo f in files2)
                    {
                        string newLocation = Static.baseOneShotPath + "/" + f.FullName.Replace(shorten, string.Empty);
                        if (!File.Exists(newLocation))
                        {
                            File.Copy(f.FullName, newLocation);
                            Logger.WriteLine($"copying {f.FullName} to {newLocation}");

                            // update progress
                            loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(1, LoadingBar.ProgressType.UpdateProgress));
                            if (loadingBar.displayType == LoadingBar.LoadingBarType.Detailed)
                            {
                                loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(0, $"final: {newLocation}"));
                            }
                        }
                    }

                    // finally, write to the active mods file
                    List <string> currentlyActive = File.ReadAllLines(Static.appDataPath + "activemods.molly").ToList <string>();
                    if (File.Exists(Static.appDataPath + "activemods.molly")) // first, delete the file if it exists
                    {
                        File.Delete(Static.appDataPath + "activemods.molly");
                    }

                    // then insert the name of the mod at the beginning of a new collection
                    if (!uninstallExisting)
                    {
                        currentlyActive.Insert(0, mod.Name);
                    }
                    else
                    {
                        currentlyActive = new List <string>
                        {
                            mod.Name,
                            "base oneshot"
                        };
                    }
                    // write the file
                    File.WriteAllLines(Static.appDataPath + "activemods.molly", currentlyActive);
                }

                Console.Beep();

                /*
                 * DialogResult dr = MessageBox.Show("All done! Would you like to launch OneShot?", string.Empty, MessageBoxButtons.YesNo);
                 * if (dr == DialogResult.Yes)
                 *  Static.LaunchOneShot();*/
                MessageBox.Show("All done!");

                Audio.Stop();

                if (OCIForm.ghajshdfjhjahskgkdjfahajsldkfGoodVariableName)
                {
                    loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(0, LoadingBar.ProgressType.ForcequitOCI));
                }
                else
                {
                    loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(0, LoadingBar.ProgressType.ReturnToMenu));
                }
            }
            catch (Exception ex)
            {
                ExceptionMessage.New(ex, true, "OneShot ModLoader will now close.");

                // force quit
                if (!(OCIForm.instance is null))
                {
                    loadingBar.ReportProgress(sender, new ProgressChangedEventArgs(0, LoadingBar.ProgressType.ForcequitOCI));
                }