From 6602744325583956fb0a2fc144b642aa42a709c1 Mon Sep 17 00:00:00 2001 From: Timerix Date: Sat, 9 Oct 2021 16:36:17 +0300 Subject: [PATCH] 030 --- DTLib.csproj | 4 +++- Dtsod/DtsodV21.cs | 12 ++---------- Dtsod/DtsodV22.cs | 18 +++++++++++++++++- Dtsod/V30/DtsodSerializableAttribute.cs | 14 ++++++++++++++ Dtsod/V30/DtsodV30.cs | 23 +++++++++++++++++++++++ Dtsod/V30/DtsodVersion.cs | 9 +++++++++ Dtsod/ValueTypes.cs | 19 ------------------- Network/FSP.cs | 2 +- 8 files changed, 69 insertions(+), 32 deletions(-) create mode 100644 Dtsod/V30/DtsodSerializableAttribute.cs create mode 100644 Dtsod/V30/DtsodV30.cs create mode 100644 Dtsod/V30/DtsodVersion.cs delete mode 100644 Dtsod/ValueTypes.cs diff --git a/DTLib.csproj b/DTLib.csproj index 3fe8d3d..5cf8ac1 100644 --- a/DTLib.csproj +++ b/DTLib.csproj @@ -36,7 +36,9 @@ - + + + diff --git a/Dtsod/DtsodV21.cs b/Dtsod/DtsodV21.cs index d4bdda4..112b828 100644 --- a/Dtsod/DtsodV21.cs +++ b/Dtsod/DtsodV21.cs @@ -16,6 +16,7 @@ namespace DTLib.Dtsod // парсер теперь не может игнорировать комменты, потом починю // теперь числовые значения конвертируются в правильный тип, а не в int64/uint64 (новый вариант switch из c#9.0 делал какую-то херню) // исправлены некоторые другие баги + public class DtsodV21 : Dictionary { 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 } } } + diff --git a/Dtsod/DtsodV22.cs b/Dtsod/DtsodV22.cs index 587968d..f5124a0 100644 --- a/Dtsod/DtsodV22.cs +++ b/Dtsod/DtsodV22.cs @@ -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 dict) { foreach(KeyValuePair pair in dict) diff --git a/Dtsod/V30/DtsodSerializableAttribute.cs b/Dtsod/V30/DtsodSerializableAttribute.cs new file mode 100644 index 0000000..6a0ea48 --- /dev/null +++ b/Dtsod/V30/DtsodSerializableAttribute.cs @@ -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; + } +} diff --git a/Dtsod/V30/DtsodV30.cs b/Dtsod/V30/DtsodV30.cs new file mode 100644 index 0000000..2bef564 --- /dev/null +++ b/Dtsod/V30/DtsodV30.cs @@ -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() + { + + } + */ + } +} diff --git a/Dtsod/V30/DtsodVersion.cs b/Dtsod/V30/DtsodVersion.cs new file mode 100644 index 0000000..a64ee93 --- /dev/null +++ b/Dtsod/V30/DtsodVersion.cs @@ -0,0 +1,9 @@ +namespace DTLib.Dtsod +{ + public enum DtsodVersion : byte + { + V21 = 21, + V22 = 22, + V30 = 30 + } +} diff --git a/Dtsod/ValueTypes.cs b/Dtsod/ValueTypes.cs deleted file mode 100644 index a7664c1..0000000 --- a/Dtsod/ValueTypes.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace DTLib.Dtsod -{ - public enum ValueTypes - { - List, - Complex, - String, - Short, - Int, - Long, - UShort, - UInt, - ULong, - Double, - Null, - Bool, - Unknown - } -} diff --git a/Network/FSP.cs b/Network/FSP.cs index d038e44..db7462d 100644 --- a/Network/FSP.cs +++ b/Network/FSP.cs @@ -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)