ME3Explorer.AutoTOC.prepareToCreateTOC C# (CSharp) Method

prepareToCreateTOC() public static method

public static prepareToCreateTOC ( string consoletocFile, System.Windows.Forms.RichTextBox rtb = null ) : void
consoletocFile string
rtb System.Windows.Forms.RichTextBox
return void
        public static void prepareToCreateTOC(string consoletocFile, RichTextBox rtb = null)
        {
            if (!consoletocFile.EndsWith("\\"))
            {
                consoletocFile = consoletocFile + "\\";
            }
            List<string> files = GetFiles(consoletocFile);
            if (files.Count != 0)
            {
                rtb?.AppendText($"Creating TOC in {consoletocFile}\n");
                string t = files[0];
                int n = t.IndexOf("DLC_");
                if (n > 0)
                {
                    for (int i = 0; i < files.Count; i++)
                        files[i] = files[i].Substring(n);
                    string t2 = files[0];
                    n = t2.IndexOf("\\");
                    for (int i = 0; i < files.Count; i++)
                        files[i] = files[i].Substring(n + 1);
                }
                else
                {
                    n = t.IndexOf("BIOGame");
                    if (n > 0)
                    {
                        for (int i = 0; i < files.Count; i++)
                            files[i] = files[i].Substring(n);
                    }
                }
                string pathbase;
                string t3 = files[0];
                int n2 = t3.IndexOf("BIOGame");
                if (n2 >= 0)
                {
                    pathbase = Path.GetDirectoryName(Path.GetDirectoryName(consoletocFile)) + "\\";
                }
                else
                {
                    pathbase = consoletocFile;
                }
                CreateTOC(pathbase, consoletocFile + "PCConsoleTOC.bin", files.ToArray());
                rtb?.AppendText("Done.\n");
            }
        }

Usage Example

コード例 #1
0
        public static void unpackSFAR(DLCPackage dlc)
        {
            if (dlc == null || dlc.Files == null)
            {
                return;
            }
            string[] patt     = { "pcc", "bik", "tfc", "afc", "cnd", "tlk", "bin", "dlc" };
            string   file     = dlc.FileName;                //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.DecompressEntryAsync(i, fs).Wait();
                            }
                            Indexes.Add(i);
                            Application.DoEvents();
                            break;
                        }
                    }
                }
                dlc.DeleteEntries(Indexes);
            }

            // AutoTOC
            AutoTOC.prepareToCreateTOC(t2 + "\\PCConsoleTOC.bin");
            DebugOutput.PrintLn("DLC Done.");
        }
All Usage Examples Of ME3Explorer.AutoTOC::prepareToCreateTOC