static byte[] ExportThing(string aPath, string bPath) { string tocPath = ""; Entry tocEntry = null; Toc mainToc = null; foreach (Toc ent in tocFiles) { foreach (Entry en in ent.mainEntry.subTypes["bundles"]) { if (en.subTypes["id"] == aPath) { mainToc = ent; tocPath = ent.filePath; tocPath = tocPath.Substring(0, tocPath.LastIndexOf('.')); tocEntry = en; break; } } } string sbPath = Path.Combine(GamePath, MainFolder, tocPath + ".sb"); Sb sbFile = new Sb(sbPath, (long)tocEntry.subTypes["offset"]); Entry sbEntry = null; foreach (Entry eb in sbFile.mainEntry.subTypes["res"]) { if (eb.subTypes["name"] == bPath) { sbEntry = eb; break; } } return(Tools.GetDataFromSha1(catFiles, sbEntry.subTypes["sha1"])); }
static void ImportThing(string aPath, string bPath, byte[] data) { string tocPath = ""; Entry tocEntry = null; Toc mainToc = null; foreach (Toc ent in tocFiles) { foreach (Entry en in ent.mainEntry.subTypes["bundles"]) { if (en.subTypes["id"] == aPath) { mainToc = ent; tocPath = ent.filePath; tocPath = tocPath.Substring(0, tocPath.LastIndexOf('.')); tocEntry = en; break; } } } string sbPath = Path.Combine(GamePath, MainFolder, tocPath + ".sb"); Sb sbFile = new Sb(sbPath, (long)tocEntry.subTypes["offset"]); Entry sbEntry = null; foreach (Entry eb in sbFile.mainEntry.subTypes["res"]) { if (eb.subTypes["name"] == bPath) { sbEntry = eb; break; } } Kat katSettings = Tools.GetCatSettings(catFiles, sbEntry.subTypes["sha1"]); string cas1path = Path.Combine(GamePath, MainFolder, Path.GetDirectoryName(katSettings.motherCat.filePath) + "\\cas_0" + katSettings.casNo + ".cas"); byte[] cas1 = File.ReadAllBytes(cas1path); int z = 0; /*if (data.Length > (uint)katSettings.size) * { * Console.WriteLine("Yeni dosyanın boyutu (" + data.Length + ") Orjinal boyuttan (" + katSettings.size + ") daha büyük!\nİptal.. "); * return; * }*/ for (uint i = katSettings.offset; i < katSettings.offset + katSettings.size; i++) { if (z < data.Length) { cas1[i] = data[z]; z++; } else { cas1[i] = 0; } } Console.WriteLine("Writing to Cas1 File.."); BackupAndWriteBytes(cas1path, cas1); Console.WriteLine("OK."); }