diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index add01fa..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,31 +0,0 @@
-#ignorar miniaturas creadas por windows
-Thumbs.db
-#Ignorar archivos construidos por Visual Studio
-*.obj
-*.exe
-*.pdb
-*.user
-*.aps
-*.pch
-*.vspscc
-*_i.c
-*_p.c
-*.ncb
-*.suo
-*.tlb
-*.tlh
-*.bak
-*.cache
-*.ilk
-*.log
-[Bb]in
-[Dd]ebug*/
-*.lib
-*.sbr
-obj/
-[Rr]elease*/
-_ReSharper*/
-*.userprefs
-*.nupkg
-/.vs/*
-/packages/*
diff --git a/.idea/.idea.VAR.Json/.idea/.gitignore b/.idea/.idea.VAR.Json/.idea/.gitignore
deleted file mode 100644
index 60335c0..0000000
--- a/.idea/.idea.VAR.Json/.idea/.gitignore
+++ /dev/null
@@ -1,13 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
-# Rider ignored files
-/contentModel.xml
-/.idea.VAR.Json.iml
-/modules.xml
-/projectSettingsUpdater.xml
-# Editor-based HTTP Client requests
-/httpRequests/
-# Datasource local storage ignored files
-/dataSources/
-/dataSources.local.xml
diff --git a/.idea/.idea.VAR.Json/.idea/encodings.xml b/.idea/.idea.VAR.Json/.idea/encodings.xml
deleted file mode 100644
index df87cf9..0000000
--- a/.idea/.idea.VAR.Json/.idea/encodings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/.idea/.idea.VAR.Json/.idea/indexLayout.xml b/.idea/.idea.VAR.Json/.idea/indexLayout.xml
deleted file mode 100644
index 7b08163..0000000
--- a/.idea/.idea.VAR.Json/.idea/indexLayout.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/.idea.VAR.Json/.idea/vcs.xml b/.idea/.idea.VAR.Json/.idea/vcs.xml
deleted file mode 100644
index 94a25f7..0000000
--- a/.idea/.idea.VAR.Json/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/LICENSE.txt b/LICENSE.txt
deleted file mode 100644
index 41c79b1..0000000
--- a/LICENSE.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2016-2022 Valeriano Alfonso Rodriguez
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
\ No newline at end of file
diff --git a/README.md b/README.md
deleted file mode 100644
index 585983a..0000000
--- a/README.md
+++ /dev/null
@@ -1,59 +0,0 @@
-# .Net library for JSON parsing
-
-## Usage
-
-### VAR.Json
-
-Add the resulting assembly as reference in your projects, and this line on code:
-
-```csharp
-using VAR.Json;
-```
-
-Parse any string with JSON content:
-
-```csharp
-object result = JsonParser.ParseText("{\"Test\": 1}");
-```
-
-Serialize any object to JSON:
-
-```csharp
-string jsonText = JsonWriter.WriteObject(new List{1, 2, 3, 4});
-```
-
-### VAR.Json.JsonParser
-
-This object can be invoked with a list of types used to cast the json objects.
-
-```csharp
-
-class Person
-{
- public string Name { get; set; }
- public string Surname { get; set; }
- public DateTime DateOfBirth { get; set; }
-}
-
-JsonParser jsonParser = new JsonParser();
-jsonParser.KnownTypes.Add(typeof(Person));
-Person jsonText = jsonParser.Parse("{ \"Name\": \"John", \"Surname\": \"Doe\", \"DateOfBirth\": \"1970-01-01\"}") as Person;
-```
-
-## Building
-
-A Visual Studio solution is provided. Simply, click build on the IDE.
-
-The build generates a DLL and a Nuget package.
-
-## Contributing
-
-1. Fork it!
-2. Create your feature branch: `git checkout -b my-new-feature`
-3. Commit your changes: `git commit -am 'Add some feature'`
-4. Push to the branch: `git push origin my-new-feature`
-5. Submit a pull request :D
-
-## Credits
-
-* Valeriano Alfonso Rodriguez.
diff --git a/VAR.Json.Tests/JsonParser_Tests.cs b/VAR.Json.Tests/JsonParser_Tests.cs
deleted file mode 100644
index 0b4d264..0000000
--- a/VAR.Json.Tests/JsonParser_Tests.cs
+++ /dev/null
@@ -1,488 +0,0 @@
-using System.Collections.Generic;
-using Xunit;
-
-namespace VAR.Json.Tests
-{
- public class JsonParser_Tests
- {
- #region Parse
-
- private class SwallowObject
- {
- public string Text { get; set; }
- public int Number { get; set; }
- }
-
- [Fact]
- public void Parse__SwallowObject()
- {
- JsonParser parser = new JsonParser();
- parser.KnownTypes.Add(typeof(SwallowObject));
- SwallowObject result = parser.Parse(@"{""Text"": ""AAAA"", ""Number"": 42}") as SwallowObject;
- Assert.False(parser.Tainted);
- Assert.Equal("AAAA", result?.Text);
- Assert.Equal(42, result.Number);
- }
-
- private class DeeperObject_L1
- {
- public string Name { get; set; }
- public SwallowObject Object { get; set; }
- }
-
- [Fact]
- public void Parse__DeeperObject_L1()
- {
- JsonParser parser = new JsonParser();
- parser.KnownTypes.Add(typeof(SwallowObject));
- parser.KnownTypes.Add(typeof(DeeperObject_L1));
- DeeperObject_L1 result =
- parser.Parse(@"{""Name"": ""Thing"", ""Object"": {""Text"": ""AAAA"", ""Number"": 42}}") as
- DeeperObject_L1;
- Assert.False(parser.Tainted);
- Assert.Equal("Thing", result.Name);
- Assert.Equal("AAAA", result.Object.Text);
- Assert.Equal(42, result.Object.Number);
- }
-
- private class DeeperObject_L2
- {
- public int Count { get; set; }
- public DeeperObject_L1 Object { get; set; }
- }
-
- [Fact]
- public void Parse__DeeperObject_L2()
- {
- JsonParser parser = new JsonParser();
- parser.KnownTypes.Add(typeof(SwallowObject));
- parser.KnownTypes.Add(typeof(DeeperObject_L1));
- parser.KnownTypes.Add(typeof(DeeperObject_L2));
- DeeperObject_L2 result =
- parser.Parse(
- @"{""Count"": 1, ""Object"": {""Name"": ""Thing"", ""Object"": {""Text"": ""AAAA"", ""Number"": 42}}}")
- as DeeperObject_L2;
- Assert.False(parser.Tainted);
- Assert.Equal(1, result.Count);
- Assert.Equal("Thing", result.Object.Name);
- Assert.Equal("AAAA", result.Object.Object.Text);
- Assert.Equal(42, result.Object.Object.Number);
- }
-
- [Fact]
- public void Parse__SwallowObjectArray()
- {
- JsonParser parser = new JsonParser();
- parser.KnownTypes.Add(typeof(SwallowObject));
- List result = parser.Parse(@"[{""Text"": ""AAAA"", ""Number"": 42}]") as List;
- Assert.False(parser.Tainted);
- Assert.Single(result);
- Assert.Equal("AAAA", result[0].Text);
- Assert.Equal(42, result[0].Number);
- }
-
- private class DeeperObjectArray_L1
- {
- public int Count { get; set; }
- public List Array { get; set; }
- }
-
- [Fact]
- public void Parse__DeeperObjectArray_L1()
- {
- JsonParser parser = new JsonParser();
- parser.KnownTypes.Add(typeof(SwallowObject));
- parser.KnownTypes.Add(typeof(DeeperObjectArray_L1));
- DeeperObjectArray_L1 result =
- parser.Parse(@"{""Count"": 1, ""Array"": [{""Text"": ""AAAA"", ""Number"": 42}]}") as
- DeeperObjectArray_L1;
- Assert.False(parser.Tainted);
- Assert.Equal(1, result.Count);
- Assert.Equal("AAAA", result.Array[0].Text);
- Assert.Equal(42, result.Array[0].Number);
- }
-
- private class DeeperObjectArray_L2
- {
- public string Name { get; set; }
- public List Objects { get; set; }
- }
-
- [Fact]
- public void Parse__DeeperObjectArray_L2()
- {
- JsonParser parser = new JsonParser();
- parser.KnownTypes.Add(typeof(SwallowObject));
- parser.KnownTypes.Add(typeof(DeeperObjectArray_L1));
- parser.KnownTypes.Add(typeof(DeeperObjectArray_L2));
- DeeperObjectArray_L2 result =
- parser.Parse(
- @"{""Name"": ""Thing"", ""Objects"": [{""Count"": 1, ""Array"": [{""Text"": ""AAAA"", ""Number"": 42}]}]}")
- as DeeperObjectArray_L2;
- Assert.False(parser.Tainted);
- Assert.Equal("Thing", result.Name);
- Assert.Equal(1, result.Objects[0].Count);
- Assert.Equal("AAAA", result.Objects[0].Array[0].Text);
- Assert.Equal(42, result.Objects[0].Array[0].Number);
- }
-
- #endregion Parse
-
- #region Validity tests
-
- [Fact]
- public void Parse__Validity_Fail01()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"""A JSON payload should be an object or array, not a string.""");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail02()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"[""Unclosed array""");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail03()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"{unquoted_key: ""keys must be quoted""}");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail04()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"[""extra comma"",]");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail05()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"[""double extra comma"",,]");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail06()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"[ , ""<-- missing value""]");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail07()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"[""Comma after the close""],");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail08()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"[""Extra close""]]");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail09()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"{""Extra comma"": true,}");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail10()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"{""Extra value after close"": true} ""misplaced quoted value""");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail11()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"{""Illegal expression"": 1 + 2}");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail12()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"{""Illegal invocation"": alert()}");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail13()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"{""Numbers cannot have leading zeroes"": 013}");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail14()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"{""Numbers cannot be hex"": 0x14}");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail15()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"[""Illegal backslash escape: \x15""]");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail16()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"[\naked]");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail17()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"[""Illegal backslash escape: \017""]");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail18()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"[[[[[[[[[[[[[[[[[[[[""Too deep""]]]]]]]]]]]]]]]]]]]]");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail19()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"{""Missing colon"" null}");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail20()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"{""Double colon"":: null}");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail21()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"{""Comma instead of colon"", null}");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail22()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"[""Colon instead of comma"": false]");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail23()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"[""Bad value"", truth]");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail24()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"['single quote']");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail25()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"["" tab character in string ""]");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail26()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"[""tab\ character\ in\ string\ ""]");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail27()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"[""line
-break""]");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail28()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"[""line\
-break""]");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail29()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"[0e]");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail30()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"[0e+]");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail31()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"[0e+-1]");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail32()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"{""Comma instead if closing brace"": true,");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Fail33()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"[""mismatch""}");
- Assert.True(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Pass01()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"[
- ""JSON Test Pattern pass1"",
- {""object with 1 member"":[""array with 1 element""]},
- {},
- [],
- -42,
- true,
- false,
- null,
- {
- ""integer"": 1234567890,
- ""real"": -9876.543210,
- ""e"": 0.123456789e-12,
- ""E"": 1.234567890E+34,
- """": 23456789012E66,
- ""zero"": 0,
- ""one"": 1,
- ""space"": "" "",
- ""quote"": ""\"""",
- ""backslash"": ""\\"",
- ""controls"": ""\b\f\n\r\t"",
- ""slash"": ""/ & \/"",
- ""alpha"": ""abcdefghijklmnopqrstuvwyz"",
- ""ALPHA"": ""ABCDEFGHIJKLMNOPQRSTUVWYZ"",
- ""digit"": ""0123456789"",
- ""0123456789"": ""digit"",
- ""special"": ""`1~!@#$%^&*()_+-={':[,]}|;.>?"",
- ""hex"": ""\u0123\u4567\u89AB\uCDEF\uabcd\uef4A"",
- ""true"": true,
- ""false"": false,
- ""null"": null,
- ""array"":[ ],
- ""object"":{ },
- ""address"": ""50 St. James Street"",
- ""url"": ""http://www.JSON.org/"",
- ""comment"": ""// /* */"": "" "",
- "" s p a c e d "" :[1,2 , 3
-
-,
-
-4 , 5 , 6 ,7 ],""compact"":[1,2,3,4,5,6,7],
- ""jsontext"": ""{\""object with 1 member\"":[\""array with 1 element\""]}"",
- ""quotes"": """ \u0022 %22 0x22 034 """,
- ""\/\\\""\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?""
-: ""A key can be any string""
- },
- 0.5 ,98.6
-,
-99.44
-,
-
-1066,
-1e1,
-0.1e1,
-1e-1,
-1e00,2e+00,2e-00
-,""rosebud""]");
- Assert.False(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Pass02()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"[[[[[[[[[[[[[[[[[[[""Not too deep""]]]]]]]]]]]]]]]]]]]");
- Assert.False(parser.Tainted);
- }
-
- [Fact]
- public void Parse__Validity_Pass03()
- {
- JsonParser parser = new JsonParser();
- parser.Parse(@"{
- ""JSON Test Pattern pass3"": {
- ""The outermost value"": ""must be an object or array."",
- ""In this test"": ""It is an object.""
- }
-}
-");
- Assert.False(parser.Tainted);
- }
-
- #endregion Validity tests
- }
-}
\ No newline at end of file
diff --git a/VAR.Json.Tests/VAR.Json.Tests.csproj b/VAR.Json.Tests/VAR.Json.Tests.csproj
deleted file mode 100644
index 5f882ac..0000000
--- a/VAR.Json.Tests/VAR.Json.Tests.csproj
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
- net5.0
-
- false
-
-
-
-
-
-
- runtime; build; native; contentfiles; analyzers; buildtransitive
- all
-
-
- runtime; build; native; contentfiles; analyzers; buildtransitive
- all
-
-
-
-
-
-
-
-
diff --git a/VAR.Json.sln b/VAR.Json.sln
deleted file mode 100644
index adb0708..0000000
--- a/VAR.Json.sln
+++ /dev/null
@@ -1,37 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.30330.147
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VAR.Json", "VAR.Json\VAR.Json.csproj", "{28B3F937-145C-4FD4-A75B-A25EA4CC0428}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Notes", "Notes", "{4C23A421-5348-48F1-8B67-A4D43E616FDE}"
- ProjectSection(SolutionItems) = preProject
- LICENSE.txt = LICENSE.txt
- README.md = README.md
- EndProjectSection
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VAR.Json.Tests", "VAR.Json.Tests\VAR.Json.Tests.csproj", "{0E955F4D-49A9-40BC-94F7-7E2EDB30713B}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {28B3F937-145C-4FD4-A75B-A25EA4CC0428}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {28B3F937-145C-4FD4-A75B-A25EA4CC0428}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {28B3F937-145C-4FD4-A75B-A25EA4CC0428}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {28B3F937-145C-4FD4-A75B-A25EA4CC0428}.Release|Any CPU.Build.0 = Release|Any CPU
- {0E955F4D-49A9-40BC-94F7-7E2EDB30713B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {0E955F4D-49A9-40BC-94F7-7E2EDB30713B}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {0E955F4D-49A9-40BC-94F7-7E2EDB30713B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {0E955F4D-49A9-40BC-94F7-7E2EDB30713B}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {B9700B54-1919-4B81-B123-D4D3DE74124A}
- EndGlobalSection
-EndGlobal
diff --git a/VAR.Json.sln.DotSettings b/VAR.Json.sln.DotSettings
deleted file mode 100644
index 5de9805..0000000
--- a/VAR.Json.sln.DotSettings
+++ /dev/null
@@ -1,55 +0,0 @@
-
- NotRequired
- True
- True
- TOGETHER_SAME_LINE
- True
- True
- False
- True
- True
- True
- OneStep
- OneStep
- True
- UseVarWhenEvident
- UseVarWhenEvident
- AES
- AM
- AUX
- CYC
- DC
- DES
- EPM
- GDI
- ID
- IP
- RECT
- RGB
- SCART
- SPDIF
- SQL
- SRCCOPY
- TCP
- URL
- USB
- VAR
- WMIC
- YRYBY
- False
- <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb_AaBb" />
- <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb_AaBb"><ExtraRule Prefix="T" Suffix="" Style="AaBb_AaBb" /></Policy>
- <Policy Inspect="True" Prefix="I" Suffix="" Style="AaBb_AaBb" />
- <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb_AaBb" />
- <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb_AaBb" />
- <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb_AaBb" />
- <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb_AaBb" />
- <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb_AaBb" />
- <Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb_AaBb" />
- <Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb_AaBb" />
- <Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb_AaBb" />
- <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb_AaBb" />
- <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb_AaBb" />
- <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
- <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb_AaBb" />
-
\ No newline at end of file
diff --git a/VAR.Json/JsonParser.cs b/VAR.Json/JsonParser.cs
deleted file mode 100644
index d2801df..0000000
--- a/VAR.Json/JsonParser.cs
+++ /dev/null
@@ -1,709 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Reflection;
-using System.Text;
-
-namespace VAR.Json
-{
- public class JsonParser
- {
- #region Declarations
-
- private const int MaxRecursiveCount = 20;
-
- private ParserContext _ctx;
- private bool _tainted;
-
- private readonly List _knownTypes = new List();
-
- #endregion Declarations
-
- #region Properties
-
- public bool Tainted => _tainted;
-
- public List KnownTypes => _knownTypes;
-
- #endregion Properties
-
- #region Private methods
-
- private static readonly Dictionary _dictProperties =
- new Dictionary();
-
- private PropertyInfo[] Type_GetProperties(Type type)
- {
- PropertyInfo[] typeProperties;
- lock (_dictProperties)
- {
- if (_dictProperties.ContainsKey(type)) { typeProperties = _dictProperties[type]; }
- else
- {
- typeProperties = type.GetProperties(BindingFlags.Public | BindingFlags.OptionalParamBinding |
- BindingFlags.Instance);
- _dictProperties.Add(type, typeProperties);
- }
- }
-
- return typeProperties;
- }
-
- private float CompareToType(Dictionary obj, Type type)
- {
- PropertyInfo[] typeProperties = Type_GetProperties(type);
- int count = 0;
- foreach (PropertyInfo prop in typeProperties)
- {
- if (obj.ContainsKey(prop.Name))
- {
- count++;
- }
- }
-
- return count / (float)typeProperties.Length;
- }
-
- private object ConvertToType(Dictionary obj, Type type)
- {
- PropertyInfo[] typeProperties = Type_GetProperties(type);
- object newObj = ObjectActivator.CreateInstance(type);
- foreach (PropertyInfo prop in typeProperties)
- {
- if (obj.ContainsKey(prop.Name))
- {
- Type underliningType = Nullable.GetUnderlyingType(prop.PropertyType);
- Type effectiveType = underliningType ?? prop.PropertyType;
- object valueOrig = obj[prop.Name];
- object valueDest;
- if (underliningType != null && valueOrig == null)
- {
- valueDest = null;
- }
- else if (effectiveType == typeof(Guid) && valueOrig is string valGuid)
- {
- valueDest = new Guid(valGuid);
- }
- else
- {
- try
- {
- valueDest = Convert.ChangeType(obj[prop.Name], effectiveType);
- }
- catch (Exception)
- {
- continue;
- }
- }
-
- prop.SetValue(newObj, valueDest, null);
- }
- }
-
- return newObj;
- }
-
- private object TryConvertToTypes(Dictionary obj)
- {
- Type bestMatch = null;
- float bestMatchFactor = 0.0f;
- foreach (Type type in _knownTypes)
- {
- float matchFactor = CompareToType(obj, type);
- if (matchFactor > bestMatchFactor)
- {
- bestMatch = type;
- bestMatchFactor = matchFactor;
- }
- }
-
- if (bestMatch != null)
- {
- try
- {
- object newObj = ConvertToType(obj, bestMatch);
- return newObj;
- }
- catch (Exception)
- {
- // ignored
- }
- }
-
- return obj;
- }
-
- private int ParseHexShort()
- {
- int value = 0;
- for (int i = 0; i < 4; i++)
- {
- char c = _ctx.Next();
- if (char.IsDigit(c))
- {
- value = (value << 4) | (c - '0');
- }
- else
- {
- c = char.ToLower(c);
- if (c >= 'a' && c <= 'f')
- {
- value = (value << 4) | ((c - 'a') + 10);
- }
- }
- }
-
- return value;
- }
-
- private string ParseQuotedString()
- {
- StringBuilder scratch = new StringBuilder();
- char c = _ctx.SkipWhite();
- if (c == '"')
- {
- c = _ctx.Next();
- }
-
- do
- {
- if (c == '\\')
- {
- c = _ctx.Next();
- if (c == '"')
- {
- scratch.Append('"');
- }
- else if (c == '\\')
- {
- scratch.Append('\\');
- }
- else if (c == '/')
- {
- scratch.Append('/');
- }
- else if (c == 'b')
- {
- scratch.Append('\b');
- }
- else if (c == 'f')
- {
- scratch.Append('\f');
- }
- else if (c == 'n')
- {
- scratch.Append('\n');
- }
- else if (c == 'r')
- {
- scratch.Append('\r');
- }
- else if (c == 't')
- {
- scratch.Append('\t');
- }
- else if (c == 'u')
- {
- scratch.Append((char)ParseHexShort());
- }
- else
- {
- // StrictRules: Mark as tainted on unknown escaped character
- _tainted = true;
- }
-
- c = _ctx.Next();
- }
- else if (c == '"')
- {
- _ctx.Next();
- break;
- }
- else
- {
- // StrictRules: Mark as tainted on illegal characters
- if (c == '\t' || c == '\n') { _tainted = true; }
-
- scratch.Append(c);
- c = _ctx.Next();
- }
- } while (!_ctx.AtEnd());
-
- return scratch.ToString();
- }
-
- private string ParseSingleQuotedString()
- {
- StringBuilder scratch = new StringBuilder();
- char c = _ctx.SkipWhite();
- if (c == '\'')
- {
- c = _ctx.Next();
- }
-
- do
- {
- if (c == '\\')
- {
- c = _ctx.Next();
- if (c == '\'')
- {
- scratch.Append('\'');
- }
- else if (c == '\\')
- {
- scratch.Append('\\');
- }
- else if (c == '/')
- {
- scratch.Append('/');
- }
- else if (c == 'b')
- {
- scratch.Append('\b');
- }
- else if (c == 'f')
- {
- scratch.Append('\f');
- }
- else if (c == 'n')
- {
- scratch.Append('\n');
- }
- else if (c == 'r')
- {
- scratch.Append('\r');
- }
- else if (c == 't')
- {
- scratch.Append('\t');
- }
- else if (c == 'u')
- {
- scratch.Append((char)ParseHexShort());
- }
- else
- {
- // StrictRules: Mark as tainted on unknown escaped character
- _tainted = true;
- }
-
- c = _ctx.Next();
- }
- else if (c == '\'')
- {
- _ctx.Next();
- break;
- }
- else
- {
- // StrictRules: Mark as tainted on illegal characters
- if (c == '\t' || c == '\n') { _tainted = true; }
-
- scratch.Append(c);
- c = _ctx.Next();
- }
- } while (!_ctx.AtEnd());
-
- return scratch.ToString();
- }
-
- private string ParseString(bool mustBeQuoted = false)
- {
- char c = _ctx.SkipWhite();
- if (c == '"')
- {
- return ParseQuotedString();
- }
-
- if (c == '\'')
- {
- _tainted = true;
- return ParseSingleQuotedString();
- }
-
- if (mustBeQuoted) { _tainted = true; }
-
- StringBuilder scratch = new StringBuilder();
-
- while (!_ctx.AtEnd()
- && (char.IsLetter(c) || char.IsDigit(c) || c == '_'))
- {
- scratch.Append(c);
- c = _ctx.Next();
- }
-
- return scratch.ToString();
- }
-
- private object ParseNumber()
- {
- StringBuilder scratch = new StringBuilder();
- bool isFloat = false;
- bool isExp = false;
- int numberLenght = 0;
- int expLenght = 0;
- char c = _ctx.SkipWhite();
-
- // Sign
- if (c == '-')
- {
- scratch.Append('-');
- c = _ctx.Next();
- }
-
- // Integer part
- bool leadingZeroes = true;
- int leadingZeroesLenght = 0;
- while (char.IsDigit(c))
- {
- // Count leading zeroes
- if (leadingZeroes && c == '0') { leadingZeroesLenght++; }
- else { leadingZeroes = false; }
-
- scratch.Append(c);
- c = _ctx.Next();
- numberLenght++;
- }
-
- // StrictRules: Mark as tainted with leading zeroes
- if ((leadingZeroesLenght > 0 && leadingZeroesLenght != numberLenght) || leadingZeroesLenght > 1)
- {
- _tainted = true;
- }
-
- // Decimal part
- if (c == '.')
- {
- isFloat = true;
- scratch.Append(".");
- c = _ctx.Next();
- while (char.IsDigit(c))
- {
- scratch.Append(c);
- c = _ctx.Next();
- numberLenght++;
- }
- }
-
- if (numberLenght == 0)
- {
- _tainted = true;
- return null;
- }
-
- // Exponential part
- if (c == 'e' || c == 'E')
- {
- isFloat = true;
- isExp = true;
- scratch.Append('E');
- c = _ctx.Next();
- if (c == '+' || c == '-')
- {
- scratch.Append(c);
- c = _ctx.Next();
- }
-
- while (char.IsDigit(c))
- {
- scratch.Append(c);
- c = _ctx.Next();
- numberLenght++;
- expLenght++;
- }
- }
-
- if (isExp && expLenght == 0)
- {
- _tainted = true;
- return null;
- }
-
- // Build number from the parsed string
- string s = scratch.ToString();
- if (isFloat)
- {
- if (numberLenght < 17)
- {
- return Convert.ToDouble(s, CultureInfo.InvariantCulture);
- }
- else
- {
- return Convert.ToDecimal(s, CultureInfo.InvariantCulture);
- }
- }
- else
- {
- return Convert.ToInt32(s);
- }
- }
-
- private object ParseArray(int recursiveCount = 1)
- {
- // StrictRules: Mark as tainted when MaxRecursiveCount is exceeded
- if (recursiveCount >= MaxRecursiveCount) { _tainted = true; }
-
- bool correct = false;
- char c = _ctx.SkipWhite();
- List