Ejemplo n.º 1
0
        public ModMaker()
        {
            InitializeComponent();
            KFreonTPFTools3.UpgradeSettings();

            // KFreon: Set number of threads if necessary
            if (Properties.Settings.Default.NumThreads == 0)
            {
                Properties.Settings.Default.NumThreads = KFreonLib.Misc.Methods.SetNumThreads(false);
                SaveProperties();
            }

            StatusUpdater = new TextUpdater(MainStatusLabel, BottomStrip);
            MainProgBar = new ProgressBarChanger(BottomStrip, MainProgressBar);
            backbone = new BackBone(() => { gooey.ChangeState(false); return true; }, () => { gooey.ChangeState(true); return true; });

            currentInstance = this;

            MainSplitter.SplitterDistance = MainSplitter.Width;
            MainContextStrip.Height = 0;
            PCCSplitter.SplitterDistance = PCCSplitter.Height;

            Initialise(false);
            KFreonLib.Scripting.ModMaker.Initialise();

            SearchTextBox.KeyDown += SearchTextBox_KeyDown;
            SearchTextBox.MouseDown += SearchTextBox_MouseDown;
            SearchTextBox.LostFocus += SearchTextBox_LostFocus;

            SearchTextBox.ForeColor = Color.Gray;
            SearchTextBox.Text = EmptyText;

            // KFreon: Display version
            VersionLabel.Text = "Version: " + Assembly.GetExecutingAssembly().GetName().Version.ToString();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Create a .mod job from current TPF texture object.
 /// </summary>
 /// <param name="ExecFolder">Path to ME3Explorer \exec\ folder.</param>
 /// <param name="pathBIOGame">Path to BIOGame.</param>
 /// <returns>New ModJob created from current TPF texture object.</returns>
 public ModMaker.ModJob CreateModJob(string ExecFolder, string pathBIOGame)
 {
     ModMaker.ModJob job = new ModMaker.ModJob();
     job.Name   = (NumMips > 1 ? "Upscale (with MIP's): " : "Upscale: ") + TexName;
     job.Script = ModMaker.GenerateTextureScript(ExecFolder, Files, ExpIDs, TexName, GameVersion, pathBIOGame);
     job.data   = Extract(null, true);
     return(job);
 }
Ejemplo n.º 3
0
        private void Form_Closing(object sender, FormClosingEventArgs e)
        {
            if (CancelationButton.Visible)
            {
                if (MessageBox.Show("Background tasks are running. Are you sure you want to close?", "Really sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes)
                {
                    cts.Cancel();

                    // KFreon: Wait for background tasks to be cancelled
                    Task.Run(() =>
                    {
                        while (!MainStatusLabel.Text.Contains("Cancelled"))
                            System.Threading.Thread.Sleep(100);

                        File.Delete(ExecFolder + "ModData.cache");
                        DebugOutput.PrintLn("-----Execution of ModMaker closing...-----");
                        KFreonLib.Scripting.ModMaker.JobList.Clear();
                        currentInstance = null;
                        this.Close();
                    });
                }
                e.Cancel = true;
            }
            KFreonLib.Scripting.ModMaker.JobList.Clear();
            DebugOutput.PrintLn("-----Execution of ModMaker closing...-----");
            currentInstance = null;
        }
Ejemplo n.º 4
0
        public static async Task<ModMaker> GetCurrentInstance()
        {
            if (currentInstance == null)
            {
                currentInstance = new ModMaker();
                currentInstance.Show();


                await Task.Run(() =>
                {
                    System.Threading.Thread.Sleep(400);
                    while (!currentInstance.LoadButton.Enabled)
                        System.Threading.Thread.Sleep(50);
                });
            }
            return currentInstance;
        }
Ejemplo n.º 5
0
        private void Form1_Load(object sender, EventArgs e)
        {
            taskbar.strip = toolStrip1; //this be a toolstrip reference to class taskbar            
            string loc = Path.GetDirectoryName(Application.ExecutablePath);
            lang = new Languages(loc + "\\exec\\languages.xml", 0);
            lang.SetLang(this);
            string[] args = Environment.GetCommandLineArgs();
            if (args.Length > 1)
            {
                if (args[1].Equals("-version-switch-from") && args.Length == 3)
                {

                    string version = Assembly.GetExecutingAssembly().GetName().Version.Build.ToString();
                    if (version.Equals(args[2]))
                    {
                        MessageBox.Show("Version switched to is the same as the one you had before the switch.");
                    } else
                    {
                        MessageBox.Show("Version switched: "+args[2]+" => "+version);
                    }
                } else
                //automation
                if (args[1].Equals("-dlcinject") || args[1].Equals("-dlcextract"))
                {
                    //autostart DLC editor 2 (used by FemShep's Mod Manager 3/3.2)
                    //saves a little duplicate code
                    dLCEditor2ToolStripMenuItem.PerformClick();
                    return;
                } else
                if (args[1].Equals("-toceditorupdate"))
                {
                    //autostart the TOCEditor (used by FemShep's Mod Manager 3)
                    //saves a little duplicate code
                    tOCbinEditorToolStripMenuItem.PerformClick();
                    return;
                } else
                if (args[1].Equals("-decompresspcc"))
                {
                    //autostart the TOCEditor (used by FemShep's Mod Manager 3.2)
                    //saves a little duplicate code
                    pCCRepackerToolStripMenuItem.PerformClick();
                    return;
                } else
                if (args[1].Equals("--help") || args[1].Equals("-h")){
                    String commandLineHelp = "ME3Explorer Command Line Options\n";
                    commandLineHelp += " -dlcinject DLC.sfar SearchTerm PathToNewFile [SearchTerm2 PathToNewFile2]...\n";
                    commandLineHelp += "     Automates injecting pairs of files into a .sfar file using DLCEditor2. SearchTerm is a value you would type into the searchbox with the first result being the file that will be replaced.\n\n";
                    commandLineHelp += " -dlcextract DLC.sfar SearchTerm ExtractionPath\n";
                    commandLineHelp += "     Automates DLCEditor2 to extract the specified SearchTerm. SearchTerm is a value you would type into the searchbox with the first result being the file that will be extracted. The file is extracted to the specied ExtractionPath.\n\n";
                    commandLineHelp += " -toceditorupdate PCConsoleTOCFile.bin SearchTerm size\n";
                    commandLineHelp += "     Automates updating a single entry in a TOC file.  SearchTerm is a value you would type into the Searchbox with the first result being the file that will be updated. Size is the new size of the file, in bytes. Interface shows up if the file is not in the TOC.\n\n";
                    commandLineHelp += " -decompresspcc pccPath.pcc decompressedPath.pcc\n";
                    commandLineHelp += "     Automates PCCRepacker to decompress a file to the new location.\n\n";
                    System.Console.WriteLine(commandLineHelp);
                    Application.Exit();
                    return;
                }
               
                string ending = Path.GetExtension(args[1]).ToLower();
                switch (ending)
                {
                    case ".pcc":
                        PCCEditor2 editor = new PCCEditor2();
                        editor.MdiParent = this;
                        editor.Show();
                        editor.WindowState = FormWindowState.Maximized;
                        editor.LoadFile(args[1]);
                        break;
                    case ".txt":
                        ScriptCompiler sc = new ScriptCompiler();
                        sc.MdiParent = this;
                        sc.rtb1.LoadFile(args[1]);
                        sc.Compile();
                        sc.Show();
                        sc.WindowState = FormWindowState.Maximized;
                        break;
                    case ".mod":
                        ModMaker m = new ModMaker();
                        m.Show();
                        string[] s = new string[1];
                        s[0] = args[1];
                        //m.LoadMods(s);
                        m.WindowState = FormWindowState.Maximized;
                        break;
                }
            }
        }
Ejemplo n.º 6
0
 private void modMakerToolStripMenuItem_Click_1(object sender, EventArgs e)
 {
     ModMaker modmaker = new ModMaker();
     modmaker.Show();
 }
Ejemplo n.º 7
0
 private void modMakerToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ModMaker modmaker = new ModMaker();
     //OpenMaximized(modmaker);
     modmaker.Show();
     taskbar.AddTool(modmaker, Properties.Resources.modmaker_64x64, true);
 }
Ejemplo n.º 8
0
        private void Form1_Load(object sender, EventArgs e)
        {
            taskbar.strip = toolStrip1; //this be a toolstrip reference to class taskbar
            string loc = Path.GetDirectoryName(Application.ExecutablePath);
            lang = new Languages(loc + "\\exec\\languages.xml", 0);
            lang.SetLang(this);
            string[] args = Environment.GetCommandLineArgs();
            if (args.Length > 1)
            {
                AttachConsole(ATTACH_PARENT_PROCESS);
                if (args[1].Equals("-version-switch-from") && args.Length == 3)
                {

                    string version = Assembly.GetExecutingAssembly().GetName().Version.Build.ToString();
                    if (version.Equals(args[2]))
                    {
                        MessageBox.Show("Version switched to is the same as the one you had before the switch.");
                    } else
                    {
                        MessageBox.Show("Version switched: "+args[2]+" => "+version);
                    }
                } else
                //automation
                if (args[1].Equals("-dlcinject") || args[1].Equals("-dlcextract") || args[1].Equals("-dlcaddfiles") || args[1].Equals("-dlcremovefiles") || args[1].Equals("-dlcunpack") || args[1].Equals("-dlcunpack-nodebug"))
                {
                    //autostart DLC editor 2 (used by FemShep's Mod Manager 3/3.1+)
                    //saves a little duplicate code
                    dLCEditor2ToolStripMenuItem.PerformClick();
                    return;
                } else
                if (args[1].Equals("-toceditorupdate"))
                {
                    //autostart the TOCEditor (used by FemShep's Mod Manager 3)
                    //saves a little duplicate code
                    tOCbinEditorToolStripMenuItem.PerformClick();
                    return;
                }
                if (args[1].Equals("-autotoc"))
                {
                    //autostart the AutoTOC Tool (uses a path) (used by FemShep's Mod Manager 3)
                    //saves a little duplicate code
                    autoTOCToolStripMenuItem.PerformClick();
                    return;
                }
                else
                if (args[1].Equals("-decompresspcc"))
                {
                    //autostart the TOCEditor (used by FemShep's Mod Manager 3.2)
                    //saves a little duplicate code
                    pCCRepackerToolStripMenuItem.PerformClick();
                    return;
                } else
                if (args[1].Equals("--help") || args[1].Equals("-h") || args[1].Equals("/?"))
                {
                    String[] version = Assembly.GetExecutingAssembly().GetName().Version.ToString().Split('.');
                    String commandLineHelp = "\nME3Explorer r"+version[2]+" Command Line Options\n";
                    commandLineHelp += " -decompresspcc pccPath.pcc decompressedPath.pcc\n";
                    commandLineHelp += "     Automates PCCRepacker to decompress a pcc to the new location.\n\n";
                    commandLineHelp += " -dlcinject DLC.sfar SearchTerm PathToNewFile [SearchTerm2 PathToNewFile2]...\n";
                    commandLineHelp += "     Automates injecting pairs of files into a .sfar file using DLCEditor2. SearchTerm is a value you would type into the searchbox with the first result being the file that will be replaced.\n\n";
                    commandLineHelp += " -dlcextract DLC.sfar SearchTerm ExtractionPath\n";
                    commandLineHelp += "     Automates DLCEditor2 to extract the specified SearchTerm. SearchTerm is a value you would type into the searchbox with the first result being the file that will be extracted. The file is extracted to the specied ExtractionPath.\n\n";
                    commandLineHelp += " -dlcaddfiles DLC.sfar InternalPath NewFile [InternalPath2 NewFile2]...\n";
                    commandLineHelp += "     Automates DLCEditor2 to add the specified new files. InternalPath is the internal path in the SFAR the file NewFile will be placed at.\n\n";
                    commandLineHelp += " -dlcremovefiles DLC.sfar SearchTerm [SearchTerm2]...\n";
                    commandLineHelp += "     Automates removing a file or list of files from a DLC. SearchTerm is a value you would type into the Searchbox with the first result being the file that will be removed.\n\n";
                    commandLineHelp += " -dlcunpack DLC.sfar Unpackpath\n";
                    commandLineHelp += "     Automates unpacking an SFAR file to the specified directory. Shows the debug interface to show progress. To unpack a game DLC for use by the game, unpack to the Mass Effect 3 directory. Unpacking Patch_001.sfar will cause the game to crash at startup.\n\n";
                    commandLineHelp += " -dlcunpack-nodebug DLC.sfar Unpackpath\n";
                    commandLineHelp += "     Same as -dlcunpack but does not show the debugging interface.\n\n";
                    commandLineHelp += " -toceditorupdate PCConsoleTOCFile.bin SearchTerm size\n";
                    commandLineHelp += "     Automates DLCEditor2 to extract the specified SearchTerm. SearchTerm is a value you would type into the searchbox with the first result being the file that will be extracted. The file is extracted to the specied ExtractionPath.\n\n";
                    System.Console.WriteLine(commandLineHelp);
                    Environment.Exit(0);
                    Application.Exit();
                    return;
                }

                string ending = Path.GetExtension(args[1]).ToLower();
                switch (ending)
                {
                    case ".pcc":
                        PCCEditor2 editor = new PCCEditor2();
                        editor.MdiParent = this;
                        editor.Show();
                        editor.WindowState = FormWindowState.Maximized;
                        editor.LoadFile(args[1]);
                        break;
                    case ".txt":
                        ScriptCompiler sc = new ScriptCompiler();
                        sc.MdiParent = this;
                        sc.rtb1.LoadFile(args[1]);
                        sc.Compile();
                        sc.Show();
                        sc.WindowState = FormWindowState.Maximized;
                        break;
                    case ".mod":
                        ModMaker m = new ModMaker();
                        m.Show();
                        string[] s = new string[1];
                        s[0] = args[1];
                        //m.LoadMods(s);
                        m.WindowState = FormWindowState.Maximized;
                        break;
                }
            }

            if (!String.IsNullOrEmpty(Properties.Settings.Default.ME3InstallDir))
                ME3Directory.GamePath(Properties.Settings.Default.ME3InstallDir);
            if (!String.IsNullOrEmpty(Properties.Settings.Default.ME2InstallDir))
                ME2Directory.GamePath(Properties.Settings.Default.ME2InstallDir);
            if (!String.IsNullOrEmpty(Properties.Settings.Default.ME1InstallDir))
                ME1Directory.GamePath(Properties.Settings.Default.ME1InstallDir);

            var vers = Assembly.GetExecutingAssembly().GetName().Version.ToString().Split('.');
            versionToolStripMenuItem.Text += "0110 (r" + vers[2] + ")";
            versionToolStripMenuItem.Tag = "versionItem";
            menuStrip1.Renderer = new NoHighlightRenderer();
        }