Exemple #1
0
        private void extractToolStripMenuItem_Click(object sender, EventArgs e)
        {
            folderBrowserDialog.SelectedPath = Settings.FableDirectory;

            if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                BBBExtractor extractor = new BBBExtractor(
                    myBBB, folderBrowserDialog.SelectedPath);

                FormProcess form = new FormProcess(extractor);

                form.ShowDialog();

                form = null;
            }
        }
        private bool Fix()
        {
            string pathLevels = Settings.LevelsDirectory;

            try
            {
                string tasks = "";

                if (!CheckTngLev())
                {
                    // Need to extract this stuff.

                    BBBFile wad = new BBBFile();

                    wad.Open(pathLevels + "FinalAlbion.wad", null);

                    BBBExtractor bbb = new BBBExtractor(wad, Settings.FableDirectory);

                    FormProcess form = new FormProcess(bbb);

                    form.Text = "Extracting...";

                    form.ShowDialog();

                    form.Dispose();

                    wad.Close();

                    tasks += "\tExtracted FinalAlbion.WAD.\r\n";
                }

                if (File.Exists(pathLevels + "FinalAlbion.wad"))
                {
                    // Make sure this doesn't exist.
                    File.Delete(pathLevels + "_FinalAlbion.wad");

                    File.Move(
                        pathLevels + "FinalAlbion.wad",
                        pathLevels + "_FinalAlbion.wad");

                    tasks += "\tRenamed FinalAlbion.WAD.\r\n";
                }

                if (!CheckUserStIni())
                {
                    if (FixUserStIni())
                    {
                        tasks += "\tPatched userst.ini.\r\n";
                    }
                    else
                    {
                        throw new Exception("Failed to update userst.ini.");
                    }
                }

                InfoMessage(
                    "Modding environment successfully updated!\r\n" +
                    "Following tasks were completed:\r\n" +
                    tasks);

                return(true);
            }
            catch (Exception ex)
            {
                ErrorMessage(ex.ToString());
            }

            return(false);
        }