This commit is contained in:
Timerix 2021-10-09 16:36:17 +03:00
parent 502d679848
commit 6602744325
8 changed files with 69 additions and 32 deletions

View File

@ -36,7 +36,9 @@
<Compile Include="Dtsod\DtsodV21.cs" />
<Compile Include="Dtsod\DtsodV22.cs" />
<Compile Include="cs9somefix.cs" />
<Compile Include="Dtsod\ValueTypes.cs" />
<Compile Include="Dtsod\V30\DtsodSerializableAttribute.cs" />
<Compile Include="Dtsod\V30\DtsodV30.cs" />
<Compile Include="Dtsod\V30\DtsodVersion.cs" />
<Compile Include="EventHandlerAsync.cs" />
<Compile Include="Filesystem\Directory.cs" />
<Compile Include="Filesystem\File.cs" />

View File

@ -16,6 +16,7 @@ namespace DTLib.Dtsod
// парсер теперь не может игнорировать комменты, потом починю
// теперь числовые значения конвертируются в правильный тип, а не в int64/uint64 (новый вариант switch из c#9.0 делал какую-то херню)
// исправлены некоторые другие баги
public class DtsodV21 : Dictionary<string, dynamic>
{
static readonly bool debug = false;
@ -82,15 +83,6 @@ namespace DTLib.Dtsod
List,
Complex,
String,
/*Double,
Long,
Ulong,
Short,
Ushort,
Int,
Uint,
Null,
Bool,*/
Default
}
@ -356,7 +348,6 @@ namespace DTLib.Dtsod
}
}
void Debug(params string[] msg)
{
if(debug)
@ -369,3 +360,4 @@ namespace DTLib.Dtsod
}
}
}

View File

@ -43,6 +43,23 @@ namespace DTLib.Dtsod
}
}
public enum ValueTypes
{
List,
Complex,
String,
Short,
Int,
Long,
UShort,
UInt,
ULong,
Double,
Null,
Bool,
Unknown
}
public DtsodV22() { }
public DtsodV22(string text)
@ -51,7 +68,6 @@ namespace DTLib.Dtsod
Add(pair.Key, pair.Value);
}
public DtsodV22(Dictionary<string, DtsodV22.ValueStruct> dict)
{
foreach(KeyValuePair<string, ValueStruct> pair in dict)

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTLib.Dtsod
{
public class DtsodSerializableAttribute : Attribute
{
public DtsodVersion Version;
public DtsodSerializableAttribute(DtsodVersion ver) => Version=ver;
}
}

23
Dtsod/V30/DtsodV30.cs Normal file
View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTLib.Dtsod
{
static public class DtsodV30
{
/*
public static DtsodV30 FromObject(object target)
{
}
public T ToObject<T>()
{
}
*/
}
}

View File

@ -0,0 +1,9 @@
namespace DTLib.Dtsod
{
public enum DtsodVersion : byte
{
V21 = 21,
V22 = 22,
V30 = 30
}
}

View File

@ -1,19 +0,0 @@
namespace DTLib.Dtsod
{
public enum ValueTypes
{
List,
Complex,
String,
Short,
Int,
Long,
UShort,
UInt,
ULong,
Double,
Null,
Bool,
Unknown
}
}

View File

@ -144,7 +144,7 @@ namespace DTLib.Network
if(!dirOnServer.EndsWith("\\"))
dirOnServer+="\\";
Debug("b", "downloading manifest <", "c", dirOnServer+"manifest.dtsod", "b", ">\n");
var manifest = new DtsodV22(SimpleConverter.ToString(DownloadFileToMemory(dirOnServer+"manifest.dtsod")));
var manifest = new Dtsod.DtsodV22(SimpleConverter.ToString(DownloadFileToMemory(dirOnServer+"manifest.dtsod")));
Debug("g", $"found {manifest.Values.Count} files in manifest\n");
var hasher = new Hasher();
foreach(string fileOnServer in manifest.Keys)