Пример #1
0
        private void unpackSFARToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AutoTOC.AutoTOC toc = new AutoTOC.AutoTOC();
            if (DLC == null || DLC.Files == null)
                return;
            string result = "pcc; tfc; afc; cnd; tlk; bin; bik; dlc";
            string unpackFolder;
            if (!automated) //if automated, just do everything. otherwise prompt user
            {
                Microsoft.VisualBasic.Interaction.InputBox("Please enter pattern for unpacking, keep default to unpack everything.", "ME3 Explorer", "pcc; tfc; afc; cnd; tlk; bin; bik; dlc", 0, 0);

                if (result == "")
                    return;
                DebugOutput.PrintLn("result : " + result);
                FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
                fbd.Description = "Choose a folder to unpack this DLC to. Unpacking may take a few minutes. To unpack the files to their proper folder choose the Mass Effect 3 directory.";
                fbd.SelectedPath = Directory.GetParent(DLC.MyFileName).FullName;
                DialogResult dresult = fbd.ShowDialog();
                if (dresult != DialogResult.OK)
                {
                    return;
                }
                unpackFolder = fbd.SelectedPath;
            } else
            {
                unpackFolder = autoUnpackFolder;
            }
            if (!unpackFolder.EndsWith("\\"))
                unpackFolder = unpackFolder + "\\";
            DebugOutput.PrintLn("Extracting DLC to : " + unpackFolder);

            result = result.Trim();
            if (result.EndsWith(";"))
                result = result.Substring(0, result.Length - 1);
            string[] patt = result.Split(';');
            string file = DLC.MyFileName;                   //full path
            string t1 = Path.GetDirectoryName(file);        //cooked
            string t2 = Path.GetDirectoryName(t1);          //DLC_Name
            string t3 = Path.GetDirectoryName(t2);          //DLC
            string t4 = Path.GetDirectoryName(t3);          //BioGame
            DebugOutput.PrintLn("DLC name : " + t2);
            if (DLC.Files.Length > 1)
            {
                List<int> Indexes = new List<int>();
                for (int i = 0; i < DLC.Files.Length; i++)
                {
                    string DLCpath = DLC.Files[i].FileName;
                    for (int j = 0; j < patt.Length; j++)
                        if (DLCpath.ToLower().EndsWith(patt[j].Trim().ToLower()) && patt[j].Trim().ToLower() != "")
                        {
                            string relPath = GetRelativePath(DLCpath);
                            string outpath = unpackFolder + relPath;
                            DebugOutput.PrintLn("Extracting file #" + i.ToString("d4") + ": " + outpath);
                            if (!Directory.Exists(Path.GetDirectoryName(outpath)))
                                Directory.CreateDirectory(Path.GetDirectoryName(outpath));
                            using (FileStream fs = new FileStream(outpath, FileMode.Create))
                                DLC.DecompressEntry(i).WriteTo(fs);
                            Indexes.Add(i);
                            Application.DoEvents();
                            break;
                        }
                }
                DLC.DeleteEntry(Indexes);
            }

            // AutoTOC
            DebugOutput.PrintLn("Updating DLC's PCConsoleTOC.bin");
            List<string> FileNames = toc.GetFiles(t2 + "\\");
            List<string> tet = new List<string>(t2.Split('\\'));
            string remov = String.Join("\\", tet.ToArray());
            for (int i = 0; i < FileNames.Count; i++)
                FileNames[i] = FileNames[i].Substring(remov.Length + 1);
            string[] ts = t2.Split('\\');
            tet.Clear();
            tet.AddRange(ts);
            string basepath = String.Join("\\", tet.ToArray()) + '\\';
            string tocfile = t2 + "\\PCConsoleTOC.bin";
            toc.CreateTOC(basepath, tocfile, FileNames.ToArray());
            if (!automated)
            {
                MessageBox.Show("SFAR Unpacked.");
            }
        }
