public static void Processor() { Console.Title = "PD_Tool: Converter Tools: DEX Converter"; KKtMain.Choose(1, "dex", out string[] FileNames); DEXa Data = new DEXa(); foreach (string file in FileNames) { Data = new DEXa { filepath = file.Replace(Path. GetExtension(file), ""), ext = Path.GetExtension(file) }; Console.Title = "PD_Tool: Converter Tools: DEX Reader: " + Path.GetFileNameWithoutExtension(file); switch (Data.ext.ToLower()) { case ".dex": case ".bin": Data.DEXReader(); Data.XMLWriter(); break; case ".xml": Data.XMLReader(); Data.DEXWriter(); break; } } }
public static void Processor() { Console.Title = "PD_Tool: DB Converter"; Console.Clear(); KKtMain.ConsoleDesign(true); KKtMain.ConsoleDesign(" Choose type of DataBase file:"); KKtMain.ConsoleDesign(false); KKtMain.ConsoleDesign("1. Auth DB Converter"); KKtMain.ConsoleDesign(false); KKtMain.ConsoleDesign(true); Console.WriteLine(); int.TryParse(Console.ReadLine(), NumberStyles.HexNumber, null, out format); string file = ""; if (format == 1) { KKtMain.Choose(1, "bin", out string InitialDirectory, out string[] FileNames); foreach (string FileName in FileNames) { file = Path.Combine(InitialDirectory, FileName); string filepath = file.Replace(Path.GetExtension(file), ""); string ext = Path.GetExtension(file).ToLower(); if (File.Exists(file)) { if (ext == ".xml") { Auth.XMLReader(ref Auth.Data[0], filepath); Auth.BINWriter(ref Auth.Data[0], filepath); } else if (ext == ".bin") { Auth.BINReader(ref Auth.Data[0], filepath); Auth.XMLWriter(ref Auth.Data[0], filepath); } else { Console.WriteLine("File {0} doesn't exist!", Path.GetFileName(file)); Program.Exit(); } } } } Console.Title = "PD_Tool"; }
public static void Processor() { Console.Title = "PD_Tool: Converter Tools: A3DA Converter"; KKtMain.Choose(1, "a3da", out string[] FileNames); bool MP = true; foreach (string file in FileNames) { if (file.EndsWith(".mp")) { MP = false; break; } } KKtMain.Format Format = KKtMain.Format.NULL; Console.Clear(); KKtMain.ConsoleDesign(true); KKtMain.ConsoleDesign(" Choose type of format to export for MP files:"); KKtMain.ConsoleDesign(false); KKtMain.ConsoleDesign("1. DT PS3"); KKtMain.ConsoleDesign("2. F PS3/PSV"); KKtMain.ConsoleDesign("3. FT PS4"); KKtMain.ConsoleDesign("4. F2nd PS3/PSV"); KKtMain.ConsoleDesign("5. X PS4/PSV"); KKtMain.ConsoleDesign("6. MGF PSV"); if (MP) { KKtMain.ConsoleDesign("9. MessagePack"); } KKtMain.ConsoleDesign(false); KKtMain.ConsoleDesign(true); Console.WriteLine(); string a = Console.ReadLine(); if (a == "1") { Format = KKtMain.Format.DT; } else if (a == "2") { Format = KKtMain.Format.F; } else if (a == "3") { Format = KKtMain.Format.FT; } else if (a == "4") { Format = KKtMain.Format.F2LE; } else if (a == "5") { Format = KKtMain.Format.X; } else if (a == "6") { Format = KKtMain.Format.MGF; } foreach (string file in FileNames) { try { string ext = Path.GetExtension(file); string filepath = file.Replace(ext, ""); Console.Title = "PD_Tool: Converter Tools: A3DA Tools: " + Path.GetFileNameWithoutExtension(file); KKtA3DA A = new KKtA3DA(); if (ext.ToLower() == ".a3da") { A.A3DAReader(filepath); } if (ext.ToLower() == ".mp") { A.MsgPackReader(filepath); } if (!MP || Format > KKtMain.Format.NULL) { A.IO = KKtLib.IO.OpenWriter(filepath + ".a3da", true); } if (Format > KKtMain.Format.NULL) { if (A.Data.Header.Format < KKtMain.Format.F2LE) { A.Data._.CompressF16 = Format == KKtMain.Format.MGF ? 2 : 1; } A.Data.Header.Format = Format; } if (!MP && A.Data.Header.Format > KKtMain.Format.DT && A.Data.Header.Format != KKtMain.Format.FT) { A.A3DCWriter(filepath); } else if (!MP || Format > KKtMain.Format.NULL) { A.A3DC = false; A.A3DAWriter(filepath); } else { A.MsgPackWriter(filepath); } } catch (Exception e) { Console.WriteLine(e); } } }
static bool Functions(string file, int code) { if (code != 0) { if (!Directory.Exists(file) && code != 1) { ReturnCode = 0; return(false); } else if (!File.Exists(file) && code != 1) { ReturnCode = 0; return(false); } } switch (function) { case "1": case "2": FARC.Processor(file, false, code, function == "1"); break; case "3": case "4": KKtLib.FARC Farc = new KKtLib.FARC(); if (Directory.Exists(file)) { Farc.Pack(file); } else if (File.Exists(file) && Path.GetExtension(file) == ".farc") { Farc.UnPack(file, true); } else { Console.Clear(); if (code != 1) { KKtMain.Choose(1, "", out string InitialDirectory, out string[] FileNames); foreach (string FileName in FileNames) { DIVAFILEEncDec(0, Path.Combine(InitialDirectory, FileName), code); } } else if (file != "") { DIVAFILEEncDec(0, file, code); } else { ReturnCode = 2; } } break; case "5": Console.Clear(); DB.DataBase.Processor(); break; case "6": Console.Clear(); Console.Title = "PD_Tool: Converter Tools"; KKtMain.ConsoleDesign(true); KKtMain.ConsoleDesign(" Choose tool:"); KKtMain.ConsoleDesign(false); KKtMain.ConsoleDesign("1. A3DA Converter"); KKtMain.ConsoleDesign("2. DEX Converter"); KKtMain.ConsoleDesign("3. DSC Converter"); KKtMain.ConsoleDesign("4. STR Converter"); KKtMain.ConsoleDesign(false); KKtMain.ConsoleDesign(true); Console.WriteLine(); string Function = Console.ReadLine(); Console.Clear(); switch (Function) { case "1": Tools.A3D.Processor(); break; case "2": Tools.DEX.Processor(); break; case "3": DSC.Main.Processor(); break; case "4": Tools.STR.Processor(); break; } Console.Clear(); break; default: ReturnCode = 0; break; } Console.Title = "PD_Tool"; if (code == 0) { return(true); } else { return(false); } }
public static void Processor(string file, bool Compression, int code, bool Extract) { KKtFARC FARC = new KKtFARC(); Console.Clear(); if (Extract) { Console.Title = "PD_Tool: FARC Extractor"; KKtMain.Choose(1, "farc", out string InitialDirectory, out string[] FileNames); foreach (string FileName in FileNames) { file = Path.Combine(InitialDirectory, FileName); if (file != "" && File.Exists(file)) { FARC.UnPack(file, true); } else if (!File.Exists(file)) { Program.ReturnCode = 31; } else { Program.ReturnCode = 2; } GC.Collect(); } } else { file = KKtMain.Choose(2, "", out string InitialDirectory, out string[] FileNames); Console.Clear(); Console.Title = "PD_Tool: FARC Creator"; if (file != "" && Directory.Exists(file)) { KKtMain.ConsoleDesign(true); KKtMain.ConsoleDesign(" Choose type of created FARC:"); KKtMain.ConsoleDesign(false); KKtMain.ConsoleDesign("1. FArc [DT/DT2nd/DTex/F/F2nd/X]"); KKtMain.ConsoleDesign("2. FArC [DT/DT2nd/DTex/F/F2nd/X] (Compressed)"); KKtMain.ConsoleDesign("3. FARC [F/F2nd/X] (Compressed)"); KKtMain.ConsoleDesign("4. FARC [FT] (Compressed)"); KKtMain.ConsoleDesign(false); KKtMain.ConsoleDesign("Note: Creating FT FARCs currently not supported."); KKtMain.ConsoleDesign(false); KKtMain.ConsoleDesign(true); Console.WriteLine(); Console.WriteLine("Choosed folder: {0}", file); Console.WriteLine(); int.TryParse(Console.ReadLine(), out int type); switch (type) { case 1: FARC.Signature = KKtFARC.Farc.FArc; break; case 3: FARC.Signature = KKtFARC.Farc.FARC; break; default: FARC.Signature = KKtFARC.Farc.FArC; break; } Console.Clear(); Console.Title = "PD_Tool: FARC Creator - Directory: " + Path.GetDirectoryName(file); FARC.Pack(file); GC.Collect(); } else if (!Directory.Exists(file)) { Program.ReturnCode = 32; } else { Program.ReturnCode = 2; } Console.Title = "PD_Tool: FARC Creator"; } }