Compare commits

...
5 Commits
Author SHA1 Message Date
korenkonder cd2eab5b8e Release v0.4.9.4.2 (Hotfix)
STR
2020-06-19 19:09:36 +03:00
korenkonder 8dd10b2fa4 Release v0.4.9.4.1 (Hotfix)
STR
2020-06-19 18:57:04 +03:00
korenkonder 35dee99307 Release v0.4.9.4
A3DA, DEX, STR
2020-06-19 14:09:15 +03:00
korenkonder b49b86887e Release v0.4.9.3.2 (Hotfix)
CLI, Tables
2020-06-03 01:45:36 +03:00
korenkonder a0a3737b47 Release v0.4.9.3.1 (Hotfix)
AET
2020-05-27 18:02:32 +03:00
38 changed files with 420 additions and 434 deletions
+2 -2
View File
@@ -213,12 +213,12 @@ namespace KKdBaseLib.Auth2D
public CountPointer<Identifier> Identifiers;
public override string ToString() => $"Width: {Width}; Height: {Height}; Color: {Color:X2)}";
public struct Identifier
{
public Pointer<string> Name;
public uint ID;
public override string ToString() => $"ID: {ID}; Name: {Name}";
}
}
+2 -2
View File
@@ -7,7 +7,7 @@ namespace KKdBaseLib
public static double Acos (this double d ) => Math.Acos (d );
public static double Asin (this double d ) => Math.Asin (d );
public static double Atan (this double d ) => Math.Atan (d );
public static double Aсtg (this double d ) => 1 / Math.Atan (d );
public static double Actg (this double d ) => 1 / Math.Atan (d );
public static double Cos (this double d ) => Math.Cos (d );
public static double Cosh (this double val) => Math.Cosh (val);
public static double Sin (this double a ) => Math.Sin (a );
@@ -36,7 +36,7 @@ namespace KKdBaseLib
public static float Acos (this float d ) => (float) Math.Acos (d ) ;
public static float Asin (this float d ) => (float) Math.Asin (d ) ;
public static float Atan (this float d ) => (float) Math.Atan (d ) ;
public static float Aсtg (this float d ) => (float)(1 / Math.Atan (d ));
public static float Actg (this float d ) => (float)(1 / Math.Atan (d ));
public static float Cos (this float d ) => (float) Math.Cos (d ) ;
public static float Cosh (this float val) => (float) Math.Cosh (val) ;
public static float Sin (this float a ) => (float) Math.Sin (a ) ;
+1 -1
View File
@@ -77,7 +77,7 @@ namespace KKdBaseLib.F2
private int length(bool shiftX = false)
{
int length = 5;
int length = 6;
long offset = 0;
byte bitShift = (byte)(shiftX ? 3 : 2);
int max1 = 0x00100 >> bitShift;
+1 -1
View File
@@ -124,7 +124,7 @@ namespace KKdBaseLib.Interpolation
else result = frame > c.F ? n.V : c.V;
return result;
}
public void ResetFrameCount() { f = -df; t = f / rf; }
public override string ToString() => $"F: {f}; T: {t}; V: {v}";
+8 -5
View File
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Authors>korenkonder</Authors>
<Company></Company>
<Configuration></Configuration>
<Copyright>korenkonder © 2019-2020</Copyright>
<Copyright>korenkonder © 2019-2020</Copyright>
<Description>A base library</Description>
<FileVersion>0.4.9.3</FileVersion>
<FileVersion>0.4.9.4</FileVersion>
<PackageId>KKdBaseLib</PackageId>
<Product>KKdBaseLib</Product>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net461</TargetFramework>
<Title>KKdBaseLib</Title>
<Version>0.4.9.3</Version>
<Version>0.4.9.4</Version>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -39,4 +39,7 @@
<LangVersion>8.0</LangVersion>
<NoWarn>IDE0004, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0069, IDE1006</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="System.Windows.Forms" />
</ItemGroup>
</Project>
+3 -3
View File
@@ -73,7 +73,7 @@ namespace KKdBaseLib
public void Add(KeyValuePair<TKey, TValue> pair)
{
if (IsNull) return;
if (IsNull || ContainsKey(pair.Key)) return;
count++;
if (keyArray.Length < count) System.Array.Resize(ref keyArray, count);
@@ -84,7 +84,7 @@ namespace KKdBaseLib
public void Add(TKey key, TValue val)
{
if (IsNull) return;
if (IsNull || ContainsKey(key)) return;
count++;
if (keyArray.Length < count) System.Array.Resize(ref keyArray, count);
@@ -231,6 +231,6 @@ namespace KKdBaseLib
{ Key = key; Value = value; }
public override string ToString() =>
$"(Key: {Key}; value: {Value})";
$"(Key: {Key}; Value: {Value})";
}
}
+50 -23
View File
@@ -2,10 +2,9 @@ using System;
using System.Linq;
using System.Globalization;
using System.Collections.Generic;
using KKdBaseLib;
using A3DADict = System.Collections.Generic.Dictionary<string, object>;
namespace KKdMainLib
namespace KKdBaseLib
{
public static unsafe class Main
{
@@ -57,52 +56,62 @@ namespace KKdMainLib
return dict.ContainsKey(args[0]);
}
public static bool FV(this A3DADict dict, ref bool value, char split, string args) =>
public static bool FV (this A3DADict dict, ref bool value, char split, string args) =>
dict.FV(out string val, args.Split(split)) ? bool.TryParse(val, out value) : false;
public static bool FV(this A3DADict dict, ref int value, char split, string args) =>
public static bool FV (this A3DADict dict, ref int value, char split, string args) =>
dict.FV(out string val, args.Split(split)) ? int.TryParse(val, out value) : false;
public static bool FV(this A3DADict dict, ref float value, char split, string args) =>
public static bool FV (this A3DADict dict, ref float value, char split, string args) =>
dict.FV(out string val, args.Split(split)) ? val.ToF32(out value) : false;
public static bool FV(this A3DADict dict, ref double value, char split, string args) =>
public static bool FV (this A3DADict dict, ref double value, char split, string args) =>
dict.FV(out string val, args.Split(split)) ? val.ToF64(out value) : false;
public static bool FV(this A3DADict dict, ref string value, char split, string args)
public static bool FV (this A3DADict dict, ref string value, char split, string args)
{ if (dict.FV(out string val , args.Split(split)))
{ value = val; return true; } return false; }
{ value = val; return true; } return false; }
public static bool FV(this A3DADict dict, out bool value, string args)
public static bool FV (this A3DADict dict, out bool value, string args)
{ if (dict.FV(out string val , args.Split('.' )))
return bool.TryParse(val, out value); value = false; return false; }
public static bool FV(this A3DADict dict, out int value, string args)
public static bool FV (this A3DADict dict, out int value, string args)
{ if (dict.FV(out string val , args.Split('.' )))
return int.TryParse(val, out value); value = 0; return false; }
return int.TryParse(val, out value); value = 0; return false; }
public static bool FV(this A3DADict dict, out float value, string args)
public static bool FV (this A3DADict dict, out float value, string args)
{ if (dict.FV(out string val , args.Split('.' )))
return val.ToF32(out value); value = 0; return false; }
return val.ToF32(out value); value = 0; return false; }
public static bool FV(this A3DADict dict, out double value, string args)
public static bool FV (this A3DADict dict, out double value, string args)
{ if (dict.FV(out string val , args.Split('.' )))
return val.ToF64(out value); value = 0; return false; }
return val.ToF64(out value); value = 0; return false; }
public static bool FV(this A3DADict dict, out int? value, string args)
public static bool FV<T>(this A3DADict dict, out T value, string args) where T : struct
{ if (dict.FV(out string val , args.Split('.' )))
{ bool Val = int.TryParse(val, out int _value);
value = _value; return Val; } value = null; return false; }
{ bool Val = Enum.TryParse(val, out T _value); value = _value; return Val; }
value = default; return false; }
public static bool FV(this A3DADict dict, out float? value, string args)
public static bool FV (this A3DADict dict, out int? value, string args)
{ if (dict.FV(out string val , args.Split('.' )))
return val.ToF32(out value); value = null; return false; }
{ bool Val = int.TryParse(val, out int _value); value = _value; return Val; }
value = null; return false; }
public static bool FV(this A3DADict dict, out double? value, string args)
public static bool FV (this A3DADict dict, out float? value, string args)
{ if (dict.FV(out string val , args.Split('.' )))
return val.ToF64(out value); value = null; return false; }
return val.ToF32(out value); value = null; return false; }
public static bool FV(this A3DADict dict, out string value, string args) =>
public static bool FV (this A3DADict dict, out double? value, string args)
{ if (dict.FV(out string val , args.Split('.' )))
return val.ToF64(out value); value = null; return false; }
public static bool FV<T>(this A3DADict dict, out T? value, string args) where T : struct
{ if (dict.FV(out string val , args.Split('.' )))
{ bool Val = Enum.TryParse(val, out T _value); value = _value; return Val; }
value = null; return false; }
public static bool FV (this A3DADict dict, out string value, string args) =>
dict.FV(out value, args.Split('.' ));
public static bool FV(this A3DADict dict, out string value, string[] args)
@@ -129,6 +138,24 @@ namespace KKdMainLib
return true;
}
public static bool FK(this A3DADict dict, string args) =>
dict.FK(args.Split('.' ));
public static bool FK(this A3DADict dict, string[] args)
{
if (dict == null || args.Length < 1) return false;
args[0] = args[0].ToLower();
if (!dict.ContainsKey(args[0])) return false;
else if (args.Length > 1)
{
string[] newArgs = new string[args.Length - 1];
for (int i = 0; i < args.Length - 1; i++) newArgs[i] = args[i + 1];
return ((A3DADict)dict[args[0]]).FK(newArgs);
}
return true;
}
public static void GD(this A3DADict dict, string args, char split = '.')
{
string[] dataArray = args.Split('=');
+2 -2
View File
@@ -69,7 +69,7 @@ namespace KKdBaseLib
if (irow != icol)
for (int k = 0; k < 2; k++)
(inverse[irow, k], inverse[icol, k]) = (inverse[icol, k], inverse[irow, k]);
{ float t = inverse[irow, k]; inverse[irow, k] = inverse[icol, k]; inverse[icol, k] = t; }
rowIdx[i] = irow;
colIdx[i] = icol;
@@ -97,7 +97,7 @@ namespace KKdBaseLib
int ir = rowIdx[j];
int ic = colIdx[j];
for (int k = 0; k < 2; k++)
(inverse[k, ic], inverse[k, ir]) = (inverse[k, ir], inverse[k, ic]);
{ float t = inverse[k, ic]; inverse[k, ic] = inverse[k, ir]; inverse[k, ir] = t; }
}
result.Row0.X = inverse[0, 0]; result.Row0.Y = inverse[0, 1];
+2 -2
View File
@@ -154,7 +154,7 @@ namespace KKdBaseLib
if (irow != icol)
for (int k = 0; k < 3; k++)
(inverse[irow, k], inverse[icol, k]) = (inverse[icol, k], inverse[irow, k]);
{ float t = inverse[irow, k]; inverse[irow, k] = inverse[icol, k]; inverse[icol, k] = t; }
rowIdx[i] = irow;
colIdx[i] = icol;
@@ -182,7 +182,7 @@ namespace KKdBaseLib
int ir = rowIdx[j];
int ic = colIdx[j];
for (int k = 0; k < 3; k++)
(inverse[k, ic], inverse[k, ir]) = (inverse[k, ir], inverse[k, ic]);
{ float t = inverse[k, ic]; inverse[k, ic] = inverse[k, ir]; inverse[k, ir] = t; }
}
result.Row0.X = inverse[0, 0]; result.Row0.Y = inverse[0, 1]; result.Row0.Z = inverse[0, 2];
+2 -6
View File
@@ -181,7 +181,7 @@ namespace KKdBaseLib
if (irow != icol)
for (int k = 0; k < 4; k++)
(inverse[irow, k], inverse[icol, k]) = (inverse[icol, k], inverse[irow, k]);
{ float t = inverse[irow, k]; inverse[irow, k] = inverse[icol, k]; inverse[icol, k] = t; }
rowIdx[i] = irow;
colIdx[i] = icol;
@@ -209,11 +209,7 @@ namespace KKdBaseLib
int ir = rowIdx[j];
int ic = colIdx[j];
for (int k = 0; k < 4; k++)
{
float f = inverse[k, ir];
inverse[k, ir] = inverse[k, ic];
inverse[k, ic] = f;
}
{ float t = inverse[k, ic]; inverse[k, ic] = inverse[k, ir]; inverse[k, ir] = t; }
}
result.Row0.X = inverse[0, 0]; result.Row0.Y = inverse[0, 1];
+23 -1
View File
@@ -47,7 +47,12 @@ namespace KKdBaseLib
public MsgPack this[string key, bool array]
{ get { if (!array) return this[key];
if (Object is KKdList<MsgPack> List) { MsgPack MsgPack = List[ElementIndex(key)];
if (Object is KKdList<MsgPack> List) { MsgPack MsgPack = List[ElementIndex(key)];
return MsgPack.Object is MsgPack[] ? MsgPack : default; } return default; } }
public MsgPack this[bool startsWith, string key]
{ get { if (Object is KKdList<MsgPack> List) { MsgPack MsgPack =
List[startsWith ? ElementIndexStartsWith(key) : ElementIndex(key)];
return MsgPack.Object is MsgPack[] ? MsgPack : default; } return default; } }
public MsgPack Add(MsgPack obj)
@@ -377,6 +382,17 @@ namespace KKdBaseLib
return -1;
}
public bool ContainsKeyStartsWith(string name) => ElementIndexStartsWith(name) > -1;
public int ElementIndexStartsWith(string name)
{
if (List.IsNull) return -1;
for (int i = 0; i < List.Count; i++)
if (List[i].Name.StartsWith(name)) return i;
return -1;
}
public struct Ext
{
@@ -384,4 +400,10 @@ namespace KKdBaseLib
public byte[] Data;
}
}
public interface IMsgPack : INull
{
//public void ReadMsgPack();
public MsgPack WriteMsgPack(string name);
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
using System.Reflection;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
+1 -1
View File
@@ -1,4 +1,4 @@
namespace KKdBaseLib
namespace KKdBaseLib.Tables
{
public struct ButtonSE
{
+10 -8
View File
@@ -1487,10 +1487,10 @@ namespace KKdMainLib
{
_IO.P = A3DCEnd;
_IO.WEOFC(0);
_IO.O = 0;
_IO.O = 0;
_IO.P = 0;
Header header = new Header { Signature = 0x41443341, Format = Format.F2,
DataSize = A3DCEnd, SectionSize = A3DCEnd, InnerSignature = 0x01131010 };
Header header = new Header { Signature = 0x41443341, InnerSignature = 0x01131010,
Format = Format.F2, DataSize = A3DCEnd, SectionSize = A3DCEnd, UseSectionSize = true };
_IO.W(header, true);
}
@@ -1625,14 +1625,16 @@ namespace KKdMainLib
if (!a3dcOpt)
{
key.BinOffset = _IO.P;
_IO.W(( int)key.Type );
_IO.W((float)key.Value);
if (key.Type == KeyType.Null) _IO.W(0x00L);
else { _IO.W(( int)key.Type );
_IO.W((float)key.Value); }
}
else if (!usedValues.ContainsValue(key.Value))
{
key.BinOffset = _IO.P;
_IO.W(( int)key.Type );
_IO.W((float)key.Value);
if (key.Type == KeyType.Null) _IO.W(0x00L);
else { _IO.W(( int)key.Type );
_IO.W((float)key.Value); }
usedValues.Add(key.BinOffset, key.Value);
}
else key.BinOffset = usedValues.GK(key.Value);
@@ -1861,7 +1863,7 @@ namespace KKdMainLib
}
public void MsgPackWriter(string file, bool json) =>
MsgPackWriter().Write(true, file, json);
MsgPackWriter().Write(false, true, file, json);
private void MsgPackReader(MsgPack a3d)
{
+1 -1
View File
@@ -116,7 +116,7 @@ namespace KKdMainLib
addParam[i] = addParam[i].Add("Value", sub.Value);
}
addParam.WriteAfterAll(true, file, json);
addParam.WriteAfterAll(false, true, file, json);
}
public void Dispose()
+39 -39
View File
@@ -129,7 +129,7 @@ namespace KKdMainLib
for (i1 = 0; i1 < aet.Composition.C; i1++)
{ if (aet.Composition[i1].P == dataOffset) { obj.DataID = i1; break; } }
ref int parentLayer = ref obj.ParentLayer;
int parentLayer = obj.ParentLayer;
if (parentLayer > 0)
for (i1 = 0; i1 < aet.Composition.C; i1++)
{
@@ -185,7 +185,7 @@ namespace KKdMainLib
{
ref Layer obj = ref aet.Composition.E[i].E[i0];
ref VideoData video = ref obj.Video.V;
ref VideoData.Video3DData persp = ref video.Video3D.V;
ref VideoData.Video3DData video3DData = ref video.Video3D.V;
ref AudioData audio = ref obj.Audio.V;
if (obj.Marker.C > 0)
{
@@ -197,14 +197,14 @@ namespace KKdMainLib
if (obj.Video.V.Video3D.O > 0)
{
W(ref persp. AnchorZ);
W(ref persp. PositionZ);
W(ref persp.DirectionX);
W(ref persp.DirectionY);
W(ref persp.DirectionZ);
W(ref persp. RotationX);
W(ref persp. RotationY);
W(ref persp. ScaleZ);
W(ref video3DData. AnchorZ);
W(ref video3DData. PositionZ);
W(ref video3DData.DirectionX);
W(ref video3DData.DirectionY);
W(ref video3DData.DirectionZ);
W(ref video3DData. RotationX);
W(ref video3DData. RotationY);
W(ref video3DData. ScaleZ);
}
if (obj.Video.O > 0)
@@ -354,20 +354,20 @@ namespace KKdMainLib
{
ref Layer obj = ref aet.Composition.E[i].E[i0];
ref VideoData video = ref obj.Video.V;
ref VideoData.Video3DData persp = ref video.Video3D.V;
ref VideoData.Video3DData video3DData = ref video.Video3D.V;
ref AudioData audio = ref obj.Audio.V;
if (obj.Video.V.Video3D.O > 0)
{
_IO.P = video.Video3D.O;
W(ref _IO, ref persp. AnchorZ);
W(ref _IO, ref persp. PositionZ);
W(ref _IO, ref persp.DirectionX);
W(ref _IO, ref persp.DirectionY);
W(ref _IO, ref persp.DirectionZ);
W(ref _IO, ref persp. RotationX);
W(ref _IO, ref persp. RotationY);
W(ref _IO, ref persp. ScaleZ);
W(ref _IO, ref video3DData. AnchorZ);
W(ref _IO, ref video3DData. PositionZ);
W(ref _IO, ref video3DData.DirectionX);
W(ref _IO, ref video3DData.DirectionY);
W(ref _IO, ref video3DData.DirectionZ);
W(ref _IO, ref video3DData. RotationX);
W(ref _IO, ref video3DData. RotationY);
W(ref _IO, ref video3DData. ScaleZ);
}
if (obj.Video.O > 0)
@@ -543,25 +543,25 @@ namespace KKdMainLib
if (video.Video3D.O > 0)
{
ref VideoData.Video3DData Persp = ref video.Video3D.V;
ref VideoData.Video3DData video3DData = ref video.Video3D.V;
_IO.P = video.Video3D.O;
Persp.AnchorZ = _IO.ReadCountPointer<KFT2>();
Persp.PositionZ = _IO.ReadCountPointer<KFT2>();
Persp.DirectionX = _IO.ReadCountPointer<KFT2>();
Persp.DirectionY = _IO.ReadCountPointer<KFT2>();
Persp.DirectionZ = _IO.ReadCountPointer<KFT2>();
Persp. RotationX = _IO.ReadCountPointer<KFT2>();
Persp. RotationY = _IO.ReadCountPointer<KFT2>();
Persp. ScaleZ = _IO.ReadCountPointer<KFT2>();
video3DData. AnchorZ = _IO.ReadCountPointer<KFT2>();
video3DData. PositionZ = _IO.ReadCountPointer<KFT2>();
video3DData.DirectionX = _IO.ReadCountPointer<KFT2>();
video3DData.DirectionY = _IO.ReadCountPointer<KFT2>();
video3DData.DirectionZ = _IO.ReadCountPointer<KFT2>();
video3DData. RotationX = _IO.ReadCountPointer<KFT2>();
video3DData. RotationY = _IO.ReadCountPointer<KFT2>();
video3DData. ScaleZ = _IO.ReadCountPointer<KFT2>();
RKF(ref Persp. AnchorZ);
RKF(ref Persp. PositionZ);
RKF(ref Persp.DirectionX);
RKF(ref Persp.DirectionY);
RKF(ref Persp.DirectionZ);
RKF(ref Persp. RotationX);
RKF(ref Persp. RotationY);
RKF(ref Persp. ScaleZ);
RKF(ref video3DData. AnchorZ);
RKF(ref video3DData. PositionZ);
RKF(ref video3DData.DirectionX);
RKF(ref video3DData.DirectionY);
RKF(ref video3DData.DirectionZ);
RKF(ref video3DData. RotationX);
RKF(ref video3DData. RotationY);
RKF(ref video3DData. ScaleZ);
}
}
@@ -646,7 +646,7 @@ namespace KKdMainLib
MsgPack aet = new MsgPack(AET.Scenes.Length, "Aet");
for (int i = 0; i < AET.Scenes.Length; i++)
aet[i] = MsgPackWriter(ref AET.Scenes[i]);
aet.WriteAfterAll(true, file, json);
aet.WriteAfterAll(false, true, file, json);
}
public void MsgPackReader(MsgPack msgPack, ref Pointer<Scene> aetData)
@@ -689,7 +689,7 @@ namespace KKdMainLib
region.Width = temp[i].RU16("Width" );
region.Height = temp[i].RU16("Height");
region.Frames = temp[i].RF32("Frames");
using (MsgPack identifiers = temp[i]["Identifiers", true])
if (identifiers.NotNull)
{
@@ -936,7 +936,7 @@ namespace KKdMainLib
if (video.Video3D.O > 0)
{
ref VideoData.Video3DData video3D = ref video.Video3D.V;
MsgPack video3DData = new MsgPack("Persp");
MsgPack video3DData = new MsgPack("Video3DData");
video3DData.Add(WMP(ref video3D. AnchorZ, "AnchorZ"));
video3DData.Add(WMP(ref video3D. PositionZ, "PositionZ"));
video3DData.Add(WMP(ref video3D.DirectionX, "DirectionX"));
+1 -1
View File
@@ -213,7 +213,7 @@ namespace KKdMainLib.DB
for (i = 0; i < AetSets.Length; i++)
AetDB[i] = AetSets[i].WriteMsgPack();
AetDB.Write(true, file, json);
AetDB.Write(false, true, file, json);
}
private bool disposed = false;
+1 -1
View File
@@ -146,7 +146,7 @@ namespace KKdMainLib.DB
authDB.Add(uid);
}
authDB.Write(true, file, json);
authDB.Write(false, true, file, json);
}
private bool disposed = false;
+1 -1
View File
@@ -251,7 +251,7 @@ namespace KKdMainLib.DB
for (i = 0; i < SpriteSets.Length; i++)
sprDB[i] = SpriteSets[i].WriteMsgPack();
sprDB.Write(true, file, json);
sprDB.Write(false, true, file, json);
}
private bool disposed = false;
+5 -2
View File
@@ -83,7 +83,9 @@ namespace KKdMainLib
_IO = File.OpenWriter(filepath + (format > Format.F && format < Format.FT ? ".dex" : ".bin"), true);
header.Format = _IO.Format = format;
_IO.Format = format;
_IO.O = format > Format.F ? 0x20 : 0;
_IO.P = 0;
_IO.W(0x64);
_IO.W(Dex.Length);
@@ -157,7 +159,8 @@ namespace KKdMainLib
header.DataSize = offset;
header.SectionSize = offset;
header.Signature = 0x43505845;
_IO.W(header, true);
header.UseSectionSize = true;
_IO.W(header);
}
_IO.C();
}
@@ -218,7 +221,7 @@ namespace KKdMainLib
dex[i0] = exp;
}
dex.Write(true, file, json);
dex.Write(false, true, file, json);
}
private bool disposed;
+2 -2
View File
@@ -133,7 +133,7 @@ namespace KKdMainLib
}
else msgPack.Add(new MsgPack("PvList", null));
}
msgPack.Write(file, json).Dispose();
msgPack.Write(file, false, json).Dispose();
}
public static string UrlEncode(string value) =>
@@ -177,7 +177,7 @@ namespace KKdMainLib
.Add(p2.WriteMP("P2")).Add(p3.WriteMP("P3"));
public override string ToString() =>
UrlEncode($"{p1.ToString()},{p2.ToString()},{p3.ToString()},{PV_ID}");
UrlEncode($"{p1},{p2},{p3},{PV_ID}");
}
public struct Player
+21 -19
View File
@@ -60,7 +60,7 @@ namespace KKdMainLib
}
public static void WEOFC(this Stream stream, int depth = 0) =>
stream.W(new Header { Depth = depth, Length = 0x20, Signature = 0x43464F45 });
stream.W(new Header { Depth = depth, Length = 0x20, Signature = 0x43464F45, UseSectionSize = true });
}
public static class POFExtensions
@@ -68,11 +68,13 @@ namespace KKdMainLib
public static void W(this Stream stream, POF pof, bool shiftX = false, int depth = 0)
{
byte[] data = pof.Write(shiftX);
Header header = new Header { Depth = depth, Format = Format.F2,
Length = 0x20, Signature = shiftX ? 0x31464F50 : 0x30464F50 };
header.DataSize = header.SectionSize = data.Length;
Header header = new Header { Depth = depth, Format = Format.F2, Length = 0x20,
Signature = shiftX ? 0x31464F50 : 0x30464F50, UseSectionSize = true };
header.DataSize = header.SectionSize = data.Length.A(0x10);
stream.W(header);
stream.W(data);
for (int c = data.Length.A(0x10) - data.Length; c > 0; c--)
stream.W((byte)0);
}
}
@@ -82,7 +84,7 @@ namespace KKdMainLib
{
byte[] data = enrs.Write();
Header header = new Header { Depth = depth, Format = Format.F2,
Length = 0x20, Signature = 0x53524E45 };
Length = 0x20, Signature = 0x53524E45, UseSectionSize = true };
header.DataSize = header.SectionSize = data.Length;
stream.W(header);
stream.W(data);
@@ -184,35 +186,35 @@ namespace KKdMainLib
return MsgPack;
}
public static void Write(this MsgPack mp, bool temp, string file, bool json = false)
{ if (temp) MsgPack.New.Add(mp).Write(file, json).Dispose();
else mp .Write(file, json); }
public static void Write(this MsgPack mp, bool ignoreNull, bool temp, string file, bool json = false)
{ if (temp) MsgPack.New.Add(mp).Write(file, ignoreNull, json).Dispose();
else mp .Write(file, ignoreNull, json); }
public static MsgPack Write(this MsgPack mp, string file, bool json = false)
public static MsgPack Write(this MsgPack mp, string file, bool ignoreNull, bool json = false)
{
if (json) using (JSON _IO = new JSON(File.OpenWriter(file + ".json", true))) _IO.W(mp, "\n", " ");
else using ( MP _IO = new MP(File.OpenWriter(file + ".mp" , true))) _IO.W(mp);
if (json) using (JSON _IO = new JSON(File.OpenWriter(file + ".json", true))) _IO.W(mp, ignoreNull, "\n", " ");
else using ( MP _IO = new MP(File.OpenWriter(file + ".mp" , true))) _IO.W(mp, ignoreNull);
return mp;
}
public static void WriteAfterAll(this MsgPack mp, bool temp, string file, bool json = false)
{ if (temp) MsgPack.New.Add(mp).WriteAfterAll(file, json).Dispose();
else mp .WriteAfterAll(file, json); }
public static void WriteAfterAll(this MsgPack mp, bool ignoreNull, bool temp, string file, bool json = false)
{ if (temp) MsgPack.New.Add(mp).WriteAfterAll(file, ignoreNull, json).Dispose();
else mp .WriteAfterAll(file, ignoreNull, json); }
public static MsgPack WriteAfterAll(this MsgPack mp, string file, bool json = false)
public static MsgPack WriteAfterAll(this MsgPack mp, string file, bool ignoreNull, bool json = false)
{
byte[] data = null;
if (json) using (JSON _IO = new JSON(File.OpenWriter())) { _IO.W(mp, true); data = _IO.ToArray(); }
else using ( MP _IO = new MP(File.OpenWriter())) { _IO.W(mp ); data = _IO.ToArray(); }
if (json) using (JSON _IO = new JSON(File.OpenWriter())) { _IO.W(mp, ignoreNull, true); data = _IO.ToArray(); }
else using ( MP _IO = new MP(File.OpenWriter())) { _IO.W(mp, ignoreNull ); data = _IO.ToArray(); }
File.WriteAllBytes(file + (json ? ".json" : ".mp"), data);
return mp;
}
public static void ToJSON (this string file) =>
file.ReadMP( ).Write(file, true).Dispose();
file.ReadMP( ).Write(file, false, true).Dispose();
public static void ToMsgPack(this string file) =>
file.ReadMP(true).Write(file ).Dispose();
file.ReadMP(true).Write(file, false ).Dispose();
}
public static class IKFExt
+10 -12
View File
@@ -57,9 +57,9 @@ namespace KKdMainLib
reader.RI32();
int farcMode = reader.RI32E(true);
Format = (FARCType & Type.ECB) != 0 && (farcMode & (farcMode - 1)) != 0 ? Format.FT : Format.DT;
Format = (FARCType & Type.Enc) != 0 && (farcMode & (farcMode - 1)) != 0 ? Format.FT : Format.DT;
if (Format == Format.FT && (FARCType & Type.ECB) != 0)
if (Format == Format.FT && (FARCType & Type.Enc) != 0)
{
reader.Dispose();
byte[] header = new byte[headerLength - 0x08];
@@ -155,18 +155,17 @@ namespace KKdMainLib
return file.Data;
}
int FileSize = (FARCType & Type.ECB) != 0 || (file.Type & Type.ECB) != 0 ?
file.SizeComp.A(0x10) : ((FARCType & Type.GZip) != 0 || (file.Type & Type.GZip) != 0 ? file.SizeComp : file.SizeUnc);
int FileSize = ((FARCType | file.Type) & Type.Enc) != 0 ? file.SizeComp.A(0x10)
: (((FARCType | file.Type) & Type.GZip) != 0 ? file.SizeComp : file.SizeUnc);
using (Stream stream = File.OpenReader(FilePath))
{
stream.S(file.Offset, 0);
file.Data = stream.RBy(FileSize);
}
if ((FARCType & Type.ECB) != 0)
if ((FARCType & Type.Enc) != 0)
{
if (Format == Format.FT && (file.Type & Type.ECB) != 0)
if (Format == Format.FT && (file.Type & Type.Enc) != 0)
{
using (AesManaged aes = GetAes(true, null))
using (CryptoStream cryptoStream = new CryptoStream(new MSIO.MemoryStream(file.Data),
@@ -181,8 +180,7 @@ namespace KKdMainLib
cryptoStream.Read(file.Data, 0, FileSize);
}
if (((Format == Format.FT && (file.Type & Type.GZip) != 0) ||
(FARCType & Type.GZip) != 0) && file.SizeUnc > 0)
if (((file.Type | FARCType) & Type.GZip) != 0 && file.SizeUnc > 0)
file.Data = file.Data.InflateGZip(file.SizeUnc);
Files[i] = file;
@@ -223,7 +221,7 @@ namespace KKdMainLib
public void Save()
{
if (!HasFiles) return;
if (!HasFiles || (Signature != Farc.FArc && Signature != Farc.FArC && Signature != Farc.FARC)) return;
for (int i = 0; i < Files.Count; i++)
{
@@ -292,7 +290,7 @@ namespace KKdMainLib
file.SizeComp = data.Length;
}
if (Signature == Farc.FARC && (FARCType & Type.ECB) != 0)
if (Signature == Farc.FARC && (FARCType & Type.Enc) != 0)
{
int alignLength = data.Length.A(0x40);
byte[] tempData = new byte[alignLength];
@@ -347,7 +345,7 @@ namespace KKdMainLib
{
None = 0b000,
GZip = 0b010,
ECB = 0b100,
Enc = 0b100,
}
}
}
+13 -12
View File
@@ -175,18 +175,19 @@ namespace KKdMainLib.IO
{ string s = ""; while (char.IsDigit(_IO.SW().
PCUTF8())) s += _IO.RCUTF8(); return s; }
public JSON W(MsgPack msgPack, string end = "\n", string tabChar = " ") =>
W(msgPack, end, tabChar, "", true);
public JSON W(MsgPack msgPack, bool ignoreNull, string end = "\n", string tabChar = " ") =>
W(msgPack, ignoreNull, end, tabChar, "", true);
public JSON W(MsgPack msgPack, bool style = false) =>
W(msgPack, "\n", " ", "", style);
public JSON W(MsgPack msgPack, bool ignoreNull, bool style = false) =>
W(msgPack, ignoreNull, "\n", " ", "", style);
private JSON W(MsgPack msgPack, string end, string tabChar, string tab, bool style, bool isArray = false)
private JSON W(MsgPack msgPack, bool ignoreNull, string end,
string tabChar, string tab, bool style, bool isArray = false)
{
string oldTab = tab;
tab += tabChar;
if (msgPack.Name != null && !isArray) _IO.W("\"" + msgPack.Name + "\":" + (style ? " " : ""));
if (msgPack.Object == null) { WN(); return this; }
if (msgPack.Name != null && !isArray ) _IO.W("\"" + msgPack.Name + "\":" + (style ? " " : ""));
if (msgPack.Object == null) { if (!ignoreNull) WN(); return this; }
if (msgPack.List.NotNull)
{
@@ -196,14 +197,14 @@ namespace KKdMainLib.IO
for (int i = 0; i < msgPack.List.Count; i++)
{
if (style) _IO.W(tab);
W(msgPack.List[i], end, tabChar, tab, style);
W(msgPack.List[i], ignoreNull, end, tabChar, tab, style);
if (i + 1 < msgPack.List.Count) _IO.W(',');
if (style) _IO.W(end);
}
else if (msgPack.List.Count == 1)
{
if (style) _IO.W(tab);
W(msgPack.List[0], end, tabChar, tab, style);
W(msgPack.List[0], ignoreNull, end, tabChar, tab, style);
if (style) _IO.W(end);
}
if (style) _IO.W(oldTab);
@@ -217,20 +218,20 @@ namespace KKdMainLib.IO
for (int i = 0; i < msgPack.Array.Length; i++)
{
if (style) _IO.W(tab);
W(msgPack.Array[i], end, tabChar, tab, style, true);
W(msgPack.Array[i], ignoreNull, end, tabChar, tab, style, true);
if (i + 1 < msgPack.Array.Length) _IO.W(',');
if (style) _IO.W(end);
}
else if (msgPack.Array.Length == 1)
{
if (style) _IO.W(tab);
W(msgPack.Array[0], end, tabChar, tab, style, true);
W(msgPack.Array[0], ignoreNull, end, tabChar, tab, style, true);
if (style) _IO.W(end);
}
if (style) _IO.W(oldTab);
WA(true);
}
else if (msgPack.Object is MsgPack msg) W(msg, end, tabChar, tab, style);
else if (msgPack.Object is MsgPack msg) W(msg, ignoreNull, end, tabChar, tab, style);
else if (msgPack.Object is string str) W(str);
else _IO.W(BaseExtensions.ToS(msgPack.Object));
+7 -7
View File
@@ -166,23 +166,23 @@ namespace KKdMainLib.IO
return true;
}
public MP W(MsgPack msgPack, bool IsArray = false)
public MP W(MsgPack msgPack, bool ignoreNull, bool IsArray = false)
{
if (msgPack.Name != null && !IsArray) W(msgPack.Name);
Write(msgPack.Object);
Write(msgPack.Object, ignoreNull);
return this;
}
private void Write(object obj)
private void Write(object obj, bool ignoreNull)
{
if (obj == null) { WN(); return; }
if (obj == null) { if (!ignoreNull) WN(); return; }
switch (obj)
{
case KKdList<MsgPack> val: WM(val.Count );
for (int i = 0; i < val.Count ; i++) W(val[i]); break;
for (int i = 0; i < val.Count ; i++) W(val[i], ignoreNull); break;
case MsgPack[] val: WA(val.Length);
for (int i = 0; i < val.Length; i++) W(val[i]); break;
case MsgPack val: W(val); break;
for (int i = 0; i < val.Length; i++) W(val[i], ignoreNull); break;
case MsgPack val: W(val, ignoreNull); break;
case byte[] val: W(val); break;
case bool val: W(val); break;
case sbyte val: W(val); break;
+18 -5
View File
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Authors>korenkonder</Authors>
<Company></Company>
<Configuration></Configuration>
<Copyright>korenkonder © 2018-2020</Copyright>
<Copyright>korenkonder © 2018-2020</Copyright>
<Description>A simple library for working with Project Diva AC/DT/F/AFT/F2/X/FT/M39 files</Description>
<FileVersion>0.4.9.3</FileVersion>
<FileVersion>0.4.9.4</FileVersion>
<PackageId>KKdMainLib</PackageId>
<Product>KKdMainLib</Product>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net461</TargetFramework>
<Title>KKdMainLib</Title>
<Version>0.4.9.3</Version>
<Version>0.4.9.4</Version>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -42,4 +42,17 @@
<ItemGroup>
<ProjectReference Include="..\KKdBaseLib\KKdBaseLib.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>
+1 -1
View File
@@ -184,7 +184,7 @@ namespace KKdMainLib
MsgPack mot = new MsgPack(motCount, "MOT");
for (i = 0; i < motCount; i++)
mot[i] = MsgPackWriter(ref MOT[i]);
mot.Write(true, file, json);
mot.Write(false, true, file, json);
}
public void MsgPackReader(MsgPack msgPack, ref MotHeader mot)
+2 -2
View File
@@ -127,7 +127,7 @@ RETURN:
Header. EndMotionID = Header.Data[i].MotionID;
}
_IO = File.OpenWriter(file + ".bin");
_IO = File.OpenWriter(file + ".bin", true);
_IO.W(0x01);
_IO.W(0x20);
_IO.A(0x20, true);
@@ -674,7 +674,7 @@ RETURN:
I++;
}
motHead.Add(motions);
motHead.WriteAfterAll(true, file, json);
motHead.WriteAfterAll(false, true, file, json);
}
private static int GetSize(int Type) =>
+1 -1
View File
@@ -1,4 +1,4 @@
using System.Reflection;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
+9 -9
View File
@@ -1,4 +1,4 @@
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
@@ -10,8 +10,8 @@
namespace KKdMainLib.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
@@ -23,15 +23,15 @@ namespace KKdMainLib.Properties {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
@@ -45,7 +45,7 @@ namespace KKdMainLib.Properties {
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
@@ -59,7 +59,7 @@ namespace KKdMainLib.Properties {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
+37 -28
View File
@@ -22,6 +22,8 @@ namespace KKdMainLib
if (header.Signature == 0x41525453)
{
header = _IO.ReadHeader(true, false);
_IO.IsBE = header.UseBigEndian;
_IO.Format = header.Format;
int count = _IO.RI32E();
int offset = _IO.RI32E();
@@ -41,20 +43,18 @@ namespace KKdMainLib
}
else
{
_IO.P -= 4;
if ((header.Signature >> 24) > 0) { header.Format = Format.DT; _IO.IsBE = true; }
else header.Format = Format.F;
int count = 0;
for (int a = 0, i = 0; _IO.P > 0 && _IO.P < _IO.L; i++, count++)
{
a = _IO.RI32();
if (a == 0) break;
}
for (int i = header.Signature; i != 0 && _IO.P >= 0 && _IO.P < _IO.L; count++)
i = _IO.RI32();
Strings = new String[count];
_IO.P = 0;
for (int i = 0; i < count; i++)
{
_IO.PI64 = Strings[i].Str.O;
Strings[i].ID = i;
Strings[i].Str.V = _IO.NTUTF8();
Strings[i].Str.V = _IO.RSaO();
}
}
@@ -67,9 +67,11 @@ namespace KKdMainLib
if (Strings == null || Strings.Length == 0 || header.Format > Format.F2) return;
uint offset = 0;
uint currentOffset = 0;
Format format = header.Format;
_IO = File.OpenWriter(filepath + (header.Format > Format.AFT &&
header.Format < Format.FT ? ".str" : ".bin"), true);
_IO.Format = header.Format;
_IO.IsBE = header.UseBigEndian;
pof.Offsets = KKdList<long>.New;
long count = Strings.LongLength;
@@ -80,35 +82,34 @@ namespace KKdMainLib
_IO.WX(0x80);
_IO.P = 0x80;
for (int i = 0; i < count; i++) _IO.W(0x00L);
_IO.A(0x10);
}
else
{
for (int i = 0; i < count; i++) _IO.W(0x00);
_IO.A(0x20);
}
_IO.A(0x10);
KKdList<string> usedSTR = KKdList<string>.New;
KKdList<int> usedSTRPos = KKdList<int>.New;
int[] STRPos = new int[count];
usedSTRPos.Add(_IO.P);
usedSTR.Add("");
_IO.W(0);
for (int i = 0; i < count; i++)
{
if (!usedSTR.Contains(Strings[i].Str.V))
if (usedSTR.Contains(Strings[i].Str.V))
{
STRPos[i] = _IO.P;
usedSTRPos.Add(STRPos[i]);
usedSTR.Add(Strings[i].Str.V);
_IO.W(Strings[i].Str.V);
_IO.W(0);
for (int i2 = 0; i2 < count; i2++)
if (usedSTR[i2] == Strings[i].Str.V)
{ STRPos[i] = usedSTRPos[i2]; break; }
}
else
for (int i2 = 0; i2 < count; i2++)
if (usedSTR[i2] == Strings[i].Str.V) { STRPos[i] = usedSTRPos[i2]; break; }
{
usedSTRPos.Add(STRPos[i] = _IO.P);
usedSTR.Add(Strings[i].Str.V);
_IO.W(Strings[i].Str.V);
_IO.W((byte)0);
if (format < Format.F) _IO.A(0x8);
}
}
_IO.A(0x4);
_IO.L = _IO.P;
if (_IO.Format > Format.AFT)
{
@@ -124,32 +125,39 @@ namespace KKdMainLib
_IO.PU32 = offset;
_IO.W(pof, false, 1);
_IO.WEOFC(1);
currentOffset = _IO.PU32;
_IO.WEOFC();
header.DataSize = (int)(currentOffset - 0x40);
header.Signature = 0x41525453;
header.SectionSize = (int)(offset - 0x40);
header.UseSectionSize = true;
_IO.P = 0;
_IO.W(header, true);
}
else
{
_IO.P = 0;
for (int i = 0; i < count; i++) _IO.W(STRPos[i]);
_IO.IsBE = header.Format < Format.F;
for (int i = 0; i < count; i++) _IO.WE(STRPos[i]);
}
_IO.C();
}
public void MsgPackReader(string file, bool json)
{
header = default;
Strings = default;
MsgPack temp;
MsgPack msgPack = file.ReadMPAllAtOnce(json);
if ((temp = msgPack["STR"]).NotNull) return;
if ((temp = msgPack["STR"]).IsNull) return;
header = new Header();
System.Enum.TryParse(temp.RS("Format"), out header.Format);
if (!System.Enum.TryParse(temp.RS("Format"), out header.Format)) return;
bool? isBE = temp.RnB("UseBigEndian");
if (isBE.HasValue) header.UseBigEndian = isBE.Value;
if ((temp = msgPack["Strings", true]).IsNull) return;
if ((temp = temp["Strings", true]).IsNull) return;
Strings = new String[temp.Array.Length];
for (int i = 0; i < Strings.Length; i++)
@@ -166,6 +174,7 @@ namespace KKdMainLib
{
if (Strings == null || Strings.Length == 0) return;
MsgPack str = new MsgPack("STR").Add("Format", header.Format.ToString());
if (header.UseBigEndian) str.Add("UseBigEndian", header.UseBigEndian);
MsgPack strings = new MsgPack(Strings.Length, "Strings");
for (int i = 0; i < Strings.Length; i++)
{
@@ -176,7 +185,7 @@ namespace KKdMainLib
}
str.Add(strings);
str.WriteAfterAll(true, file, json);
str.WriteAfterAll(false, true, file, json);
}
private bool disposed;
+12 -11
View File
@@ -1,5 +1,6 @@
using KKdBaseLib;
using KKdMainLib.IO;
using KKdBaseLib.Tables;
using TableDict = System.Collections.Generic.Dictionary<string, object>;
namespace KKdMainLib
@@ -256,18 +257,18 @@ namespace KKdMainLib
static TableDate GetStartTableDate(TableDict dict, string name)
{
TableDate date = default; date.SDL(); int val;
if (dict.FV(out val, name + "st_day" )) date.Day = val;
if (dict.FV(out val, name + "st_month")) date.Month = val;
if (dict.FV(out val, name + "st_year" )) date.Year = val;
if (dict.FV(out val, name + "st_month")) date.Month = val;
if (dict.FV(out val, name + "st_day" )) date.Day = val;
return date;
}
static TableDate GetEndTableDate(TableDict dict, string name)
{
TableDate date = default; date.SDU(); int val;
if (dict.FV(out val, name + "ed_day" )) date.Day = val;
if (dict.FV(out val, name + "ed_month")) date.Month = val;
if (dict.FV(out val, name + "ed_year" )) date.Year = val;
if (dict.FV(out val, name + "ed_month")) date.Month = val;
if (dict.FV(out val, name + "ed_day" )) date.Day = val;
return date;
}
}
@@ -458,14 +459,14 @@ namespace KKdMainLib
W(name + "id" , pv.ID );
W(name + "ignore", pv.Ignore);
W(name + "name" , pv.Name );
WriteDifficulty(_IO, name + "extreme.", pv.Normal );
WriteDifficulty(_IO, name + "normal.", pv.Normal );
}
W("pv_list.data_list.length", length);
_IO.D();
static void WriteDifficulty(Stream _IO, string name, PV.Difficulty[] arr)
{
if (arr == null) { _IO.W($"{name}.length=0\n"); return; }
if (arr == null) { _IO.W($"{name}length=0\n"); return; }
int length = arr.Length;
int[] so = length.SW();
@@ -473,12 +474,12 @@ namespace KKdMainLib
{
ref PV.Difficulty diff = ref arr[so[i]];
WriteStartTableDate(_IO, $"{name}{i}.", diff.Start);
_IO.W($"{name}{i}.edition" + $"={diff.Edition}\n");
WriteEndTableDate(_IO, $"{name}{i}.", diff.End );
_IO.W($"{name}{i}.edition" + $"={diff.Edition}\n");
WriteStartTableDate(_IO, $"{name}{i}.", diff.Start);
_IO.W($"{name}{i}.ver" + $"={diff.Version}\n");
}
_IO.W($"{name}.length={length}\n");
_IO.W($"{name}length={length}\n");
}
}
else if (SlideSETable != null)
@@ -679,7 +680,7 @@ namespace KKdMainLib
pltMP.R("ShadowColorR", out plt.ShadowColorR);
}
}
else if ((temp = msgPack["PV", true]).NotNull)
else if ((temp = msgPack["PVList", true]).NotNull)
{
PVList = new PV[temp.Array.Length];
for (i0 = 0; i0 < PVList.Length; i0++)
@@ -942,7 +943,7 @@ namespace KKdMainLib
}
msgPack.Add(sliderTouchSETable);
}
if (msgPack.List.Count == 1) msgPack.Write(file, json);
if (msgPack.List.Count == 1) msgPack.Write(file, false, json);
}
private bool disposed;
+3 -3
View File
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Authors>korenkonder</Authors>
<Company></Company>
<Configuration></Configuration>
<Copyright>korenkonder © 2019-2020</Copyright>
<Copyright>korenkonder © 2019-2020</Copyright>
<Description>A simple library for working with Project Diva F/AFT/F2/X/FT audio files</Description>
<FileVersion>0.1.2.0</FileVersion>
<PackageId>KKdSoundLib</PackageId>
<Product>KKdSoundLib</Product>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net461</TargetFramework>
<Title>KKdSoundLib</Title>
<Version>0.1.2.0</Version>
</PropertyGroup>
+1 -1
View File
@@ -1,4 +1,4 @@
using System.Reflection;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
+84 -183
View File
@@ -1,184 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{7B5D5A3A-A6F8-4813-C97D-ACFC98F7397E}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>PD_Tool</RootNamespace>
<AssemblyName>PD_Tool</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<RunPostBuildEvent>Always</RunPostBuildEvent>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\build\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>8.0</LangVersion>
<NoWarn>IDE0004, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0069, IDE1006</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>embedded</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\build\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DebugSymbols>true</DebugSymbols>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>8.0</LangVersion>
<NoWarn>IDE0004, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0069, IDE1006</NoWarn>
</PropertyGroup>
<ItemGroup>
<Compile Include="classes\A3D.cs" />
<Compile Include="classes\ADP.cs" />
<Compile Include="classes\AET.cs" />
<Compile Include="classes\BLT.cs" />
<Compile Include="classes\CCT.cs" />
<Compile Include="classes\DataBase.cs" />
<Compile Include="classes\DB.cs" />
<Compile Include="classes\DEX.cs" />
<Compile Include="classes\DFT.cs" />
<Compile Include="classes\DIV.cs" />
<Compile Include="classes\DIVAFILE.cs" />
<Compile Include="classes\FARC.cs" />
<Compile Include="classes\LIT.cs" />
<Compile Include="classes\MHD.cs" />
<Compile Include="classes\MOT.cs" />
<Compile Include="classes\STR.cs" />
<Compile Include="classes\TBL.cs" />
<Compile Include="classes\VAG.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Numerics" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\KKdBaseLib\KKdBaseLib.csproj">
<Project>{437f63f1-8c23-429e-ab14-38b85c9edb16}</Project>
<Name>KKdBaseLib</Name>
</ProjectReference>
<ProjectReference Include="..\KKdMainLib\KKdMainLib.csproj">
<Project>{2ba7efc6-91d1-8bbc-c487-06c7f36cc789}</Project>
<Name>KKdMainLib</Name>
</ProjectReference>
<ProjectReference Include="..\KKdSoundLib\KKdSoundLib.csproj">
<Project>{d8a3f2d7-10cc-5723-ec9a-45d3b9c2df77}</Project>
<Name>KKdSoundLib</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>del Microsoft.Win32.Primitives.dll
del netstandard.dll
del PD_Tool.exe.config
del System.AppContext.dll
del System.Collections.Concurrent.dll
del System.Collections.dll
del System.Collections.NonGeneric.dll
del System.Collections.Specialized.dll
del System.ComponentModel.dll
del System.ComponentModel.EventBasedAsync.dll
del System.ComponentModel.Primitives.dll
del System.ComponentModel.TypeConverter.dll
del System.Console.dll
del System.Data.Common.dll
del System.Diagnostics.Contracts.dll
del System.Diagnostics.Debug.dll
del System.Diagnostics.FileVersionInfo.dll
del System.Diagnostics.Process.dll
del System.Diagnostics.StackTrace.dll
del System.Diagnostics.TextWriterTraceListener.dll
del System.Diagnostics.Tools.dll
del System.Diagnostics.TraceSource.dll
del System.Diagnostics.Tracing.dll
del System.Drawing.Primitives.dll
del System.Dynamic.Runtime.dll
del System.Globalization.Calendars.dll
del System.Globalization.dll
del System.Globalization.Extensions.dll
del System.IO.Compression.dll
del System.IO.Compression.ZipFile.dll
del System.IO.dll
del System.IO.FileSystem.dll
del System.IO.FileSystem.DriveInfo.dll
del System.IO.FileSystem.Primitives.dll
del System.IO.FileSystem.Watcher.dll
del System.IO.IsolatedStorage.dll
del System.IO.MemoryMappedFiles.dll
del System.IO.Pipes.dll
del System.IO.UnmanagedMemoryStream.dll
del System.Linq.dll
del System.Linq.Expressions.dll
del System.Linq.Parallel.dll
del System.Linq.Queryable.dll
del System.Net.Http.dll
del System.Net.NameResolution.dll
del System.Net.NetworkInformation.dll
del System.Net.Ping.dll
del System.Net.Primitives.dll
del System.Net.Requests.dll
del System.Net.Security.dll
del System.Net.Sockets.dll
del System.Net.WebHeaderCollection.dll
del System.Net.WebSockets.Client.dll
del System.Net.WebSockets.dll
del System.ObjectModel.dll
del System.Reflection.dll
del System.Reflection.Extensions.dll
del System.Reflection.Primitives.dll
del System.Resources.Reader.dll
del System.Resources.ResourceManager.dll
del System.Resources.Writer.dll
del System.Runtime.CompilerServices.VisualC.dll
del System.Runtime.dll
del System.Runtime.Extensions.dll
del System.Runtime.Handles.dll
del System.Runtime.InteropServices.dll
del System.Runtime.InteropServices.RuntimeInformation.dll
del System.Runtime.Numerics.dll
del System.Runtime.Serialization.Formatters.dll
del System.Runtime.Serialization.Json.dll
del System.Runtime.Serialization.Primitives.dll
del System.Runtime.Serialization.Xml.dll
del System.Security.Claims.dll
del System.Security.Cryptography.Algorithms.dll
del System.Security.Cryptography.Csp.dll
del System.Security.Cryptography.Encoding.dll
del System.Security.Cryptography.Primitives.dll
del System.Security.Cryptography.X509Certificates.dll
del System.Security.Principal.dll
del System.Security.SecureString.dll
del System.Text.Encoding.dll
del System.Text.Encoding.Extensions.dll
del System.Text.RegularExpressions.dll
del System.Threading.dll
del System.Threading.Overlapped.dll
del System.Threading.Tasks.dll
del System.Threading.Tasks.Parallel.dll
del System.Threading.Thread.dll
del System.Threading.ThreadPool.dll
del System.Threading.Timer.dll
del System.ValueTuple.dll
del System.Xml.ReaderWriter.dll
del System.Xml.XDocument.dll
del System.Xml.XmlDocument.dll
del System.Xml.XmlSerializer.dll
del System.Xml.XPath.dll
del System.Xml.XPath.XDocument.dll</PostBuildEvent>
</PropertyGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{7B5D5A3A-A6F8-4813-C97D-ACFC98F7397E}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>PD_Tool</RootNamespace>
<AssemblyName>PD_Tool</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<RunPostBuildEvent>Always</RunPostBuildEvent>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\build\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>8.0</LangVersion>
<NoWarn>IDE0004, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0069, IDE1006</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>embedded</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\build\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DebugSymbols>true</DebugSymbols>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>8.0</LangVersion>
<NoWarn>IDE0004, IDE0044, IDE0045, IDE0046, IDE0055, IDE0059, IDE0069, IDE1006</NoWarn>
</PropertyGroup>
<ItemGroup>
<Compile Include="classes\A3D.cs" />
<Compile Include="classes\ADP.cs" />
<Compile Include="classes\AET.cs" />
<Compile Include="classes\BLT.cs" />
<Compile Include="classes\CCT.cs" />
<Compile Include="classes\DataBase.cs" />
<Compile Include="classes\DB.cs" />
<Compile Include="classes\DEX.cs" />
<Compile Include="classes\DFT.cs" />
<Compile Include="classes\DIV.cs" />
<Compile Include="classes\DIVAFILE.cs" />
<Compile Include="classes\FARC.cs" />
<Compile Include="classes\LIT.cs" />
<Compile Include="classes\MHD.cs" />
<Compile Include="classes\MOT.cs" />
<Compile Include="classes\STR.cs" />
<Compile Include="classes\TBL.cs" />
<Compile Include="classes\VAG.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Numerics" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\KKdBaseLib\KKdBaseLib.csproj">
<Project>{437f63f1-8c23-429e-ab14-38b85c9edb16}</Project>
<Name>KKdBaseLib</Name>
</ProjectReference>
<ProjectReference Include="..\KKdMainLib\KKdMainLib.csproj">
<Project>{2ba7efc6-91d1-8bbc-c487-06c7f36cc789}</Project>
<Name>KKdMainLib</Name>
</ProjectReference>
<ProjectReference Include="..\KKdSoundLib\KKdSoundLib.csproj">
<Project>{d8a3f2d7-10cc-5723-ec9a-45d3b9c2df77}</Project>
<Name>KKdSoundLib</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+39 -31
View File
@@ -1,4 +1,4 @@
using System;
using System;
using System.Windows.Forms;
using KKdMainLib;
using KKdMainLib.IO;
@@ -29,7 +29,8 @@ namespace PD_Tool
foreach (string arg in args)
{
GC.Collect();
if (Directory.Exists(arg)) using (KKdFARC FARC = new KKdFARC(arg, true)) FARC.Pack();
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))
@@ -46,7 +47,7 @@ namespace PD_Tool
private static void MainMenu()
{
Console.Title = "PD_Tool v0.4.9.3";
Console.Title = "PD_Tool v0.4.9.4";
Console.Clear();
ConsoleDesign(true);
@@ -106,8 +107,8 @@ namespace PD_Tool
ConsoleDesign("5. DIVA" );
ConsoleDesign("6. MotHead" );
ConsoleDesign("7. MOT" );
ConsoleDesign("8. Table" );
ConsoleDesign("9. STR" );
ConsoleDesign("8. STR" );
ConsoleDesign("9. Table" );
ConsoleDesign(false);
ConsoleDesign("R. Return to Main Menu");
ConsoleDesign(false);
@@ -123,8 +124,8 @@ namespace PD_Tool
else if (localChoose == "5") DIV.Processor();
else if (localChoose == "6") MHD.Processor(json);
else if (localChoose == "7") MOT.Processor(json);
else if (localChoose == "8") TBL.Processor(json);
else if (localChoose == "9") STR.Processor(json);
else if (localChoose == "8") STR.Processor(json);
else if (localChoose == "9") TBL.Processor(json);
else choose = localChoose;
}
else if (choose[0] == '6')
@@ -191,26 +192,31 @@ namespace PD_Tool
}
else if (choose[0] == '8')
{
Console.Clear();
Console.Title = "FT/M39 Converting Tools";
ConsoleDesign(true);
ConsoleDesign(" Choose converter:");
ConsoleDesign(false);
ConsoleDesign("1. A3DA" );
ConsoleDesign("2. AddParam");
ConsoleDesign("3. AET" );
ConsoleDesign("4. DEX" );
ConsoleDesign("5. DIVA" );
ConsoleDesign("6. MotHead" );
ConsoleDesign("7. MOT" );
ConsoleDesign("8. Table" );
ConsoleDesign("9. STR" );
ConsoleDesign(false);
ConsoleDesign("R. Return to Main Menu");
ConsoleDesign(false);
ConsoleDesign(true);
Console.WriteLine();
string localChoose = Console.ReadLine().ToUpper();
string localChoose = "";
if (choose.Length == 1)
{
Console.Clear();
Console.Title = "FT/M39 Converting Tools";
ConsoleDesign(true);
ConsoleDesign(" Choose converter:");
ConsoleDesign(false);
ConsoleDesign("1. A3DA" );
ConsoleDesign("2. AddParam");
ConsoleDesign("3. AET" );
ConsoleDesign("4. DEX" );
ConsoleDesign("5. DIVA" );
ConsoleDesign("6. MotHead" );
ConsoleDesign("7. MOT" );
ConsoleDesign("8. STR" );
ConsoleDesign("9. Table" );
ConsoleDesign(false);
ConsoleDesign("R. Return to Main Menu");
ConsoleDesign(false);
ConsoleDesign(true);
Console.WriteLine();
localChoose = Console.ReadLine().ToUpper();
}
else localChoose = choose[1].ToString();
if (localChoose == "1") A3D.Processor(json);
else if (localChoose == "2") ADP.Processor(json);
else if (localChoose == "3") AET.Processor(json);
@@ -218,8 +224,8 @@ namespace PD_Tool
else if (localChoose == "5") DIV.Processor();
else if (localChoose == "6") MHD.Processor(json);
else if (localChoose == "7") MOT.Processor(json);
else if (localChoose == "8") TBL.Processor(json);
else if (localChoose == "9") STR.Processor(json);
else if (localChoose == "8") STR.Processor(json);
else if (localChoose == "9") TBL.Processor(json);
else choose = localChoose;
}
else if (choose == "9")
@@ -241,7 +247,7 @@ namespace PD_Tool
}
public static void Exit() => Environment.Exit(0);
public static void ConsoleDesign(string text, params string[] args)
{
text = string.Format(text, args);
@@ -289,6 +295,8 @@ namespace PD_Tool
string Filter = GetArgs("All;", false, "*");
if (filetype == "a3da") Filter = GetArgs("A3DA", "a3da", "farc", "json", "mp") +
GetArgs("A3DA", true, "a3da") + GetArgs("FARC", true, "farc") + json + mp;
else if (filetype == "adp" ) Filter = GetArgs("ADP" , "adp", "json", "mp") +
GetArgs("ADP", true, "adp" ) + json + mp;
else if (filetype == "bin" ) Filter = GetArgs("BIN" , "bin", "json", "mp") +
bin + json + mp;
else if (filetype == "blt" ) Filter = GetArgs("BLT" , "blt");
@@ -312,7 +320,7 @@ namespace PD_Tool
bin + GetArgs("FARC Archives", true, "farc") + json + mp;
else if (filetype == "vag" ) Filter = GetArgs("VAG" , "vag", "wav") +
GetArgs("VAG", true, "vag") + wav;
using OpenFileDialog ofd = new OpenFileDialog { //InitialDirectory = Application.StartupPath,
Filter = Filter, Multiselect = true, Title = "Choose file(s) to open:" };
if (ofd.ShowDialog() == DialogResult.OK) FileNames = ofd.FileNames;
+3 -3
View File
@@ -1,4 +1,4 @@
using System.Reflection;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("PD_Tool")]
@@ -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.3")]
[assembly: AssemblyFileVersion("0.4.9.3")]
[assembly: AssemblyVersion("0.4.9.4")]
[assembly: AssemblyFileVersion("0.4.9.4")]
+1 -1
View File
@@ -64,7 +64,7 @@ namespace PD_Tool
Console.WriteLine();
choose = Console.ReadLine().ToUpper();
if (choose == "2" || choose == "4") farc.FARCType |= KKdFARC.Type.GZip;
if (choose == "3" || choose == "4") farc.FARCType |= KKdFARC.Type.ECB ;
if (choose == "3" || choose == "4") farc.FARCType |= KKdFARC.Type.Enc ;
}
else if (choose == "R") return;
else farc.Signature = KKdFARC.Farc.FArC;