Пример #2
0
        private void unpackSFAR(DLCPackage DLC)
        {
            AutoTOC.AutoTOC toc = new AutoTOC.AutoTOC();
            if (DLC == null || DLC.Files == null)
                return;
            string result = "pcc; tfc; afc; cnd; tlk; bin; bik; dlc";
            if (result == "")
                return;
            result = result.Trim();
            if (result.EndsWith(";"))
                result = result.Substring(0, result.Length - 1);
            string[] patt = result.Split(';');
            string file = DLC.MyFileName;                   //full path
            string t1 = Path.GetDirectoryName(file);        //cooked
            string t2 = Path.GetDirectoryName(t1);          //DLC_Name
            string t3 = Path.GetDirectoryName(t2);          //DLC
            string t4 = Path.GetDirectoryName(t3);          //BioGame
            string gamebase = Path.GetDirectoryName(t4);    //Mass Effect3
            DebugOutput.PrintLn("Extracting DLC with gamebase : " + gamebase);
            DebugOutput.PrintLn("DLC name : " + t2);
            if (DLC.Files.Length > 1)
            {
                List<int> Indexes = new List<int>();
                for (int i = 0; i < DLC.Files.Length; i++)
                {
                    string DLCpath = DLC.Files[i].FileName;
                    for (int j = 0; j < patt.Length; j++)
                        if (DLCpath.ToLower().EndsWith(patt[j].Trim().ToLower()) && patt[j].Trim().ToLower() != "")
                        {
                            string relPath = GetRelativePath(DLCpath);
                            string outpath = gamebase + relPath;
                            DebugOutput.PrintLn("Extracting file #" + i.ToString("d4") + ": " + outpath);
                            if (!Directory.Exists(Path.GetDirectoryName(outpath)))
                                Directory.CreateDirectory(Path.GetDirectoryName(outpath));

                            if (!File.Exists(outpath))
                                using (FileStream fs = new FileStream(outpath, FileMode.Create))
                                    DLC.DecompressEntry(i).WriteTo(fs);
                            Indexes.Add(i);
                            Application.DoEvents();
                            break;
                        }
                }
                DLC.DeleteEntry(Indexes);
            }

            // AutoTOC
            DebugOutput.PrintLn("Updating DLC's PCConsoleTOC.bin");
            List<string> FileNames = toc.GetFiles(t2 + "\\");
            List<string> tet = new List<string>(t2.Split('\\'));
            string remov = String.Join("\\", tet.ToArray());
            for (int i = 0; i < FileNames.Count; i++)
                FileNames[i] = FileNames[i].Substring(remov.Length + 1);
            string[] ts = t2.Split('\\');
            tet.Clear();
            tet.AddRange(ts);
            string basepath = String.Join("\\", tet.ToArray()) + '\\';
            string tocfile = t2 + "\\PCConsoleTOC.bin";
            toc.CreateTOC(basepath, tocfile, FileNames.ToArray());
            DebugOutput.PrintLn("DLC Done.");
        }
Пример #3
0
        private void unpackSFAR(DLCPackage DLC)
        {
            AutoTOC.AutoTOC toc = new AutoTOC.AutoTOC();
            if (DLC == null || DLC.Files == null)
            {
                return;
            }
            string result = "pcc; tfc; afc; cnd; tlk; bin; bik; dlc";

            if (result == "")
            {
                return;
            }
            result = result.Trim();
            if (result.EndsWith(";"))
            {
                result = result.Substring(0, result.Length - 1);
            }
            string[] patt     = result.Split(';');
            string   file     = DLC.MyFileName;              //full path
            string   t1       = Path.GetDirectoryName(file); //cooked
            string   t2       = Path.GetDirectoryName(t1);   //DLC_Name
            string   t3       = Path.GetDirectoryName(t2);   //DLC
            string   t4       = Path.GetDirectoryName(t3);   //BioGame
            string   gamebase = Path.GetDirectoryName(t4);   //Mass Effect3

            DebugOutput.PrintLn("Extracting DLC with gamebase : " + gamebase);
            DebugOutput.PrintLn("DLC name : " + t2);
            if (DLC.Files.Length > 1)
            {
                List <int> Indexes = new List <int>();
                for (int i = 0; i < DLC.Files.Length; i++)
                {
                    string DLCpath = DLC.Files[i].FileName;
                    for (int j = 0; j < patt.Length; j++)
                    {
                        if (DLCpath.ToLower().EndsWith(patt[j].Trim().ToLower()) && patt[j].Trim().ToLower() != "")
                        {
                            string relPath = GetRelativePath(DLCpath);
                            string outpath = gamebase + relPath;
                            DebugOutput.PrintLn("Extracting file #" + i.ToString("d4") + ": " + outpath);
                            if (!Directory.Exists(Path.GetDirectoryName(outpath)))
                            {
                                Directory.CreateDirectory(Path.GetDirectoryName(outpath));
                            }

                            if (!File.Exists(outpath))
                            {
                                using (FileStream fs = new FileStream(outpath, FileMode.Create))
                                    DLC.DecompressEntry(i).WriteTo(fs);
                            }
                            Indexes.Add(i);
                            Application.DoEvents();
                            break;
                        }
                    }
                }
                DLC.DeleteEntry(Indexes);
            }

            // AutoTOC
            DebugOutput.PrintLn("Updating DLC's PCConsoleTOC.bin");
            List <string> FileNames = toc.GetFiles(t2 + "\\");
            List <string> tet       = new List <string>(t2.Split('\\'));
            string        remov     = String.Join("\\", tet.ToArray());

            for (int i = 0; i < FileNames.Count; i++)
            {
                FileNames[i] = FileNames[i].Substring(remov.Length + 1);
            }
            string[] ts = t2.Split('\\');
            tet.Clear();
            tet.AddRange(ts);
            string basepath = String.Join("\\", tet.ToArray()) + '\\';
            string tocfile  = t2 + "\\PCConsoleTOC.bin";

            toc.CreateTOC(basepath, tocfile, FileNames.ToArray());
            DebugOutput.PrintLn("DLC Done.");
        }
