public static void Processor(bool Extract) { KKdFARC FARC = new KKdFARC(); Console.Clear(); if (Extract) { Console.Title = "FARC Extractor"; Main.Choose(1, "farc", out string[] FileNames); foreach (string FileName in FileNames) { if (FileName != "" && File.Exists(FileName)) { FARC.UnPack(FileName); } } } else { string file = Main.Choose(2, "", out string[] FileNames); Console.Clear(); Console.Title = "FARC Creator"; if (file != "") { Main.ConsoleDesign(true); Main.ConsoleDesign(" Choose type of created FARC:"); Main.ConsoleDesign(false); Main.ConsoleDesign("1. FArc [DT/DT2nd/DTex/F/F2nd/X]"); Main.ConsoleDesign("2. FArC [DT/DT2nd/DTex/F/F2nd/X] (Compressed)"); Main.ConsoleDesign("3. FARC [F/F2nd/X] (Compressed)"); Main.ConsoleDesign("4. FARC [FT] (Compressed)"); Main.ConsoleDesign(false); Main.ConsoleDesign("Note: Creating FT FARCs currently not supported."); Main.ConsoleDesign(false); Main.ConsoleDesign(true); Console.WriteLine(); Console.WriteLine("Choosed folder: {0}", file); Console.WriteLine(); int.TryParse(Console.ReadLine(), out int type); if (type == 1) { FARC.Signature = KKdFARC.Farc.FArc; } else if (type == 3) { FARC.Signature = KKdFARC.Farc.FARC; } else { FARC.Signature = KKdFARC.Farc.FArC; } Console.Clear(); Console.Title = "FARC Creator - Directory: " + Path.GetDirectoryName(file); FARC.Pack(file); } } }
public static void Main(string[] args) { SetProcessDPIAware(); Console.InputEncoding = System.Text.Encoding.Unicode; Console.OutputEncoding = System.Text.Encoding.Unicode; Console.Title = "PD_Tool"; if (args.Length == 0) { while (choose != "Q") { MainMenu(); } Exit(); } long header; Stream reader; foreach (string arg in args) { GC.Collect(); if (Directory.Exists(arg)) { using (KKdFARC FARC = new KKdFARC(arg, true) { CompressionLevel = 9 }) FARC.Pack(); } else if (File.Exists(arg) && Path.GetExtension(arg) == ".farc") { using (KKdFARC farc = new KKdFARC(arg)) farc.Unpack(true); } else if (File.Exists(arg)) { using (reader = File.OpenReader(arg)) header = reader.RI64(); if (header == 0x454C494641564944) { KKdMainLib.DIVAFILE.Decrypt(arg); } } } Exit(); }
public static void Processor(bool Extract) { KKdFARC FARC = new KKdFARC(); Console.Clear(); if (Extract) { Console.Title = "FARC Extractor"; Main.Choose(1, "farc", out string[] FileNames); foreach (string FileName in FileNames) { if (FileName != "" && File.Exists(FileName)) { new KKdFARC(FileName).UnPack(); } } } else { string file = Main.Choose(2, "", out string[] FileNames); Console.Clear(); Console.Title = "FARC Creator"; if (file != "") { FARC = new KKdFARC(); Main.ConsoleDesign(true); Main.ConsoleDesign(" Choose type of created FARC:"); Main.ConsoleDesign(false); Main.ConsoleDesign("1. FArc [DT/DT2nd/DTex/F/F2nd/X]"); Main.ConsoleDesign("2. FArC [DT/DT2nd/DTex/F/F2nd/X] (Compressed)"); Main.ConsoleDesign("3. FARC [F/F2nd/X]"); Main.ConsoleDesign(false); Main.ConsoleDesign("R. Return to Main Menu"); Main.ConsoleDesign(false); Main.ConsoleDesign(true); Console.WriteLine(); Console.WriteLine("Choosed folder: {0}", file); Console.WriteLine(); string type = Console.ReadLine().ToUpper(); if (type == "1") { FARC.Signature = KKdFARC.Farc.FArc; } else if (type == "3" || type == "4") { FARC.Signature = KKdFARC.Farc.FARC; Console.WriteLine(); Main.ConsoleDesign(true); Main.ConsoleDesign(" Choose type of FARC:"); Main.ConsoleDesign(false); Main.ConsoleDesign("1. FARC"); Main.ConsoleDesign("2. FARC (Compressed)"); Main.ConsoleDesign("3. FARC (Encrypted)"); Main.ConsoleDesign("4. FARC (Compressed & Encrypted)"); Main.ConsoleDesign(false); Main.ConsoleDesign(true); Console.WriteLine(); type = Console.ReadLine(); if (type == "2" || type == "4") { FARC.FARCType |= KKdFARC.Type.GZip; } if (type == "3" || type == "4") { FARC.FARCType |= KKdFARC.Type.ECB; } } else if (type == "R") { return; } else { FARC.Signature = KKdFARC.Farc.FArC; } Console.Title = "FARC Creator - Directory: " + Path.GetDirectoryName(file); new KKdFARC(file, true).Pack(FARC.Signature); } } }
public static void Processor(bool JSON) { Console.Title = "A3DA Converter"; Main.Choose(1, "a3da", out string[] FileNames); if (FileNames.Length < 1) { return; } string filepath = ""; string ext = ""; bool MP = false; foreach (string file in FileNames) { if (file.EndsWith(".mp")) { MP = true; break; } else if (file.EndsWith(".json")) { MP = true; break; } else if (file.EndsWith(".farc")) { MP = true; break; } } Main.Format Format = Main.Format.NULL; string format = ""; if (MP) { Console.Clear(); Main.ConsoleDesign(true); Main.ConsoleDesign(" Choose type of format to export:"); Main.ConsoleDesign(false); Main.ConsoleDesign("1. A3DA [DT/AC/F]"); Main.ConsoleDesign("2. A3DC [DT/AC/F]"); Main.ConsoleDesign("3. A3DA [AFT/FT] "); Main.ConsoleDesign("4. A3DC [AFT/FT] "); Main.ConsoleDesign("5. A3DC [F2] "); Main.ConsoleDesign("6. A3DC [MGF] "); Main.ConsoleDesign("7. A3DC [X] "); Main.ConsoleDesign(false); Main.ConsoleDesign(true); Console.WriteLine(); format = Console.ReadLine(); if (format == "1") { Format = Main.Format.DT; } else if (format == "2") { Format = Main.Format.F; } else if (format == "3") { Format = Main.Format.FT; } else if (format == "4") { Format = Main.Format.FT; } else if (format == "5") { Format = Main.Format.F2LE; } else if (format == "6") { Format = Main.Format.MGF; } else if (format == "7") { Format = Main.Format.X; } else { return; } } KKdA3DA A; int state; foreach (string file in FileNames) { A = new KKdA3DA(); ext = Path.GetExtension(file); filepath = file.Replace(ext, ""); ext = ext.ToLower(); Console.Title = "A3DA Converter: " + Path.GetFileNameWithoutExtension(file); if (ext == ".farc") { KKdFARC FARC = new KKdFARC(file); if (!FARC.HeaderReader()) { continue; } if (!FARC.HasFiles) { continue; } MsgPack A3DA = MsgPack.Null; byte[] data = null; for (int i = 0; i < FARC.Files.Length; i++) { data = FARC.FileReader(i); state = A.A3DAReader(data); if (state == 1) { A3DA = A.MsgPackWriter(); A = new KKdA3DA(); A.MsgPackReader(A3DA); A.IO = File.OpenWriter(); A.Data._.CompressF16 = Format > Main.Format.FT ? Format == Main.Format.MGF ? 2 : 1 : 0; A.Data.Format = Format; FARC.Files[i].Data = (format != "1" && format != "3") ? A.A3DCWriter() : A.A3DAWriter(); } } FARC.Save(); } else if (ext == ".a3da") { state = A.A3DAReader(filepath); if (state == 1) { A.MsgPackWriter(filepath, JSON); } } else if (ext == ".mp" || ext == ".json") { A.MsgPackReader(filepath, ext == ".json"); A.Data._.CompressF16 = Format > Main.Format.FT ? Format == Main.Format.MGF ? 2 : 1 : 0; A.Data.Format = Format; File.WriteAllBytes(filepath + ".a3da", (format != "1" && format != "3") ? A.A3DCWriter() : A.A3DAWriter()); } A = null; } }