Пример #1
0
        private void tOCbinEditorToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            TOCeditor tocedit = new TOCeditor();

            lang.SetLang(tocedit);
            tocedit.MdiParent   = this;
            tocedit.WindowState = FormWindowState.Maximized;
            tocedit.Show();
            taskbar.AddTool(tocedit, Properties.Resources.TOCbin_editor_64x64);
        }
Пример #2
0
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string         path        = string.Empty;
            SaveFileDialog FileDialog1 = new SaveFileDialog();

            FileDialog1.Filter          = "*.cnd|*.cnd";
            BitConverter.IsLittleEndian = true;
            if (FileDialog1.ShowDialog() == DialogResult.OK)
            {
                path = FileDialog1.FileName;
                FileStream   fileStream = new FileStream(path, FileMode.Create, FileAccess.Write);
                MemoryStream m          = new MemoryStream();
                m.Write(BitConverter.GetBytes((uint)0x434F4E44), 0, 4);
                m.Write(BitConverter.GetBytes((int)1), 0, 4);
                m.Write(BitConverter.GetBytes((Int16)UnknownInt16), 0, 2);
                m.Write(BitConverter.GetBytes((Int16)Entry.Count), 0, 2);
                for (int i = 0; i < Entry.Count; i++)
                {
                    Entries en = Entry[i];
                    m.Write(BitConverter.GetBytes(en.id), 0, 4);
                    m.Write(BitConverter.GetBytes(en.off), 0, 4);
                }
                for (int i = 0; i < Entry.Count; i++)
                {
                    Entries en = Entry[i];
                    en.off   = (int)m.Position;
                    Entry[i] = en;
                    m.Write(en.data, 0, en.size);
                }
                int pos = 16;
                for (int i = 0; i < Entry.Count; i++)
                {
                    Entries en = Entry[i];
                    m.Seek(pos, SeekOrigin.Begin);
                    m.Write(BitConverter.GetBytes((uint)en.off), 0, 4);
                    pos += 8;
                }
                fileStream.Write(m.ToArray(), 0, (int)m.Length);
                fileStream.Close();

                TOCeditor tc = new TOCeditor();
                tc.MdiParent = this.ParentForm;
                tc.Show();
                string fname = Path.GetFileName(path);
                if (!tc.UpdateFile(fname, (uint)memsize))
                {
                    MessageBox.Show("Didn't found entry!");
                }
                tc.Close();
                LoadFile(path);
            }
        }
Пример #3
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.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)
                    TOCeditor tocedit = new TOCeditor();
                    lang.SetLang(tocedit);
                    tocedit.MdiParent   = this;
                    tocedit.WindowState = FormWindowState.Maximized;
                    tocedit.Show();
                    taskbar.AddTool(tocedit, Properties.Resources.TOCbin_editor_64x64);
                    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();
                    string commandLineHelp = "\nME3Explorer v" + version + " 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":    // KFreon: Disabled for now due to the fact that it doesn't do the DLC check first
                     *  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();

            versionToolStripMenuItem.Text += vers;
            versionToolStripMenuItem.Tag   = "versionItem";
            menuStrip1.Renderer            = new NoHighlightRenderer();

            if (!disableDLCCheckOnStartupToolStripMenuItem.Checked)
            {
                DoDLCCheck();
            }
        }
Пример #4
0
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string path = string.Empty;
            SaveFileDialog FileDialog1 = new SaveFileDialog();
            FileDialog1.Filter = "*.cnd|*.cnd";
            BitConverter.IsLittleEndian = true;
            if (FileDialog1.ShowDialog() == DialogResult.OK)
            {
                path = FileDialog1.FileName;
                FileStream fileStream = new FileStream(path, FileMode.Create, FileAccess.Write);
                MemoryStream m = new MemoryStream();
                m.Write(BitConverter.GetBytes((uint)0x434F4E44), 0, 4);
                m.Write(BitConverter.GetBytes((int)1), 0, 4);
                m.Write(BitConverter.GetBytes((Int16)UnknownInt16), 0, 2);
                m.Write(BitConverter.GetBytes((Int16)Entry.Count), 0, 2);
                for (int i = 0; i < Entry.Count; i++)
                {
                    Entries en = Entry[i];
                    m.Write(BitConverter.GetBytes(en.id), 0, 4);
                    m.Write(BitConverter.GetBytes(en.off), 0, 4);
                }
                for (int i = 0; i < Entry.Count; i++)
                {
                    Entries en = Entry[i];
                    en.off = (int)m.Position;
                    Entry[i] = en;
                    m.Write(en.data, 0, en.size);
                }
                int pos = 16;
                for (int i = 0; i < Entry.Count; i++)
                {
                    Entries en = Entry[i];
                    m.Seek(pos, SeekOrigin.Begin);
                    m.Write(BitConverter.GetBytes((uint)en.off), 0, 4);
                    pos += 8;
                }
                fileStream.Write(m.ToArray(), 0, (int)m.Length);
                fileStream.Close();

                TOCeditor tc = new TOCeditor();
                tc.MdiParent = this.ParentForm;
                tc.Show();
                string fname = Path.GetFileName(path);
                if (!tc.UpdateFile(fname, (uint)memsize))
                    MessageBox.Show("Didn't found entry!");
                tc.Close();
                LoadFile(path);
            }
        }
Пример #5
0
 private void tOCbinEditorToolStripMenuItem_Click_1(object sender, EventArgs e)
 {
     TOCeditor tocedit = new TOCeditor();
     lang.SetLang(tocedit);
     tocedit.MdiParent = this;
     tocedit.WindowState = FormWindowState.Maximized;
     tocedit.Show();
     taskbar.AddTool(tocedit, imageList1.Images[3]);
 }
Пример #6
0
 private void tOCbinEditorToolStripMenuItem_Click_1(object sender, EventArgs e)
 {
     TOCeditor tocedit = new TOCeditor();
     lang.SetLang(tocedit);
     tocedit.MdiParent = this;
     tocedit.WindowState = FormWindowState.Maximized;
     tocedit.Show();
     taskbar.AddTool(tocedit, Properties.Resources.TOCbin_editor_64x64);
 }