Пример #4
0
        private void unpackSFARToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AutoTOC.AutoTOC toc = new AutoTOC.AutoTOC();
            if (DLC == null || DLC.Files == null)
                return;
            string result = Microsoft.VisualBasic.Interaction.InputBox("Please enter pattern for unpacking, keep default to unpack all", "ME3 Explorer", "pcc; tfc; afc; cnd; tlk; bin; bik; dlc", 0, 0);
            if (result == "")
                return;
            DebugOutput.PrintLn("result : " + result);
            result = result.Trim();
            if (result.EndsWith(";"))
                result = result.Substring(0, result.Length - 1);
            string[] patt = result.Split(';');
            string file = DLC.MyFileName;                   //full path
            string t1 = Path.GetDirectoryName(file);        //cooked
            string t2 = Path.GetDirectoryName(t1);          //DLC_Name
            string t3 = Path.GetDirectoryName(t2);          //DLC
            string t4 = Path.GetDirectoryName(t3);          //BioGame
            string gamebase = Path.GetDirectoryName(t4);    //Mass Effect3
            DebugOutput.PrintLn("Extracting DLC with gamebase : " + gamebase);
            DebugOutput.PrintLn("DLC name : " + t2);
            if (DLC.Files.Length > 1)
            {
                List<int> Indexes = new List<int>();
                for (int i = 0; i < DLC.Files.Length; i++)
                {
                    string DLCpath = DLC.Files[i].FileName;
                    for (int j = 0; j < patt.Length; j++)
                        if (DLCpath.ToLower().EndsWith(patt[j].Trim().ToLower()) && patt[j].Trim().ToLower() != "")
                        {
                            string relPath = GetRelativePath(DLCpath);
                            string outpath = gamebase + relPath;
                            DebugOutput.PrintLn("Extracting file #" + i.ToString("d4") + ": " + outpath);
                            if (!Directory.Exists(Path.GetDirectoryName(outpath)))
                                Directory.CreateDirectory(Path.GetDirectoryName(outpath));
                            using (FileStream fs = new FileStream(outpath, FileMode.CreateNew))
                                DLC.DecompressEntry(i).WriteTo(fs);
                            Indexes.Add(i);
                            Application.DoEvents();
                            break;
                        }
                }
                DLC.DeleteEntry(Indexes);
            }

            // AutoTOC
            DebugOutput.PrintLn("Updating DLC's PCConsoleTOC.bin");
            List<string> FileNames = toc.GetFiles(t2 + "\\");
            List<string> tet = new List<string>(t2.Split('\\'));
            string remov = String.Join("\\", tet.ToArray());
            for (int i = 0; i < FileNames.Count; i++)
                FileNames[i] = FileNames[i].Substring(remov.Length + 1);
            string[] ts = t2.Split('\\');
            tet.Clear();
            tet.AddRange(ts);
            string basepath = String.Join("\\", tet.ToArray()) + '\\';
            string tocfile = t2 + "\\PCConsoleTOC.bin";
            toc.CreateTOC(basepath, tocfile, FileNames.ToArray());
            MessageBox.Show("SFAR Unpacked.");
        }
