diff --git a/Esiur.AI.Annotations/Esiur.AI.Annotations.csproj b/Esiur.AI.Annotations/Esiur.AI.Annotations.csproj
new file mode 100644
index 0000000..ed9781c
--- /dev/null
+++ b/Esiur.AI.Annotations/Esiur.AI.Annotations.csproj
@@ -0,0 +1,10 @@
+
+
+
+ Exe
+ net10.0
+ enable
+ enable
+
+
+
diff --git a/Esiur.AI.Annotations/Program.cs b/Esiur.AI.Annotations/Program.cs
new file mode 100644
index 0000000..1bc52a6
--- /dev/null
+++ b/Esiur.AI.Annotations/Program.cs
@@ -0,0 +1 @@
+Console.WriteLine("Hello, World!");
diff --git a/Esiur.CLI/Program.cs b/Esiur.CLI/Program.cs
index 6863153..3b972aa 100644
--- a/Esiur.CLI/Program.cs
+++ b/Esiur.CLI/Program.cs
@@ -47,7 +47,7 @@ if (args.Length > 0)
{
try
{
- var path = Esiur.Proxy.TypeDefGenerator.GetTemplate(url, o.Dir, false, o.Username, o.Password, o.AsyncSetters);
+ var path = Esiur.Proxy.TypeDefGenerator.GetTypes(url, o.Dir, false, o.Username, o.Password, o.AsyncSetters);
Console.WriteLine($"Generated successfully: {path}");
}
catch (Exception ex)
diff --git a/Esiur.sln b/Esiur.sln
index febbab7..552a6f3 100644
--- a/Esiur.sln
+++ b/Esiur.sln
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.0.31919.166
+# Visual Studio Version 18
+VisualStudioVersion = 18.4.11612.150
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Esiur", "Esiur\Esiur.csproj", "{4F74A8C1-D38F-4CC0-ACD1-24459BA0EAFC}"
EndProject
@@ -8,7 +8,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Esiur.Stores.MongoDB", "Esi
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Esiur.Stores.EntityCore", "Esiur.Stores.EntityCore\Esiur.Stores.EntityCore.csproj", "{53DE5A30-CFA9-4DE7-A840-77CFF519D31B}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test", "Test\Test.csproj", "{331F82B6-6B90-4533-9718-F7C8090D8F19}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Esiur.Tests.Distribution", "Tests\Distribution\Esiur.Tests.Distribution.csproj", "{331F82B6-6B90-4533-9718-F7C8090D8F19}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Esiur.Security.Cryptography", "Esiur.Security.Cryptography\Esiur.Security.Cryptography.csproj", "{C0C55C1A-7C48-41EB-9A65-27BC99D82F6D}"
EndProject
@@ -20,6 +20,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Esiur.AspNetCore.Example",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Esiur.AspNetCore", "Esiur.AspNetCore\Esiur.AspNetCore.csproj", "{7B0C521F-8B13-4F2A-BD78-7C692620C831}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{2769C4C3-2595-413B-B7FE-5903826770C1}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Esiur.Tests.Serialization", "Tests\Serialization\Esiur.Tests.Serialization.csproj", "{58A49FFF-7A2C-2EE8-B184-9E89A168C403}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -62,10 +66,18 @@ Global
{7B0C521F-8B13-4F2A-BD78-7C692620C831}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B0C521F-8B13-4F2A-BD78-7C692620C831}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B0C521F-8B13-4F2A-BD78-7C692620C831}.Release|Any CPU.Build.0 = Release|Any CPU
+ {58A49FFF-7A2C-2EE8-B184-9E89A168C403}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {58A49FFF-7A2C-2EE8-B184-9E89A168C403}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {58A49FFF-7A2C-2EE8-B184-9E89A168C403}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {58A49FFF-7A2C-2EE8-B184-9E89A168C403}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {331F82B6-6B90-4533-9718-F7C8090D8F19} = {2769C4C3-2595-413B-B7FE-5903826770C1}
+ {58A49FFF-7A2C-2EE8-B184-9E89A168C403} = {2769C4C3-2595-413B-B7FE-5903826770C1}
+ EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C584421D-5EC0-4821-B7D8-2633D8D405F2}
EndGlobalSection
diff --git a/Esiur/Proxy/TypeDefGenerator.cs b/Esiur/Proxy/TypeDefGenerator.cs
index 9cf83a6..091478b 100644
--- a/Esiur/Proxy/TypeDefGenerator.cs
+++ b/Esiur/Proxy/TypeDefGenerator.cs
@@ -406,9 +406,9 @@ public static class TypeDefGenerator
rt.AppendLine($"[Export] public {ptTypeName} {p.Name} {{");
rt.AppendLine($"get => ({ptTypeName})properties[{p.Index}];");
if (asyncSetters)
- rt.AppendLine($"set => _Set({p.Index}, value);");
+ rt.AppendLine($"set => SetResourcePropertyAsync({p.Index}, value);");
else
- rt.AppendLine($"set => _SetSync({p.Index}, value);");
+ rt.AppendLine($"set => SetResourceProperty({p.Index}, value);");
rt.AppendLine("}");
}
diff --git a/Test/MyResource.cs b/Test/MyResource.cs
deleted file mode 100644
index 35318b2..0000000
--- a/Test/MyResource.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using Esiur.Core;
-using Esiur.Resource;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using static System.Runtime.InteropServices.JavaScript.JSType;
-
-namespace Test
-{
- [Resource]
- [Annotation("A", "B")]
- public partial class MyResource
- {
- [Export][Annotation("Comment")] string description;
- [Export] int categoryId;
-
- [Export] public string Hello() => "Hi";
-
- [Export] public string HelloParent() => "Hi from Parent";
-
- [Export]
- [Annotation("This function computes the standard deviation of a list")]
- public double StDev(double[] values)
- {
- double avg = values.Average();
- return Math.Sqrt(values.Average(v => Math.Pow(v - avg, 2)));
- }
-
- }
-}
diff --git a/Test/Program.cs b/Test/Program.cs
deleted file mode 100644
index aef3759..0000000
--- a/Test/Program.cs
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
-
-Copyright (c) 2017 Ahmed Kh. Zamil
-
-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.
-
-*/
-
-using Esiur.Data;
-using Esiur.Core;
-using Esiur.Net.HTTP;
-using Esiur.Net.Sockets;
-using Esiur.Resource;
-using Esiur.Security.Permissions;
-using Esiur.Stores;
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-
-using Esiur.Security.Integrity;
-using System.Linq;
-using Esiur.Data.Types;
-using System.Collections;
-using System.Runtime.CompilerServices;
-using Esiur.Proxy;
-using System.Text.RegularExpressions;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Security.Cryptography;
-using System.Text;
-using Esiur.Security.Cryptography;
-using Esiur.Security.Membership;
-using Esiur.Net.Packets;
-using System.Numerics;
-using Esiur.Protocol;
-
-namespace Test
-{
-
- class Program
- {
-
- static void TestSerialization(object x, EpConnection connection = null)
- {
-
- var d = Codec.Compose(x, Warehouse.Default, connection);
- // var rr = DC.ToHex(y);
-
- var y = Codec.ParseSync(d, 0, Warehouse.Default);
- Console.WriteLine($"{x.GetType().Name}: {x} == {y}, {d.ToHex()}");
- }
-
-
- [Export]
- public class StudentRecord : IRecord
- {
- public string Name { get; set; }
- public byte Grade { get; set; }
- }
- public enum LogLevel : int
- {
- Debug,
- Warning,
- Error,
- }
-
- static async Task Main(string[] args)
- {
- //TestSerialization("Hello");
- //TestSerialization(10);
- //TestSerialization(10.1);
- //TestSerialization(10.1d);
- //TestSerialization((byte)1);
- //TestSerialization((byte)2);
- TestSerialization(new int[] { 1, 2, 3, 4 });
- //var x = LogLevel.Warning;
-
- //TestSerialization(LogLevel.Warning);
-
- //TestSerialization(new Map
- //{
- // ["C++"] = 1,
- // ["C#"] = 2,
- // ["JS"] = null
- //});
-
-
-
- //TestSerialization(new StudentRecord() { Name = "Ali", Grade = 90 });
-
- //var tn = Encoding.UTF8.GetBytes("Test.StudentRecord");
- //var hash = System.Security.Cryptography.SHA256.Create().ComputeHash(tn).Clip(0, 16);
- //hash[6] = (byte)((hash[6] & 0xF) | 0x80);
- //hash[8] = (byte)((hash[8] & 0xF) | 0x80);
-
- //var g = new UUID(hash);
-
- //Console.WriteLine(g);
-
-
-
- var a = new ECDH();
- var b = new ECDH();
-
- var apk = a.GetPublicKey();
- var bpk = b.GetPublicKey();
-
- var ska = a.ComputeSharedKey(bpk);
- var skb = b.ComputeSharedKey(apk);
-
- Console.WriteLine(ska.ToHex());
- Console.WriteLine(skb.ToHex());
-
- // Simple membership provider
- var membership = new SimpleMembership() { GuestsAllowed = true };
-
- membership.AddUser("user", "123456", new SimpleMembership.QuestionAnswer[0]);
- membership.AddUser("admin", "admin", new SimpleMembership.QuestionAnswer[]
- {
- new SimpleMembership.QuestionAnswer()
- {
- Question = "What is 5+5",
- Answer = 10,
- Hashed = true,
- }
- });
-
- var wh = new Warehouse();
-
- // Create stores to keep objects.
- var system = await wh.Put("sys", new MemoryStore());
- var server = await wh.Put("sys/server", new EpServer() { Membership = membership });
-
-
- var web = await wh.Put("sys/web", new HTTPServer() { Port = 8088 });
-
- var service = await wh.Put("sys/service", new MyService());
- var res1 = await wh.Put("sys/service/r1", new MyResource() { Description = "Testing 1", CategoryId = 10 });
- var res2 = await wh.Put("sys/service/r2", new MyResource() { Description = "Testing 2", CategoryId = 11 });
- var res3 = await wh.Put("sys/service/c1", new MyChildResource() { ChildName = "Child 1", Description = "Child Testing 3", CategoryId = 12 });
- var res4 = await wh.Put("sys/service/c2", new MyChildResource() { ChildName = "Child 2 Destroy", Description = "Testing Destroy Handler", CategoryId = 12 });
-
- //TestSerialization(res1);
-
- server.MapCall("Hello", (string msg, DateTime time, EpConnection sender) =>
- {
- Console.WriteLine(msg);
- return "Hi " + DateTime.UtcNow;
- }).MapCall("temp", () => res4);
-
- service.Resource = res1;
- service.ChildResource = res3;
- service.Resources = new MyResource[] { res1, res2, res1, res3 };
- service.MyResources = new MyResource[] { res1, res2, res3, res4 };
-
- //web.MapGet("/{action}/{age}", (int age, string action, HTTPConnection sender) =>
- //{
- // Console.WriteLine($"AGE: {age} ACTION: {action}");
-
- // sender.Response.Number = Esiur.Net.Packets.HTTPResponsePacket.ResponseCode.NotFound;
- // sender.Send("Not found");
- //});
-
- web.MapGet("/", (HTTPConnection sender) =>
- {
- sender.Send("Hello");
- });
-
- await wh.Open();
-
-
- //var sc = service.GetGenericRecord();
- //var d = Codec.Compose(sc, Warehouse.Default, null);
-
- // Start testing
- TestClient(service);
- }
-
-
- // AuthorizationRequest, AsyncReply