From 85a22ea0f704c2a739d000260dc288b97e6392c3 Mon Sep 17 00:00:00 2001 From: korenkonder Date: Thu, 19 Nov 2020 23:22:25 +0300 Subject: [PATCH] Release v0.4.9.9 A3DA, Bloom, Color Correction, DOF, Light, MotHead --- .gitattributes | 2 ++ KKdBaseLib/F2/Struct.cs | 9 +++---- KKdBaseLib/KKdBaseLib.csproj | 8 +++---- KKdBaseLib/MsgPack.cs | 2 -- KKdMainLib/Aet.cs | 6 +++-- KKdMainLib/Extensions.cs | 20 +++++++++------- KKdMainLib/F2/Bloom.cs | 1 + KKdMainLib/F2/ColorCorrection.cs | 1 + KKdMainLib/F2/DOF.cs | 1 + KKdMainLib/F2/Light.cs | 4 ++-- KKdMainLib/FARC.cs | 21 ++++++----------- KKdMainLib/IO/JSON.cs | 4 +++- KKdMainLib/IO/Path.cs | 6 +++++ KKdMainLib/KKdMainLib.csproj | 8 +++---- KKdMainLib/MotHead.cs | 38 ++++++++++++++++++++---------- KKdSoundLib/KKdSoundLib.csproj | 4 ++-- PD_Tool/PD_Tool.csproj | 4 ++-- PD_Tool/Program.cs | 19 ++++++++------- PD_Tool/Properties/AssemblyInfo.cs | 4 ++-- PD_Tool/classes/A3D.cs | 9 ++++--- PD_Tool/classes/ADP.cs | 5 ++-- PD_Tool/classes/AET.cs | 5 ++-- PD_Tool/classes/BLT.cs | 7 +++--- PD_Tool/classes/CCT.cs | 7 +++--- PD_Tool/classes/DB.cs | 5 ++-- PD_Tool/classes/DEX.cs | 5 ++-- PD_Tool/classes/DFT.cs | 7 +++--- PD_Tool/classes/DIV.cs | 7 +++--- PD_Tool/classes/DataBase.cs | 14 +++++------ PD_Tool/classes/FARC.cs | 2 +- PD_Tool/classes/LIT.cs | 5 ++-- PD_Tool/classes/MHD.cs | 5 ++-- PD_Tool/classes/STR.cs | 5 ++-- PD_Tool/classes/TBL.cs | 7 +++--- PD_Tool/classes/VAG.cs | 7 +++--- 35 files changed, 137 insertions(+), 127 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/KKdBaseLib/F2/Struct.cs b/KKdBaseLib/F2/Struct.cs index 3152121..da16d5e 100644 --- a/KKdBaseLib/F2/Struct.cs +++ b/KKdBaseLib/F2/Struct.cs @@ -12,18 +12,19 @@ namespace KKdBaseLib.F2 public uint Length => length(false); public uint LengthX => length( true); - public uint Depth => Header.Depth; - public bool HasPOF => POF .NotNull; public bool HasENRS => ENRS.NotNull; public bool HasSubStructs => SubStructs != null; public long DataOffset; - public void Update(bool ShiftX = false) + public void Update(bool shiftX = false) { + if (Header.Signature == 0x4C435450 && SubStructs == null) + SubStructs = new Struct[0]; + Header.SectionSize = Data != null ? (uint)Data.Length : 0; - Header.DataSize = length(ShiftX); + Header.DataSize = length(shiftX); } private uint length(bool shiftX = false) diff --git a/KKdBaseLib/KKdBaseLib.csproj b/KKdBaseLib/KKdBaseLib.csproj index 2364b86..06a6f9a 100644 --- a/KKdBaseLib/KKdBaseLib.csproj +++ b/KKdBaseLib/KKdBaseLib.csproj @@ -6,12 +6,12 @@ korenkonder (C) 2019-2020 A base library - 0.4.9.8 + 0.4.9.9 KKdBaseLib KKdBaseLib net461 KKdBaseLib - 0.4.9.8 + 0.4.9.9 AnyCPU @@ -24,7 +24,7 @@ 4 true 8.0 - IDE0004, IDE0032, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0066, IDE0069, IDE1006 + IDE0004, IDE0018, IDE0032, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0066, IDE0069, IDE1006 AnyCPU @@ -37,7 +37,7 @@ true true 8.0 - IDE0004, IDE0032, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0066, IDE0069, IDE1006 + IDE0004, IDE0018, IDE0032, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0066, IDE0069, IDE1006 diff --git a/KKdBaseLib/MsgPack.cs b/KKdBaseLib/MsgPack.cs index a1b1df9..f362b78 100644 --- a/KKdBaseLib/MsgPack.cs +++ b/KKdBaseLib/MsgPack.cs @@ -26,8 +26,6 @@ namespace KKdBaseLib public MsgPack(string name, object @object) { Name = name; Object = @object; } - public static MsgPack Null => new MsgPack(); - public MsgPack this[ int index] { get => Object is MsgPack[] Array ? Array[index] : default; set { if (Object is MsgPack[] Array) { Array[index] = value; Object = Array; } } } diff --git a/KKdMainLib/Aet.cs b/KKdMainLib/Aet.cs index 58c91d3..a46a9da 100644 --- a/KKdMainLib/Aet.cs +++ b/KKdMainLib/Aet.cs @@ -732,8 +732,9 @@ namespace KKdMainLib public MsgPack MsgPackWriter(ref Pointer aetData) { + if (aetData.O <= 0) return default; + int i, i0; - if (aetData.O <= 0) return MsgPack.Null; ref Scene aet = ref aetData.V; MsgPack msgPack = MsgPack.New.Add("Name", aet.Name.V).Add("StartFrame", aet.StartFrame) @@ -966,7 +967,8 @@ namespace KKdMainLib private MsgPack WMP(ref CountPointer kfe, string name) { - if (kfe.C < 1) return MsgPack.Null; + if (kfe.C < 1) return default; + if (kfe.C == 1) return new MsgPack(name, kfe.E[0].V); MsgPack msg = new MsgPack(kfe.C, name); for (int i = 0; i < kfe.E.Length; i++) diff --git a/KKdMainLib/Extensions.cs b/KKdMainLib/Extensions.cs index d586a27..b32a0bf 100644 --- a/KKdMainLib/Extensions.cs +++ b/KKdMainLib/Extensions.cs @@ -147,24 +147,28 @@ namespace KKdMainLib { byte[] Data; using (Stream stream = File.OpenWriter()) - { stream.W(@struct, shiftX, useDepth); stream.WEOFC(); Data = stream.ToArray(); } + { stream.W(@struct, 0, shiftX, useDepth); stream.WEOFC(); Data = stream.ToArray(); } return Data; } - public static void W(this Stream stream, Struct @struct, bool shiftX = false, bool useDepth = true) + public static void W(this Stream stream, Struct @struct, uint depth = 0, + bool shiftX = false, bool useDepth = true) { @struct.Update(shiftX); + if (@struct.Header.Signature == 0x54434645) + { } + + @struct.Header.Depth = depth; stream.W(@struct.Header); if (@struct.Data != null) stream.W(@struct.Data); - if (@struct.HasPOF ) stream.W(@struct.POF , shiftX, useDepth ? @struct.Depth + 1 : 0u); - if (@struct.HasENRS) stream.W(@struct.ENRS, useDepth ? @struct.Depth + 1 : 0u); + if (@struct.HasPOF ) stream.W(@struct.POF , shiftX, useDepth ? depth + 1 : 0u); + if (@struct.HasENRS) stream.W(@struct.ENRS, useDepth ? depth + 1 : 0u); if (@struct.HasSubStructs) - { for (int i = 0; i < @struct.SubStructs.Length; i++) - stream.W(@struct.SubStructs[i], shiftX); - stream.WEOFC(@struct.Depth + 1); - } + stream.W(@struct.SubStructs[i], depth + 1, shiftX, useDepth); + if (@struct.HasPOF || @struct.HasENRS || @struct.HasSubStructs) + stream.WEOFC(depth + 1); } } diff --git a/KKdMainLib/F2/Bloom.cs b/KKdMainLib/F2/Bloom.cs index 3cd7462..c4ecd5f 100644 --- a/KKdMainLib/F2/Bloom.cs +++ b/KKdMainLib/F2/Bloom.cs @@ -19,6 +19,7 @@ namespace KKdMainLib.F2 header = s.ReadHeader(); if (header.Signature != 0x544D4C42 || header.InnerSignature != 0x3) return; s.P -= 0x4; + s.IsBE = header.UseBigEndian; BLTs = s.RCPE(); if (BLTs.C < 1) { s.C(); BLTs.C = -1; return; } diff --git a/KKdMainLib/F2/ColorCorrection.cs b/KKdMainLib/F2/ColorCorrection.cs index 0a53068..4e084b6 100644 --- a/KKdMainLib/F2/ColorCorrection.cs +++ b/KKdMainLib/F2/ColorCorrection.cs @@ -19,6 +19,7 @@ namespace KKdMainLib.F2 header = s.ReadHeader(); if (header.Signature != 0x54524343 || header.InnerSignature != 0x3) return; s.P -= 0x4; + s.IsBE = header.UseBigEndian; CCTs = s.RCPE(); if (CCTs.C < 1) { s.C(); CCTs.C = -1; return; } diff --git a/KKdMainLib/F2/DOF.cs b/KKdMainLib/F2/DOF.cs index 5da86b9..afc7ae1 100644 --- a/KKdMainLib/F2/DOF.cs +++ b/KKdMainLib/F2/DOF.cs @@ -19,6 +19,7 @@ namespace KKdMainLib.F2 header = s.ReadHeader(); if (header.Signature != 0x54464F44 || header.InnerSignature != 0x3) return; s.P -= 0x4; + s.IsBE = header.UseBigEndian; DFTs = s.RCPE(); if (DFTs.C < 1) { s.C(); DFTs.C = -1; return; } diff --git a/KKdMainLib/F2/Light.cs b/KKdMainLib/F2/Light.cs index e1d95fb..97a0ad4 100644 --- a/KKdMainLib/F2/Light.cs +++ b/KKdMainLib/F2/Light.cs @@ -17,8 +17,8 @@ namespace KKdMainLib.F2 LITs = default; s = File.OpenReader(file + ".lit", true); header = s.ReadHeader(); - if (header.Signature != 0x4354494C || header.InnerSignature != 0x2 || - header.SectionSignature != 0x2) return; + if (header.Signature != 0x4354494C || header.InnerSignature != 0x2) return; + s.IsBE = header.UseBigEndian; LITs = s.RCPE>(); if (LITs.C < 1) { s.C(); LITs.C = -1; return; } diff --git a/KKdMainLib/FARC.cs b/KKdMainLib/FARC.cs index 6b19dff..5df72a2 100644 --- a/KKdMainLib/FARC.cs +++ b/KKdMainLib/FARC.cs @@ -21,7 +21,7 @@ namespace KKdMainLib public Farc Signature = Farc.FArC; public Format Format = Format.DT; public string FilePath, DirectoryPath; - public bool HasFiles => Files.IsNull ? false : Files.Count > 0; + public bool HasFiles => !Files.IsNull || Files.Count > 0; public int CompressionLevel = 12; private readonly byte[] key = "project_diva.bin".ToASCII(); @@ -43,7 +43,7 @@ namespace KKdMainLib if (!File.Exists(FilePath)) return false; Stream reader = File.OpenReader(FilePath); - DirectoryPath = Path.GetFullPath(FilePath).Replace(Path.GetExtension(FilePath), ""); + DirectoryPath = Path.RemoveExtension(Path.GetFullPath(FilePath)); Signature = (Farc)reader.RI32E(true); if (Signature != Farc.FArc && Signature != Farc.FArC && Signature != Farc.FARC) { reader.Dispose(); return false; } @@ -140,15 +140,9 @@ namespace KKdMainLib FARCFile file = Files[i]; if (Signature != Farc.FARC) { - if (Signature == Farc.FArC) - using (MSIO.MemoryStream memorystream = new MSIO.MemoryStream( - File.ReadAllBytes(FilePath, file.SizeComp, file.Offset))) - using (GZipStream gZipStream = new GZipStream(memorystream, CompressionMode.Decompress)) - { - file.Data = new byte[file.SizeUnc]; - gZipStream.Read(file.Data, 0, file.SizeUnc); - } - else file.Data = File.ReadAllBytes(FilePath, file.SizeUnc, file.Offset); + file.Data = Signature == Farc.FArC + ? File.ReadAllBytes(FilePath, file.SizeComp, file.Offset).InflateGZip(file.SizeUnc) + : File.ReadAllBytes(FilePath, file.SizeUnc, file.Offset); Files[i] = file; return file.Data; } @@ -224,7 +218,7 @@ namespace KKdMainLib for (int i = 0; i < Files.Count; i++) { string ext = Path.GetExtension(Files[i].Name).ToLower(); - if (ext == ".a3da" || ext == ".diva" || ext == ".vag") + if (ext == ".a3da" || ext == ".diva" || ext == ".drs" || ext == ".dve" || ext == ".vag") { Signature = Farc.FArc; break; } } @@ -285,8 +279,8 @@ namespace KKdMainLib { file.Type |= Type.GZip; data = file.Data.DeflateGZip(CompressionLevel); - file.SizeComp = data.Length; } + file.SizeComp = data.Length; if (Signature == Farc.FARC && (FARCType & Type.Enc) != 0) { @@ -295,7 +289,6 @@ namespace KKdMainLib System.Array.Copy(data, tempData, data.Length); for (int i1 = file.Data.Length; i1 < alignLength; i1++) tempData[i1] = 0x78; data = Encrypt(tempData, false); - file.SizeComp = data.Length; } writer.W(data); diff --git a/KKdMainLib/IO/JSON.cs b/KKdMainLib/IO/JSON.cs index 3e3ea49..de8c808 100644 --- a/KKdMainLib/IO/JSON.cs +++ b/KKdMainLib/IO/JSON.cs @@ -140,7 +140,9 @@ namespace KKdMainLib.IO if (c == '.') s += _IO.RCUTF8() + RD(); else if (c != 'e' && c != 'E') { - long val = long.Parse(s); + long val; + try { val = long.Parse(s); } + catch { return ulong.Parse(s); } if (val >= 0x00000000 && val < 0x000000100) return ( byte)val; else if (val >= -0x00000080 && val < 0x000000080) return ( sbyte)val; else if (val >= -0x00008000 && val < 0x000008000) return ( short)val; diff --git a/KKdMainLib/IO/Path.cs b/KKdMainLib/IO/Path.cs index d8ad269..e4ab025 100644 --- a/KKdMainLib/IO/Path.cs +++ b/KKdMainLib/IO/Path.cs @@ -62,5 +62,11 @@ namespace KKdMainLib.IO public static bool IsPathRooted(string path) => MSIOP.IsPathRooted(path); + + public static string RemoveExtension(string path) => + path.Substring(0, path.Length - GetExtension(path).Length); + + public static string ReplaceExtension(string path, string ext) => + path.Substring(0, path.Length - GetExtension(path).Length) + ext; } } diff --git a/KKdMainLib/KKdMainLib.csproj b/KKdMainLib/KKdMainLib.csproj index 2c9d1e9..7089288 100644 --- a/KKdMainLib/KKdMainLib.csproj +++ b/KKdMainLib/KKdMainLib.csproj @@ -6,12 +6,12 @@ korenkonder (C) 2018-2020 A simple library for working with Project Diva AC/DT/F/AFT/F2/X/FT/M39 files - 0.4.9.8 + 0.4.9.9 KKdMainLib KKdMainLib net461 KKdMainLib - 0.4.9.8 + 0.4.9.9 AnyCPU @@ -24,7 +24,7 @@ 4 true 8.0 - IDE0004, IDE0032, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0066, IDE0069, IDE1006 + IDE0004, IDE0018, IDE0032, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0066, IDE0069, IDE1006 AnyCPU @@ -37,7 +37,7 @@ true true 8.0 - IDE0004, IDE0032, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0066, IDE0069, IDE1006 + IDE0004, IDE0018, IDE0032, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0066, IDE0069, IDE1006 diff --git a/KKdMainLib/MotHead.cs b/KKdMainLib/MotHead.cs index 228b27f..662e55e 100644 --- a/KKdMainLib/MotHead.cs +++ b/KKdMainLib/MotHead.cs @@ -97,7 +97,7 @@ namespace KKdMainLib if (Data.Offset > 0) { - s.P = Data.Offset; + s.P = Data.Offset; if (i1 == 0x01) Data.Array = new int[] { s.RU8 () }; else if (i1 == 0x02) Data.Array = new int[] { s.RU16() }; else @@ -156,7 +156,7 @@ RETURN: int Size = GetSize(data.Type); if (data.Array == null || data.Array.Length < 1 || Size < 1) continue; - if (data.Type == 0x3E) s.A(0x20, true); + if (data.Type == 0x3E || data.Type == 0x49) s.A(0x20, true); data.Offset = s.P; if (Size == 0x01) s.W(( byte)data.Array[0]); @@ -194,7 +194,7 @@ RETURN: } break; } - s.A(0x20, true); + s.A(0x04, true); Header.SubHeaderOffset = s.P; i1 = Header.EndMotionID - Header.StartMotionID; @@ -418,7 +418,15 @@ RETURN: data.Array = new int[] { temp.RI32("i0"), temp.RF32("f1").ToI32(), temp.RI32("i2"), - temp.RF32("f3").ToI32() }; + temp.RF32("f3").ToI32(), + temp.RI32("i4"), + temp.RI32("i5"), + temp.RI32("i6"), + temp.RI32("i7"), + temp.RI32("i8"), + temp.RI32("i9"), + temp.RI32("i10"), + temp.RI32("i11") }; } else if ((temp = array[i0]["Type74"]).NotNull) { @@ -448,8 +456,7 @@ RETURN: data.Type = 0x4C; data.Array = new int[] { temp.RI32("i0"), temp.RF32("f1").ToI32(), - temp.RF32("f2").ToI32(), - temp.RI32("i3") }; + temp.RF32("f2").ToI32() }; } else if ((temp = array[i0]["Type77"]).NotNull) { @@ -601,8 +608,16 @@ RETURN: arrayEntry.Add(new MsgPack("Type73") .Add("i0", data.Array[0]) .Add("f1", data.Array[1].ToF32()) - .Add("i2", (short)data.Array[2]) - .Add("f3", data.Array[3].ToF32())); + .Add("i2", data.Array[2]) + .Add("f3", data.Array[3].ToF32()) + .Add("i4", data.Array[4]) + .Add("i5", data.Array[5]) + .Add("i6", data.Array[6]) + .Add("i7", data.Array[7]) + .Add("i8", data.Array[8]) + .Add("i9", data.Array[9]) + .Add("i10", data.Array[10]) + .Add("i11", data.Array[11])); else if (data.Type == 0x4A) arrayEntry.Add(new MsgPack("Type74") .Add("i0", data.Array[0])); @@ -626,8 +641,7 @@ RETURN: arrayEntry.Add(new MsgPack("Type76") .Add("i0", data.Array[0]) .Add("f1", data.Array[1].ToF32()) - .Add("f2", data.Array[2].ToF32()) - .Add("i3", data.Array[3])); + .Add("f2", data.Array[2].ToF32())); else if (data.Type == 0x4D) arrayEntry.Add(new MsgPack("Type77") .Add("i0", data.Array[0])); @@ -709,10 +723,10 @@ RETURN: 0x46 => 0x04, 0x47 => 0x08, 0x48 => 0x08, - 0x49 => 0x10, + 0x49 => 0x30, 0x4A => 0x02, 0x4B => 0x34, - 0x4C => 0x10, + 0x4C => 0x0C, 0x4D => 0x04, 0x4E => 0x1C, 0x4F => 0x01, diff --git a/KKdSoundLib/KKdSoundLib.csproj b/KKdSoundLib/KKdSoundLib.csproj index 7f0e9cf..e2f6792 100644 --- a/KKdSoundLib/KKdSoundLib.csproj +++ b/KKdSoundLib/KKdSoundLib.csproj @@ -24,7 +24,7 @@ 4 true 8.0 - IDE0004, IDE0032, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0066, IDE0069, IDE1006 + IDE0004, IDE0018, IDE0032, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0066, IDE0069, IDE1006 AnyCPU @@ -37,7 +37,7 @@ true true 8.0 - IDE0004, IDE0032, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0066, IDE0069, IDE1006 + IDE0004, IDE0018, IDE0032, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0066, IDE0069, IDE1006 diff --git a/PD_Tool/PD_Tool.csproj b/PD_Tool/PD_Tool.csproj index b6115eb..3a7d1f1 100644 --- a/PD_Tool/PD_Tool.csproj +++ b/PD_Tool/PD_Tool.csproj @@ -23,7 +23,7 @@ 4 true 8.0 - IDE0004, IDE0032, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0066, IDE0069, IDE1006 + IDE0004, IDE0018, IDE0032, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0066, IDE0069, IDE1006 AnyCPU @@ -36,7 +36,7 @@ true true 8.0 - IDE0004, IDE0032, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0066, IDE0069, IDE1006 + IDE0004, IDE0018, IDE0032, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0066, IDE0069, IDE1006 diff --git a/PD_Tool/Program.cs b/PD_Tool/Program.cs index 46ea390..e95a65a 100644 --- a/PD_Tool/Program.cs +++ b/PD_Tool/Program.cs @@ -47,7 +47,8 @@ namespace PD_Tool private static void MainMenu() { - Console.Title = "PD_Tool v0.4.9.8"; + Version ver = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; + Console.Title = $"PD_Tool v{ver}"; Console.Clear(); ConsoleDesign(true); @@ -182,9 +183,9 @@ namespace PD_Tool ConsoleDesign(true); ConsoleDesign(" Choose converter:"); ConsoleDesign(false); - ConsoleDesign("1. A3DA" ); - ConsoleDesign("2. DEX" ); - ConsoleDesign("3. VAG" ); + ConsoleDesign("1. A3DA"); + ConsoleDesign("2. DEX" ); + ConsoleDesign("3. VAG" ); ConsoleDesign(false); ConsoleDesign("R. Return to Main Menu"); ConsoleDesign(false); @@ -244,12 +245,12 @@ namespace PD_Tool if (json) { Console.Title = "MsgPack to JSON: " + Path.GetFileNameWithoutExtension(file); - file.Replace(Path.GetExtension(file), "").ToJSON (); + Path.RemoveExtension(file).ToJSON (); } else { Console.Title = "JSON to MsgPack: " + Path.GetFileNameWithoutExtension(file); - file.Replace(Path.GetExtension(file), "").ToMsgPack(); + Path.RemoveExtension(file).ToMsgPack(); } } } @@ -259,15 +260,15 @@ namespace PD_Tool public static void ConsoleDesign(string text, params string[] args) { text = string.Format(text, args); - string Text = "█ █"; + string Text = "X X"; Text = Text.Remove(3) + text + Text.Remove(0, text.Length + 3); Console.WriteLine(Text); } public static void ConsoleDesign(bool Fill) { - if (Fill) Console.WriteLine("████████████████████████████████████████████████████"); - else Console.WriteLine("█ █"); + if (Fill) Console.WriteLine("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); + else Console.WriteLine("X X"); } private static string GetArgs(string name, bool And, params string[] ext) diff --git a/PD_Tool/Properties/AssemblyInfo.cs b/PD_Tool/Properties/AssemblyInfo.cs index f72098d..79620a1 100644 --- a/PD_Tool/Properties/AssemblyInfo.cs +++ b/PD_Tool/Properties/AssemblyInfo.cs @@ -11,5 +11,5 @@ using System.Runtime.InteropServices; [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("7B5D5A3A-A6F8-4813-C97D-ACFC98F7397E")] -[assembly: AssemblyVersion("0.4.9.8")] -[assembly: AssemblyFileVersion("0.4.9.8")] +[assembly: AssemblyVersion("0.4.9.9")] +[assembly: AssemblyFileVersion("0.4.9.9")] diff --git a/PD_Tool/classes/A3D.cs b/PD_Tool/classes/A3D.cs index c262744..572071b 100644 --- a/PD_Tool/classes/A3D.cs +++ b/PD_Tool/classes/A3D.cs @@ -52,9 +52,8 @@ namespace PD_Tool KKdFARC farc; foreach (string file in fileNames) { - ext = Path.GetExtension(file); - filepath = file.Replace(ext, ""); - ext = ext.ToLower(); + filepath = Path.RemoveExtension(file); + ext = Path.GetExtension(file).ToLower(); Console.Title = "A3DA Converter: " + Path.GetFileNameWithoutExtension(file); if (ext == ".farc") @@ -142,8 +141,8 @@ namespace PD_Tool { if (a3daArray[i].Data.PlayControl.Div == null) continue; int div = a3daArray[i].Data.PlayControl.Div.Value; - string filename = Path.GetFileNameWithoutExtension(list[i]); - string ext = Path.GetExtension(list[i]); + string filename = Path.RemoveExtension(list[i]); + string ext = Path.GetExtension(list[i]).ToLower(); KKdA3DA a3da; for (int i1 = 1; i1 < div; i1++) using (a3da = new KKdA3DA(true)) diff --git a/PD_Tool/classes/ADP.cs b/PD_Tool/classes/ADP.cs index 6089822..bf35a5b 100644 --- a/PD_Tool/classes/ADP.cs +++ b/PD_Tool/classes/ADP.cs @@ -17,9 +17,8 @@ namespace PD_Tool foreach (string file in fileNames) using (adp = new AddParam()) { - ext = Path.GetExtension(file); - filepath = file.Replace(ext, ""); - ext = ext.ToLower(); + filepath = Path.RemoveExtension(file); + ext = Path.GetExtension(file).ToLower(); Console.Title = "Add Param Converter: " + Path.GetFileNameWithoutExtension(file); if (ext == ".adp") diff --git a/PD_Tool/classes/AET.cs b/PD_Tool/classes/AET.cs index 34379fb..bbb7693 100644 --- a/PD_Tool/classes/AET.cs +++ b/PD_Tool/classes/AET.cs @@ -17,9 +17,8 @@ namespace PD_Tool foreach (string file in fileNames) using (aet = new Aet()) { - ext = Path.GetExtension(file); - filepath = file.Replace(ext, ""); - ext = ext.ToLower(); + filepath = Path.RemoveExtension(file); + ext = Path.GetExtension(file).ToLower(); Console.Title = "AET Converter: " + Path.GetFileNameWithoutExtension(file); if (ext == ".bin") diff --git a/PD_Tool/classes/BLT.cs b/PD_Tool/classes/BLT.cs index 130b561..247d57d 100644 --- a/PD_Tool/classes/BLT.cs +++ b/PD_Tool/classes/BLT.cs @@ -1,6 +1,6 @@ using System; -using KKdMainLib.IO; using KKdMainLib.F2; +using KKdMainLib.IO; namespace PD_Tool { @@ -17,9 +17,8 @@ namespace PD_Tool foreach (string file in fileNames) using (blt = new Bloom()) { - ext = Path.GetExtension(file); - filepath = file.Replace(ext, ""); - ext = ext.ToLower(); + filepath = Path.RemoveExtension(file); + ext = Path.GetExtension(file).ToLower(); Console.Title = "Bloom Converter: " + Path.GetFileNameWithoutExtension(file); if (ext == ".blt") diff --git a/PD_Tool/classes/CCT.cs b/PD_Tool/classes/CCT.cs index 621dc2b..24da77c 100644 --- a/PD_Tool/classes/CCT.cs +++ b/PD_Tool/classes/CCT.cs @@ -1,6 +1,6 @@ using System; -using KKdMainLib.IO; using KKdMainLib.F2; +using KKdMainLib.IO; namespace PD_Tool { @@ -17,9 +17,8 @@ namespace PD_Tool foreach (string file in fileNames) using (cct = new ColorCorrection()) { - ext = Path.GetExtension(file); - filepath = file.Replace(ext, ""); - ext = ext.ToLower(); + filepath = Path.RemoveExtension(file); + ext = Path.GetExtension(file).ToLower(); Console.Title = "Color Correction Converter: " + Path.GetFileNameWithoutExtension(file); if (ext == ".cct") diff --git a/PD_Tool/classes/DB.cs b/PD_Tool/classes/DB.cs index e0979ac..5c7867f 100644 --- a/PD_Tool/classes/DB.cs +++ b/PD_Tool/classes/DB.cs @@ -22,9 +22,8 @@ namespace PD_Tool KKdMainLib.DataBank db; foreach (string file in fileNames) { - ext = Path.GetExtension(file); - filepath = file.Replace(ext, ""); - ext = ext.ToLower(); + filepath = Path.RemoveExtension(file); + ext = Path.GetExtension(file).ToLower(); string filename = Path.GetFileNameWithoutExtension(file); file_split = filename.Split('_'); diff --git a/PD_Tool/classes/DEX.cs b/PD_Tool/classes/DEX.cs index aa4ecb0..6433a5d 100644 --- a/PD_Tool/classes/DEX.cs +++ b/PD_Tool/classes/DEX.cs @@ -46,9 +46,8 @@ namespace PD_Tool foreach (string file in fileNames) using (dex = new KKdDEX()) { - ext = Path.GetExtension(file); - filepath = file.Replace(ext, ""); - ext = ext.ToLower(); + filepath = Path.RemoveExtension(file); + ext = Path.GetExtension(file).ToLower(); Console.Title = "DEX Converter: " + Path.GetFileNameWithoutExtension(file); if (ext == ".bin" || ext == ".dex") dex. DEXReader(filepath, ext ); diff --git a/PD_Tool/classes/DFT.cs b/PD_Tool/classes/DFT.cs index 5718697..ef60640 100644 --- a/PD_Tool/classes/DFT.cs +++ b/PD_Tool/classes/DFT.cs @@ -1,6 +1,6 @@ using System; -using KKdMainLib.IO; using KKdMainLib.F2; +using KKdMainLib.IO; namespace PD_Tool { @@ -17,9 +17,8 @@ namespace PD_Tool foreach (string file in fileNames) using (dft = new DOF()) { - ext = Path.GetExtension(file); - filepath = file.Replace(ext, ""); - ext = ext.ToLower(); + filepath = Path.RemoveExtension(file); + ext = Path.GetExtension(file).ToLower(); Console.Title = "DOF Converter: " + Path.GetFileNameWithoutExtension(file); if (ext == ".dft") diff --git a/PD_Tool/classes/DIV.cs b/PD_Tool/classes/DIV.cs index 10eb323..07de57f 100644 --- a/PD_Tool/classes/DIV.cs +++ b/PD_Tool/classes/DIV.cs @@ -1,5 +1,5 @@ using System; -using System.IO; +using KKdMainLib.IO; using KKdSoundLib; namespace PD_Tool @@ -17,9 +17,8 @@ namespace PD_Tool foreach (string file in fileNames) { diva = new DIVA(); - ext = Path.GetExtension(file); - filepath = file.Replace(ext, ""); - ext = ext.ToLower(); + filepath = Path.RemoveExtension(file); + ext = Path.GetExtension(file).ToLower(); Console.Title = "DIVA Converter: " + Path.GetFileNameWithoutExtension(file); if (ext == ".diva") diva.DIVAReader(filepath); diff --git a/PD_Tool/classes/DataBase.cs b/PD_Tool/classes/DataBase.cs index 27510a9..bb28530 100644 --- a/PD_Tool/classes/DataBase.cs +++ b/PD_Tool/classes/DataBase.cs @@ -1,8 +1,6 @@ using System; -using System.IO; -using Aet = KKdMainLib.DB.Aet; -using Auth = KKdMainLib.DB.Auth; -using Spr = KKdMainLib.DB.Spr; +using KKdMainLib.DB; +using KKdMainLib.IO; namespace PD_Tool { @@ -45,8 +43,8 @@ namespace PD_Tool using (auth = new Auth()) { Console.Title = "Auth DB Converter: " + Path.GetFileNameWithoutExtension(file); - ext = Path.GetExtension(file).ToLower(); - filepath = file.Replace(Path.GetExtension(file), ""); + filepath = Path.RemoveExtension(file); + ext = Path.GetExtension(file).ToLower(); if (ext == ".bin") { @@ -73,8 +71,8 @@ namespace PD_Tool using (aet = new Aet()) { Console.Title = "AET DB Converter: " + Path.GetFileNameWithoutExtension(file); + filepath = Path.RemoveExtension(file); ext = Path.GetExtension(file).ToLower(); - filepath = file.Replace(Path.GetExtension(file), ""); if (ext == ".bin") { @@ -101,8 +99,8 @@ namespace PD_Tool using (spr = new Spr()) { Console.Title = "SPR DB Converter: " + Path.GetFileNameWithoutExtension(file); + filepath = Path.RemoveExtension(file); ext = Path.GetExtension(file).ToLower(); - filepath = file.Replace(Path.GetExtension(file), ""); if (ext == ".bin") { diff --git a/PD_Tool/classes/FARC.cs b/PD_Tool/classes/FARC.cs index b614f52..735d297 100644 --- a/PD_Tool/classes/FARC.cs +++ b/PD_Tool/classes/FARC.cs @@ -1,5 +1,5 @@ using System; -using System.IO; +using KKdMainLib.IO; using KKdFARC = KKdMainLib.FARC; namespace PD_Tool diff --git a/PD_Tool/classes/LIT.cs b/PD_Tool/classes/LIT.cs index 4272761..77a9ef8 100644 --- a/PD_Tool/classes/LIT.cs +++ b/PD_Tool/classes/LIT.cs @@ -17,9 +17,8 @@ namespace PD_Tool foreach (string file in fileNames) using (lit = new Light()) { - ext = Path.GetExtension(file); - filepath = file.Replace(ext, ""); - ext = ext.ToLower(); + filepath = Path.RemoveExtension(file); + ext = Path.GetExtension(file).ToLower(); Console.Title = "Light Converter: " + Path.GetFileNameWithoutExtension(file); if (ext == ".lit") diff --git a/PD_Tool/classes/MHD.cs b/PD_Tool/classes/MHD.cs index ed8ad1a..b46fb06 100644 --- a/PD_Tool/classes/MHD.cs +++ b/PD_Tool/classes/MHD.cs @@ -17,9 +17,8 @@ namespace PD_Tool foreach (string file in fileNames) using (mhd = new MotHead()) { - ext = Path.GetExtension(file); - filepath = file.Replace(ext, ""); - ext = ext.ToLower(); + filepath = Path.RemoveExtension(file); + ext = Path.GetExtension(file).ToLower(); Console.Title = "MotHead Converter: " + Path.GetFileNameWithoutExtension(file); if (ext == ".bin") diff --git a/PD_Tool/classes/STR.cs b/PD_Tool/classes/STR.cs index f84c264..2b68cbe 100644 --- a/PD_Tool/classes/STR.cs +++ b/PD_Tool/classes/STR.cs @@ -16,9 +16,8 @@ namespace PD_Tool foreach (string file in fileNames) using (str = new KKdSTR()) { - ext = Path.GetExtension(file); - filepath = file.Replace(ext, ""); - ext = ext.ToLower(); + filepath = Path.RemoveExtension(file); + ext = Path.GetExtension(file).ToLower(); Console.Title = "STR Converter: " + Path.GetFileNameWithoutExtension(file); if (ext == ".str" || ext == ".bin") diff --git a/PD_Tool/classes/TBL.cs b/PD_Tool/classes/TBL.cs index 6bdd239..07c5193 100644 --- a/PD_Tool/classes/TBL.cs +++ b/PD_Tool/classes/TBL.cs @@ -1,7 +1,7 @@ using System; -using System.IO; using KKdBaseLib; using KKdMainLib; +using KKdMainLib.IO; using KKdFARC = KKdMainLib.FARC; namespace PD_Tool @@ -19,9 +19,8 @@ namespace PD_Tool foreach (string file in fileNames) using (tbl = new Tables()) { - ext = Path.GetExtension(file); - filepath = file.Replace(ext, ""); - ext = ext.ToLower(); + filepath = Path.RemoveExtension(file); + ext = Path.GetExtension(file).ToLower(); Console.Title = "Table Converter: " + Path.GetFileNameWithoutExtension(file); if (ext == ".bin") diff --git a/PD_Tool/classes/VAG.cs b/PD_Tool/classes/VAG.cs index 6e5b25d..11e774d 100644 --- a/PD_Tool/classes/VAG.cs +++ b/PD_Tool/classes/VAG.cs @@ -1,5 +1,5 @@ using System; -using System.IO; +using KKdMainLib.IO; using KKdVAG = KKdSoundLib.VAG; namespace PD_Tool @@ -42,9 +42,8 @@ namespace PD_Tool foreach (string file in fileNames) using (VAG = new KKdVAG()) { - ext = Path.GetExtension(file); - filepath = file.Replace(ext, ""); - ext = ext.ToLower(); + filepath = Path.RemoveExtension(file); + ext = Path.GetExtension(file).ToLower(); Console.Title = "VAG Converter: " + Path.GetFileNameWithoutExtension(file); if (ext == ".vag") { VAG.VAGReader(filepath); VAG.WAVWriter(filepath ); }