Пример #5
0
        private void unpackSFARToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AutoTOC.AutoTOC toc = new AutoTOC.AutoTOC();
            if (DLC == null || DLC.Files == null)
            {
                return;
            }
            string result = "pcc; tfc; afc; cnd; tlk; bin; bik; dlc";
            string unpackFolder;

            if (!automated) //if automated, just do everything. otherwise prompt user
            {
                result = Microsoft.VisualBasic.Interaction.InputBox("Please enter pattern for unpacking, keep default to unpack everything.", "ME3 Explorer", "pcc; tfc; afc; cnd; tlk; bin; bik; dlc", 0, 0);

                if (result == "")
                {
                    return;
                }
                DebugOutput.PrintLn("result : " + result);
                var dialog = new CommonOpenFileDialog();
                dialog.IsFolderPicker   = true;
                dialog.EnsurePathExists = true;
                dialog.Title            = "Choose a folder to unpack to. Select ME3 directory to unpack to proper folder";
                if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
                {
                    unpackFolder = dialog.FileName;
                }
                else
                {
                    return;
                }
            }
            else
            {
                unpackFolder = autoUnpackFolder;
            }
            if (!unpackFolder.EndsWith("\\"))
            {
                unpackFolder = unpackFolder + "\\";
            }
            DebugOutput.PrintLn("Extracting DLC to : " + unpackFolder);

            result = result.Trim();
            if (result.EndsWith(";"))
            {
                result = result.Substring(0, result.Length - 1);
            }
            string[] patt = result.Split(';');
            string   file = DLC.MyFileName;                 //full path
            string   t1   = Path.GetDirectoryName(file);    //cooked
            string   t2   = Path.GetDirectoryName(t1);      //DLC_Name
            string   t3   = Path.GetDirectoryName(t2);      //DLC
            string   t4   = Path.GetDirectoryName(t3);      //BioGame

            DebugOutput.PrintLn("DLC name : " + t2);
            if (DLC.Files.Length > 1)
            {
                List <int> Indexes = new List <int>();
                for (int i = 0; i < DLC.Files.Length; i++)
                {
                    string DLCpath = DLC.Files[i].FileName;
                    for (int j = 0; j < patt.Length; j++)
                    {
                        if (DLCpath.ToLower().EndsWith(patt[j].Trim().ToLower()) && patt[j].Trim().ToLower() != "")
                        {
                            string relPath = GetRelativePath(DLCpath);
                            string outpath = unpackFolder + relPath;
                            DebugOutput.PrintLn("Extracting file #" + i.ToString("d4") + ": " + outpath);
                            if (!Directory.Exists(Path.GetDirectoryName(outpath)))
                            {
                                Directory.CreateDirectory(Path.GetDirectoryName(outpath));
                            }
                            using (FileStream fs = new FileStream(outpath, FileMode.Create))
                                DLC.DecompressEntry(i).WriteTo(fs);
                            Indexes.Add(i);
                            Application.DoEvents();
                            break;
                        }
                    }
                }
                DLC.DeleteEntry(Indexes);
            }

            // AutoTOC
            DebugOutput.PrintLn("Updating DLC's PCConsoleTOC.bin");
            List <string> FileNames = toc.GetFiles(t2 + "\\");
            List <string> tet       = new List <string>(t2.Split('\\'));
            string        remov     = String.Join("\\", tet.ToArray());

            for (int i = 0; i < FileNames.Count; i++)
            {
                FileNames[i] = FileNames[i].Substring(remov.Length + 1);
            }
            string[] ts = t2.Split('\\');
            tet.Clear();
            tet.AddRange(ts);
            string basepath = String.Join("\\", tet.ToArray()) + '\\';
            string tocfile  = t2 + "\\PCConsoleTOC.bin";

            toc.CreateTOC(basepath, tocfile, FileNames.ToArray());
            if (!automated)
            {
                MessageBox.Show("SFAR Unpacked.");
            }
        }