+ Swapping to Development environment will display more detailed information about the error that occurred.
+
+
+ The Development environment shouldn't be enabled for deployed applications.
+ It can result in displaying sensitive information from exceptions to end users.
+ For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development
+ and restarting the app.
+
+
+Welcome to your new app.
diff --git a/Components/Pages/Weather.razor b/Components/Pages/Weather.razor
new file mode 100644
index 0000000..43a1ecb
--- /dev/null
+++ b/Components/Pages/Weather.razor
@@ -0,0 +1,64 @@
+@page "/weather"
+@attribute [StreamRendering]
+
+Weather
+
+
Weather
+
+
This component demonstrates showing data.
+
+@if (forecasts == null)
+{
+
Loading...
+}
+else
+{
+
+
+
+
Date
+
Temp. (C)
+
Temp. (F)
+
Summary
+
+
+
+ @foreach (var forecast in forecasts)
+ {
+
+
@forecast.Date.ToShortDateString()
+
@forecast.TemperatureC
+
@forecast.TemperatureF
+
@forecast.Summary
+
+ }
+
+
+}
+
+@code {
+ private WeatherForecast[]? forecasts;
+
+ protected override async Task OnInitializedAsync()
+ {
+ // Simulate asynchronous loading to demonstrate streaming rendering
+ await Task.Delay(500);
+
+ var startDate = DateOnly.FromDateTime(DateTime.Now);
+ var summaries = new[] { "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" };
+ forecasts = Enumerable.Range(1, 5).Select(index => new WeatherForecast
+ {
+ Date = startDate.AddDays(index),
+ TemperatureC = Random.Shared.Next(-20, 55),
+ Summary = summaries[Random.Shared.Next(summaries.Length)]
+ }).ToArray();
+ }
+
+ private class WeatherForecast
+ {
+ public DateOnly Date { get; set; }
+ public int TemperatureC { get; set; }
+ public string? Summary { get; set; }
+ public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
+ }
+}
diff --git a/Components/Routes.razor b/Components/Routes.razor
new file mode 100644
index 0000000..f756e19
--- /dev/null
+++ b/Components/Routes.razor
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/Components/_Imports.razor b/Components/_Imports.razor
new file mode 100644
index 0000000..19ea864
--- /dev/null
+++ b/Components/_Imports.razor
@@ -0,0 +1,10 @@
+@using System.Net.Http
+@using System.Net.Http.Json
+@using Microsoft.AspNetCore.Components.Forms
+@using Microsoft.AspNetCore.Components.Routing
+@using Microsoft.AspNetCore.Components.Web
+@using static Microsoft.AspNetCore.Components.Web.RenderMode
+@using Microsoft.AspNetCore.Components.Web.Virtualization
+@using Microsoft.JSInterop
+@using TargetService
+@using TargetService.Components
diff --git a/EGFramework/EGFramework.cs b/EGFramework/EGFramework.cs
new file mode 100644
index 0000000..5c21082
--- /dev/null
+++ b/EGFramework/EGFramework.cs
@@ -0,0 +1,208 @@
+using System;
+using System.Collections.Generic;
+
+namespace EGFramework
+{
+ #region Architecture & Module
+ public class EGArchitecture : IArchitecture where T : EGArchitecture, new()
+ {
+ private static T Architecture;
+ public static IArchitecture Interface
+ {
+ get
+ {
+ if (Architecture == null)
+ {
+ MakeSureArchitecture();
+ }
+ return Architecture;
+ }
+ }
+
+ private static void MakeSureArchitecture()
+ {
+ if (Architecture == null)
+ {
+ Architecture = new T();
+ Architecture.Init();
+ }
+ }
+
+ protected virtual void Init()
+ {
+
+ }
+
+ private IOCContainer ModuleContainer = new IOCContainer();
+
+ public void RegisterModule(TModule module) where TModule : IModule
+ {
+ ModuleContainer.Register(module);
+ module.Init();
+ }
+ public TModule GetModule() where TModule : class, IModule,new()
+ {
+ if (!ModuleContainer.self.ContainsKey(typeof(TModule)))
+ {
+ this.RegisterModule(new TModule());
+ }
+ return ModuleContainer.Get();
+ }
+ public bool IsInitModule() where TModule : class, IModule,new()
+ {
+ if (!ModuleContainer.self.ContainsKey(typeof(TModule)))
+ {
+ return true;
+ }else{
+ return false;
+ }
+ }
+ }
+
+ public abstract class EGModule:IModule{
+ IArchitecture IBelongToArchitecture.GetArchitecture()
+ {
+ return EGArchitectureImplement.Interface;
+ }
+ void IModule.Init()
+ {
+ this.Init();
+ }
+ public abstract void Init();
+ }
+ #endregion
+
+ #region Interface
+ public interface IArchitecture
+ {
+ void RegisterModule(T model) where T : IModule;
+ T GetModule() where T : class, IModule,new();
+ bool IsInitModule() where T : class, IModule,new();
+ }
+ public interface IModule : IBelongToArchitecture
+ {
+ void Init();
+ }
+ public interface IBelongToArchitecture
+ {
+ IArchitecture GetArchitecture();
+ }
+ #endregion
+
+ #region IOC
+ public class IOCContainer
+ {
+ private Dictionary Instances = new Dictionary();
+ public void Register(T instance)
+ {
+ var key = typeof(T);
+ if (Instances.ContainsKey(key))
+ {
+ Instances[key] = instance;
+ }
+ else
+ {
+ Instances.Add(key, instance);
+ }
+ }
+ public T Get() where T : class
+ {
+ var key = typeof(T);
+ if (Instances.TryGetValue(key, out var retInstance))
+ {
+ return retInstance as T;
+ }
+ return null;
+ }
+ public Dictionary self => Instances;
+ }
+ #endregion
+
+ #region Event
+ public interface IEasyEvent {
+
+ }
+ public interface IUnRegister
+ {
+ void UnRegister();
+ }
+
+ public class EasyEvent : IEasyEvent
+ {
+ private Action OnEvent = e => { };
+ public IUnRegister Register(Action onEvent)
+ {
+ OnEvent += onEvent;
+ return new CustomUnRegister(() => { UnRegister(onEvent); });
+ }
+ public void UnRegister(Action onEvent)
+ {
+ OnEvent -= onEvent;
+ }
+ public void Invoke(T t)
+ {
+ OnEvent?.Invoke(t);
+ }
+ }
+
+ public class EasyEvent : IEasyEvent
+ {
+ private Action OnEvent = () => { };
+ public IUnRegister Register(Action onEvent)
+ {
+ OnEvent += onEvent;
+ return new CustomUnRegister(() => { UnRegister(onEvent); });
+ }
+ public void UnRegister(Action onEvent)
+ {
+ OnEvent -= onEvent;
+ }
+ public void Invoke()
+ {
+ OnEvent?.Invoke();
+ }
+ }
+ public struct CustomUnRegister : IUnRegister
+ {
+ ///
+ /// delegate object
+ ///
+ private Action OnUnRegister { get; set; }
+
+ public CustomUnRegister(Action onUnRegister)
+ {
+ OnUnRegister = onUnRegister;
+ }
+ ///
+ /// release by parent;
+ ///
+ public void UnRegister()
+ {
+ OnUnRegister.Invoke();
+ OnUnRegister = null;
+ }
+ }
+ #endregion
+
+ #region FrameworkExtension
+ public interface IEGFramework{}
+
+ public class EGArchitectureImplement:EGArchitecture{
+ protected override void Init()
+ {
+ //base.Init();
+ }
+ }
+
+ public static class EGArchitectureImplementExtension{
+ public static T GetModule(this IEGFramework self) where T : class, IModule,new()
+ {
+ return EGArchitectureImplement.Interface.GetModule();
+ }
+ public static void RegisterModule(this IEGFramework self,T model) where T : class, IModule,new()
+ {
+ EGArchitectureImplement.Interface.RegisterModule(model);
+ }
+ }
+ #endregion
+}
diff --git a/EGFramework/EGPlatform.cs b/EGFramework/EGPlatform.cs
new file mode 100644
index 0000000..70f6321
--- /dev/null
+++ b/EGFramework/EGPlatform.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Diagnostics;
+namespace EGFramework{
+
+ public interface IPlatform{
+ void Log(string message);
+ void Log(params object[] what);
+ }
+ // public class EGPlatformGodot : IPlatform{
+ // public void Log(string message){
+ // Godot.GD.Print(message);
+ // // Console.WriteLine(message);
+ // }
+ // public void Log(params object[] what){
+ // Godot.GD.Print(what);
+ // // Console.WriteLine(what);
+ // }
+ // }
+ // if not use please explain this
+ public class EGPlatformDotnet : IPlatform{
+ public void Log(string message){
+ Console.WriteLine(message);
+ }
+ public void Log(params object[] what){
+ Console.WriteLine(what);
+ }
+ }
+ public static class EG
+ {
+ public static EGPlatformDotnet Platform = new EGPlatformDotnet();
+ public static void Print(string message){
+ Platform.Log(message);
+ }
+ public static void Print(params object[] what){
+ Platform.Log(what);
+ }
+
+ }
+
+ // public enum SupportPlatform{
+ // Godot = 0x01,
+ // Unity = 0x02,
+ // WebApi = 0x03,
+ // WPF = 0x04,
+ // Form = 0x05,
+ // }
+
+}
diff --git a/EGFramework/License_Third_Part/BACnet/MIT_license.txt b/EGFramework/License_Third_Part/BACnet/MIT_license.txt
new file mode 100644
index 0000000..8c308cf
--- /dev/null
+++ b/EGFramework/License_Third_Part/BACnet/MIT_license.txt
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2014 Yabe project
+
+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/EGFramework/License_Third_Part/Dapper/License.txt b/EGFramework/License_Third_Part/Dapper/License.txt
new file mode 100644
index 0000000..aa78493
--- /dev/null
+++ b/EGFramework/License_Third_Part/Dapper/License.txt
@@ -0,0 +1,6 @@
+The Dapper library and tools are licenced under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
+
+The Dapper logo is copyright Marc Gravell 2021 onwards; it is fine to use the Dapper logo when referencing the Dapper library and utilities, but
+the Dapper logo (including derivatives) must not be used in a way that misrepresents an external product or library as being affiliated or endorsed
+with Dapper. For example, you must not use the Dapper logo as the package icon on your own external tool (even if it uses Dapper internally),
+without written permission. If in doubt: ask.
\ No newline at end of file
diff --git a/EGFramework/License_Third_Part/Dotnet/LICENSE.txt b/EGFramework/License_Third_Part/Dotnet/LICENSE.txt
new file mode 100644
index 0000000..a616ed1
--- /dev/null
+++ b/EGFramework/License_Third_Part/Dotnet/LICENSE.txt
@@ -0,0 +1,23 @@
+The MIT License (MIT)
+
+Copyright (c) .NET Foundation and Contributors
+
+All rights reserved.
+
+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/EGFramework/License_Third_Part/FluentFTP/LICENSE.TXT b/EGFramework/License_Third_Part/FluentFTP/LICENSE.TXT
new file mode 100644
index 0000000..93d30b1
--- /dev/null
+++ b/EGFramework/License_Third_Part/FluentFTP/LICENSE.TXT
@@ -0,0 +1,7 @@
+Copyright (c) 2015 Robin Rodricks and FluentFTP Contributors
+
+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.
diff --git a/EGFramework/License_Third_Part/LiteDB/LICENSE.txt b/EGFramework/License_Third_Part/LiteDB/LICENSE.txt
new file mode 100644
index 0000000..08610a1
--- /dev/null
+++ b/EGFramework/License_Third_Part/LiteDB/LICENSE.txt
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2014-2022 Mauricio David
+
+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.
diff --git a/EGFramework/License_Third_Part/MQTTnet/LICENSE b/EGFramework/License_Third_Part/MQTTnet/LICENSE
new file mode 100644
index 0000000..d18aef9
--- /dev/null
+++ b/EGFramework/License_Third_Part/MQTTnet/LICENSE
@@ -0,0 +1,22 @@
+The MIT License (MIT)
+
+Copyright (c) .NET Foundation and Contributors
+All Rights Reserved
+
+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.
diff --git a/EGFramework/License_Third_Part/Makaretu_Dns_Multicast/LICENSE.txt b/EGFramework/License_Third_Part/Makaretu_Dns_Multicast/LICENSE.txt
new file mode 100644
index 0000000..61d5419
--- /dev/null
+++ b/EGFramework/License_Third_Part/Makaretu_Dns_Multicast/LICENSE.txt
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 Richard Schneider
+
+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.
diff --git a/EGFramework/License_Third_Part/Mysql_Data/Notice.txt b/EGFramework/License_Third_Part/Mysql_Data/Notice.txt
new file mode 100644
index 0000000..4636597
--- /dev/null
+++ b/EGFramework/License_Third_Part/Mysql_Data/Notice.txt
@@ -0,0 +1,3 @@
+GPL-2.0-only license licenseWITH license licenseUniversal-FOSS-exception-1.0 license
+https://licenses.nuget.org/GPL-2.0-only
+https://licenses.nuget.org/Universal-FOSS-exception-1.0
\ No newline at end of file
diff --git a/EGFramework/License_Third_Part/NewtonSoft_Json/LICENSE.md b/EGFramework/License_Third_Part/NewtonSoft_Json/LICENSE.md
new file mode 100644
index 0000000..dfaadbe
--- /dev/null
+++ b/EGFramework/License_Third_Part/NewtonSoft_Json/LICENSE.md
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright (c) 2007 James Newton-King
+
+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.
diff --git a/EGFramework/License_Third_Part/QFramework/LICENSE b/EGFramework/License_Third_Part/QFramework/LICENSE
new file mode 100644
index 0000000..2db0583
--- /dev/null
+++ b/EGFramework/License_Third_Part/QFramework/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2023 凉鞋
+
+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/EGFramework/License_Third_Part/StackExchange_Redis/LICENSE.txt b/EGFramework/License_Third_Part/StackExchange_Redis/LICENSE.txt
new file mode 100644
index 0000000..db4620c
--- /dev/null
+++ b/EGFramework/License_Third_Part/StackExchange_Redis/LICENSE.txt
@@ -0,0 +1,47 @@
+The MIT License (MIT)
+
+Copyright (c) 2014 Stack Exchange
+
+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.
+
+===============================================
+
+Third Party Licenses:
+
+The Redis project (https://redis.io/) is independent of this client library, and
+is licensed separately under the three clause BSD license. The full license
+information can be viewed here: https://redis.io/topics/license
+
+This tool makes use of the "redis-doc" library from https://redis.io/documentation
+in the intellisense comments, which is licensed under the
+Creative Commons Attribution-ShareAlike 4.0 International license; full
+details are available here:
+https://github.com/antirez/redis-doc/blob/master/COPYRIGHT
+
+The development solution uses the Redis-64 package from nuget
+(https://www.nuget.org/packages/Redis-64) by Microsoft Open Technologies, inc.
+This is licensed under the BSD license; full details are available here:
+https://github.com/MSOpenTech/redis/blob/2.6/license.txt
+This tool is not used in the release binaries.
+
+The development solution uses the BookSleeve package from nuget
+(https://code.google.com/p/booksleeve/) by Marc Gravell. This is licensed
+under the Apache 2.0 license; full details are available here:
+https://www.apache.org/licenses/LICENSE-2.0
+This tool is not used in the release binaries.
\ No newline at end of file
diff --git a/EGFramework/License_Third_Part/WebDavClient/LICENSE.txt b/EGFramework/License_Third_Part/WebDavClient/LICENSE.txt
new file mode 100644
index 0000000..9e41efb
--- /dev/null
+++ b/EGFramework/License_Third_Part/WebDavClient/LICENSE.txt
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Sergey Kazantsev
+
+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/EGFramework/License_Third_Part/source_han_sans/LICENSE.txt b/EGFramework/License_Third_Part/source_han_sans/LICENSE.txt
new file mode 100644
index 0000000..ddf7b7e
--- /dev/null
+++ b/EGFramework/License_Third_Part/source_han_sans/LICENSE.txt
@@ -0,0 +1,96 @@
+Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font
+Name 'Source'. Source is a trademark of Adobe in the United States
+and/or other countries.
+
+This Font Software is licensed under the SIL Open Font License,
+Version 1.1.
+
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font
+creation efforts of academic and linguistic communities, and to
+provide a free and open framework in which fonts may be shared and
+improved in partnership with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply to
+any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software
+components as distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to,
+deleting, or substituting -- in part or in whole -- any of the
+components of the Original Version, by changing formats or by porting
+the Font Software to a new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed,
+modify, redistribute, and sell modified and unmodified copies of the
+Font Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components, in
+Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the
+corresponding Copyright Holder. This restriction only applies to the
+primary font name as presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created using
+the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/EGFramework/Module/EGCQRS.cs b/EGFramework/Module/EGCQRS.cs
new file mode 100644
index 0000000..fdac1bb
--- /dev/null
+++ b/EGFramework/Module/EGCQRS.cs
@@ -0,0 +1,56 @@
+using System;
+using System.Collections.Generic;
+
+namespace EGFramework
+{
+ #region Interface
+ public interface ICommand
+ {
+ void Execute();
+ }
+ public interface IQuery
+ {
+ TResult Do();
+ }
+
+ public interface IEGCQRS
+ {
+ void SendCommand(ICommand command);
+ TResult DoQuery(IQuery query);
+ }
+ #endregion
+
+ public class EGCQRS :EGModule, IEGCQRS
+ {
+ public void SendCommand(ICommand command)
+ {
+ command.Execute();
+ }
+ public TResult DoQuery(IQuery query)
+ {
+ return query.Do();
+ }
+ public override void Init()
+ {
+
+ }
+ }
+
+ #region Extension
+ public static class CanSendCommandExtension
+ {
+ public static void EGSendCommand(this IEGFramework self, ICommand command)
+ {
+ EGArchitectureImplement.Interface.GetModule().SendCommand(command);
+ }
+ }
+
+ public static class CanQueryDataExtension
+ {
+ public static TResult EGQueryData(this IEGFramework self, IQuery query)
+ {
+ return EGArchitectureImplement.Interface.GetModule().DoQuery(query);
+ }
+ }
+ #endregion
+}
\ No newline at end of file
diff --git a/EGFramework/Module/EGEvent.cs b/EGFramework/Module/EGEvent.cs
new file mode 100644
index 0000000..8f5f477
--- /dev/null
+++ b/EGFramework/Module/EGEvent.cs
@@ -0,0 +1,167 @@
+using System;
+using System.Collections.Generic;
+
+namespace EGFramework
+{
+ public interface IEGEvent{
+ void SendEvent() where T : new();
+ void SendEvent(T e);
+ IUnRegister RegisterEvent(Action onEvent);
+ void UnRegisterEvent(Action onEvent);
+ }
+ public class EGEvent : EGModule,IEGEvent
+ {
+ public override void Init()
+ {
+
+ }
+ private readonly EasyEvents Events = new EasyEvents();
+ public void SendEvent() where TEvent : new()
+ {
+ Events.GetEvent>()?.Invoke(new TEvent());
+ }
+
+ public void SendEvent(TEvent e)
+ {
+ Events.GetEvent>()?.Invoke(e);
+ }
+
+ public IUnRegister RegisterEvent(Action onEvent)
+ {
+ var e = Events.GetOrAddEvent>();
+ return e.Register(onEvent);
+ }
+
+ public void UnRegisterEvent(Action onEvent)
+ {
+ var e = Events.GetEvent>();
+ if (e != null)
+ {
+ e.UnRegister(onEvent);
+ }
+ }
+ }
+
+ public class EasyEvents
+ {
+ private static EasyEvents GlobalEvents = new EasyEvents();
+ public static T Get() where T : IEasyEvent
+ {
+ return GlobalEvents.GetEvent();
+ }
+ public static void Register() where T : IEasyEvent, new()
+ {
+ GlobalEvents.AddEvent();
+ }
+ private Dictionary TypeEvents = new Dictionary();
+ public void AddEvent() where T : IEasyEvent, new()
+ {
+ TypeEvents.Add(typeof(T), new T());
+ }
+ public T GetEvent() where T : IEasyEvent
+ {
+ IEasyEvent e;
+ if (TypeEvents.TryGetValue(typeof(T), out e))
+ {
+ return (T)e;
+ }
+ return default;
+ }
+ public T GetOrAddEvent() where T : IEasyEvent, new()
+ {
+ var eType = typeof(T);
+ if (TypeEvents.TryGetValue(eType, out var e))
+ {
+ return (T)e;
+ }
+ var t = new T();
+ TypeEvents.Add(eType, t);
+ return t;
+ }
+ }
+
+ ///
+ /// This EasyEvent will release all registered function while invoked.
+ ///
+ ///
+ public class EasyEventOnce : IEasyEvent
+ {
+ private Action OnEvent = e => { };
+ private List AutoUnRegister = new List();
+ public IUnRegister Register(Action onEvent)
+ {
+ OnEvent += onEvent;
+ CustomUnRegister unRegister = new CustomUnRegister(() => { UnRegister(onEvent); });
+ AutoUnRegister.Add(unRegister);
+ return unRegister;
+ }
+ public void UnRegister(Action onEvent)
+ {
+ OnEvent -= onEvent;
+ }
+ public void Invoke(T t)
+ {
+ if(AutoUnRegister.Count>0){
+ OnEvent?.Invoke(t);
+ foreach(CustomUnRegister unRegister in AutoUnRegister){
+ unRegister.UnRegister();
+ }
+ AutoUnRegister.Clear();
+ }
+ }
+ }
+
+ ///
+ /// This EasyEvent will release all registered function while invoked.
+ ///
+ public class EasyEventOnce : IEasyEvent{
+ private Action OnEvent = () => { };
+ private List AutoUnRegister = new List();
+ public IUnRegister Register(Action onEvent)
+ {
+ OnEvent += onEvent;
+ CustomUnRegister unRegister = new CustomUnRegister(() => { UnRegister(onEvent); });
+ AutoUnRegister.Add(unRegister);
+ return unRegister;
+ }
+ public void UnRegister(Action onEvent)
+ {
+ OnEvent -= onEvent;
+ }
+ public void Invoke()
+ {
+ if(AutoUnRegister.Count>0){
+ OnEvent?.Invoke();
+ foreach(CustomUnRegister unRegister in AutoUnRegister){
+ unRegister.UnRegister();
+ }
+ AutoUnRegister.Clear();
+ }
+ }
+ }
+
+
+ public static class CanRegisterEventExtension
+ {
+ public static IUnRegister EGRegisterEvent(this IEGFramework self, Action onEvent)
+ {
+ return EGArchitectureImplement.Interface.GetModule().RegisterEvent(onEvent);
+ }
+ public static void EGUnRegisterEvent(this IEGFramework self, Action onEvent)
+ {
+ EGArchitectureImplement.Interface.GetModule().UnRegisterEvent(onEvent);
+ }
+ }
+
+ public static class CanSendEventExtension
+ {
+ public static void EGSendEvent(this IEGFramework self) where T : new()
+ {
+ EGArchitectureImplement.Interface.GetModule().SendEvent();
+ }
+ public static void EGSendEvent(this IEGFramework self, T e)
+ {
+ EGArchitectureImplement.Interface.GetModule().SendEvent(e);
+ }
+ }
+}
\ No newline at end of file
diff --git a/EGFramework/Module/EGObjects.cs b/EGFramework/Module/EGObjects.cs
new file mode 100644
index 0000000..2a3b742
--- /dev/null
+++ b/EGFramework/Module/EGObjects.cs
@@ -0,0 +1,65 @@
+using System;
+using System.Collections.Generic;
+
+namespace EGFramework
+{
+ public interface IEGObjects
+ {
+ void RegisterObject(T object_);
+ T GetObject() where T : class,new();
+
+ }
+ public class EGObjects : EGModule,IEGObjects
+ {
+ private IOCContainer ObjectContainer = new IOCContainer();
+ public override void Init()
+ {
+
+ }
+
+ public TObject GetObject() where TObject : class,new()
+ {
+ if (!ObjectContainer.self.ContainsKey(typeof(TObject)))
+ {
+ this.RegisterObject(new TObject());
+ }
+ return ObjectContainer.Get();
+ }
+
+ public void RegisterObject(TObject object_)
+ {
+ ObjectContainer.Register(object_);
+ }
+
+ public bool ContainsObject(){
+ return ObjectContainer.self.ContainsKey(typeof(TObject));
+ }
+ }
+
+ public static class CanGetObjectExtension
+ {
+ public static T EGGetObject(this IEGFramework self) where T : class,new()
+ {
+ return EGArchitectureImplement.Interface.GetModule().GetObject();
+ }
+ }
+ public static class CanRegisterObjectExtension
+ {
+ public static void EGRegisterObject(this IArchitecture self,T object_) where T : class,new()
+ {
+ self.GetModule().RegisterObject(object_);
+ }
+ public static void EGRegisterObject(this IEGFramework self,T object_) where T : class,new()
+ {
+ EGArchitectureImplement.Interface.GetModule().RegisterObject(object_);
+ }
+ }
+
+ public static class CanContainsObjectExtension{
+ public static bool EGContainsObject(this IEGFramework self)
+ {
+ return EGArchitectureImplement.Interface.GetModule().ContainsObject();
+ }
+ }
+
+}
diff --git a/EGFramework/Module/Extension/EGConvertExtension.cs b/EGFramework/Module/Extension/EGConvertExtension.cs
new file mode 100644
index 0000000..2646c0e
--- /dev/null
+++ b/EGFramework/Module/Extension/EGConvertExtension.cs
@@ -0,0 +1,392 @@
+using System;
+using System.Linq;
+using System.Text;
+
+namespace EGFramework {
+ //协议规则解析通用方法扩展
+ public static class EGConvertExtension
+ {
+ ///
+ /// Hex string data to byte array,such as a string like "0x00 0xff 0x06"
+ ///
+ /// Only include A-F,0-9,hex
+ ///
+ public static byte[] ToByteArrayByHex(this string self) {
+ int hexLen = self.Length;
+ byte[] result;
+ if (hexLen % 2 == 1)
+ {
+ //奇数
+ hexLen++;
+ result = new byte[(hexLen / 2)];
+ self += "0" ;
+ }
+ else
+ {
+ //偶数
+ result = new byte[(hexLen / 2)];
+ }
+ int j = 0;
+ for (int i = 0; i < hexLen; i += 2)
+ {
+ result[j] = (byte)int.Parse(self.Substring(i, 2), System.Globalization.NumberStyles.HexNumber);
+ j++;
+ }
+ return result;
+ }
+
+
+ ///
+ /// get string from hex array ,like hex array {0x0a,0x11} => "0x0a 0x11"
+ ///
+ ///
+ ///
+ public static string ToStringByHex(this byte[] self)
+ {
+ StringBuilder sb = new StringBuilder();
+
+ foreach (byte b in self)
+ {
+ sb.Append(b.ToString("X2") + " ");
+ }
+ string result = sb.ToString().Trim();
+ return result;
+ }
+ public static string ToStringByHex0x(this byte[] self)
+ {
+ StringBuilder sb = new StringBuilder();
+
+ foreach (byte b in self)
+ {
+ sb.Append("0x" + b.ToString("X2") + " ");
+ }
+ string result = sb.ToString().Trim();
+ return result;
+ }
+
+ ///
+ /// get hex from string ,like string "0x0a 0x11" => {0x0a,0x11}
+ ///
+ ///
+ ///
+ public static byte[] ToHexByString(this string self)
+ {
+ string[] hexStrings = self.Split(' ');
+ byte[] byteArray = new byte[hexStrings.Length];
+ for (int i = 0; i < hexStrings.Length; i++)
+ {
+ byteArray[i] = Convert.ToByte(hexStrings[i], 16);
+ }
+ return byteArray;
+ }
+ public static byte[] ToHexByString0x(this string self)
+ {
+ if (self.Length <= 2 && self.Substring(0, 2) != "0x") {
+ return null;
+ }
+ return self.ToHexByString();
+ }
+
+ public static byte[] ToBytes(this ushort self){
+ byte[] byteArray = BitConverter.GetBytes(self);
+ if (BitConverter.IsLittleEndian)
+ {
+ Array.Reverse(byteArray);
+ }
+ return byteArray;
+ }
+
+ public static ushort ToUShort(this byte[] self){
+ if (BitConverter.IsLittleEndian)
+ {
+ Array.Reverse(self);
+ }
+ return BitConverter.ToUInt16(self, 0);
+ }
+
+ public static ushort ToUShortLittleEndian(this byte[] self){
+ if (!BitConverter.IsLittleEndian)
+ {
+ Array.Reverse(self);
+ }
+ return BitConverter.ToUInt16(self, 0);
+ }
+
+ public static byte[] ToBytes(this uint self){
+ byte[] byteArray = BitConverter.GetBytes(self);
+ if (BitConverter.IsLittleEndian)
+ {
+ Array.Reverse(byteArray);
+ }
+ return byteArray;
+ }
+ public static byte[] ToBytesLittleEndian(this uint self){
+ byte[] byteArray = BitConverter.GetBytes(self);
+ if (!BitConverter.IsLittleEndian)
+ {
+ Array.Reverse(byteArray);
+ }
+ return byteArray;
+ }
+
+ public static uint ToUINT(this byte[] self){
+ if (BitConverter.IsLittleEndian)
+ {
+ Array.Reverse(self);
+ }
+ return BitConverter.ToUInt32(self, 0);
+ }
+ public static uint ToUINTLittleEndian(this byte[] self){
+ if (!BitConverter.IsLittleEndian)
+ {
+ Array.Reverse(self);
+ }
+ return BitConverter.ToUInt32(self, 0);
+ }
+
+
+ public static byte[] ToBytes(this uint[] uintArray)
+ {
+ int byteCount = uintArray.Length * sizeof(uint);
+ byte[] byteArray = new byte[byteCount];
+
+ for (int i = 0; i < uintArray.Length; i++)
+ {
+ byte[] tempBytes = BitConverter.GetBytes(uintArray[i]);
+ Array.Copy(tempBytes, 0, byteArray, i * sizeof(uint), sizeof(uint));
+ }
+ return byteArray;
+ }
+
+ ///
+ /// convert and resize byte array,such as uint is 0x00FF7799 => byte array {0xFF,0x77,0x99}
+ ///
+ ///
+ ///
+ public static byte[] ToBytesAndResizeArray(this uint self){
+ byte[] byteArray = BitConverter.GetBytes(self);
+ if (BitConverter.IsLittleEndian)
+ {
+ Array.Reverse(byteArray);
+ }
+ int startIndex = Array.FindIndex(byteArray, b => b != 0);
+ if (startIndex == -1)
+ {
+ byteArray = new byte[1];
+ }
+ else
+ {
+ byteArray = byteArray.Skip(startIndex).ToArray();
+ }
+ return byteArray;
+ }
+
+ public static byte[] ToByteArray(this bool[] boolArray)
+ {
+ int numBool = boolArray.Length;
+ int numBytes = (numBool + 7) / 8;
+ byte[] byteArray = new byte[numBytes];
+
+ for (int i = 0; i < numBool; i++)
+ {
+ int byteIndex = i / 8;
+ int bitIndex = i % 8;
+ if (boolArray[i])
+ {
+ byteArray[byteIndex] |= (byte)(1 << bitIndex);
+ }
+ }
+
+ return byteArray;
+ }
+
+ public static bool[] ToBoolArray(this byte[] byteArray)
+ {
+ bool[] boolArray = new bool[byteArray.Length * 8];
+ for (int i = 0; i < byteArray.Length; i++)
+ {
+ byte currentByte = byteArray[i];
+
+ for (int j = 0; j < 8; j++)
+ {
+ boolArray[i * 8 + j] = (currentByte & (1 << j)) != 0;
+ }
+ }
+
+ return boolArray;
+ }
+
+ public static bool[] ToBoolArray(this byte byteData)
+ {
+ bool[] boolArray = new bool[8];
+ byte currentByte = byteData;
+ for (int j = 0; j < 8; j++)
+ {
+ boolArray[j] = (currentByte & (1 << j)) != 0;
+ }
+ return boolArray;
+ }
+ public static bool[] ToBoolArray(this int value)
+ {
+ string binaryString = Convert.ToString(value, 2);
+ bool[] boolArray = new bool[binaryString.Length];
+ if(binaryString.Length < 8){
+ boolArray = new bool[8];
+ }
+ for (int i = 0; i < binaryString.Length; i++)
+ {
+ boolArray[binaryString.Length - i - 1] = binaryString[i] == '1';
+ }
+ return boolArray;
+ }
+
+ public static int ToInt(this bool[] boolArray)
+ {
+ int result = 0;
+ for (int i = 0; i < boolArray.Length; i++)
+ {
+ if (boolArray[i])
+ {
+ result |= (1 << i);
+ }
+ }
+ return result;
+ }
+
+ public static ushort[] ToUShortArray(this byte[] byteArray){
+ ushort[] ushortArray = new ushort[byteArray.Length / 2];
+ for (int i = 0, j = 0; i < byteArray.Length; i += 2, j++)
+ {
+ ushortArray[j] = (ushort)((byteArray[i] << 8) | byteArray[i + 1]);
+ }
+ return ushortArray;
+ }
+
+ public static byte[] ToByteArray(this float[] floatArray)
+ {
+ byte[] byteArray = new byte[floatArray.Length * 4];
+ for (int i = 0; i < floatArray.Length; i++)
+ {
+ byte[] tempArray = BitConverter.GetBytes(floatArray[i]);
+ if(!BitConverter.IsLittleEndian){
+ Array.Reverse(tempArray);
+ }
+ //Array.Reverse(tempArray); // 大端序需要反转字节数组以满足高字节在后
+ Array.Copy(tempArray, 0, byteArray, i * 4, 4);
+ }
+ return byteArray;
+ }
+
+ public static byte[] ToByteArray(this float value)
+ {
+ byte[] byteArray = new byte[4];
+ byte[] tempArray = BitConverter.GetBytes(value);
+ if(!BitConverter.IsLittleEndian){
+ Array.Reverse(tempArray);
+ }
+ //Array.Reverse(tempArray); // 大端序需要反转字节数组以满足高字节在后
+ Array.Copy(tempArray, 0, byteArray, 0, 4);
+ return byteArray;
+ }
+ public static byte[] ToByteArrayBigEndian(this float value)
+ {
+ byte[] byteArray = new byte[4];
+ byte[] tempArray = BitConverter.GetBytes(value);
+ if(BitConverter.IsLittleEndian){
+ Array.Reverse(tempArray);
+ }
+ //Array.Reverse(tempArray); // 大端序需要反转字节数组以满足高字节在后
+ Array.Copy(tempArray, 0, byteArray, 0, 4);
+ return byteArray;
+ }
+
+
+ public static float[] ToFloatArray(this byte[] byteArray)
+ {
+ float[] floatArray = new float[byteArray.Length / 4];
+ for (int i = 0; i < floatArray.Length; i++)
+ {
+ byte[] tempArray = new byte[4];
+ Array.Copy(byteArray, i * 4, tempArray, 0, 4);
+ if(!BitConverter.IsLittleEndian){
+ Array.Reverse(tempArray);
+ }
+ //Array.Reverse(tempArray);
+ floatArray[i] = BitConverter.ToSingle(tempArray, 0);
+ }
+ return floatArray;
+ }
+
+ public static float[] ToFloatArrayBigEndian(this byte[] byteArray)
+ {
+ float[] floatArray = new float[byteArray.Length / 4];
+ for (int i = 0; i < floatArray.Length; i++)
+ {
+ byte[] tempArray = new byte[4];
+ Array.Copy(byteArray, i * 4, tempArray, 0, 4);
+ if(BitConverter.IsLittleEndian){
+ Array.Reverse(tempArray);
+ }
+ //Array.Reverse(tempArray);
+ floatArray[i] = BitConverter.ToSingle(tempArray, 0);
+ }
+ return floatArray;
+ }
+ public static double[] ToDoubleArray(this byte[] byteArray)
+ {
+ double[] doubleArray = new double[byteArray.Length / 8];
+ for (int i = 0; i < doubleArray.Length; i++)
+ {
+ byte[] tempArray = new byte[8];
+ Array.Copy(byteArray, i * 8, tempArray, 0, 8);
+ if(!BitConverter.IsLittleEndian){
+ Array.Reverse(tempArray);
+ }
+ //Array.Reverse(tempArray);
+ doubleArray[i] = BitConverter.ToDouble(tempArray, 0);
+ }
+ return doubleArray;
+ }
+
+ public static byte[] ToByteArray(this int[] intArray)
+ {
+ byte[] byteArray = new byte[intArray.Length * 4];
+ for (int i = 0; i < intArray.Length; i++)
+ {
+ byte[] tempArray = BitConverter.GetBytes(intArray[i]);
+ //Array.Reverse(tempArray); // 大端序需要反转字节数组以满足高字节在后
+ Array.Copy(tempArray, 0, byteArray, i * 4, 4);
+ }
+ return byteArray;
+ }
+
+ public static byte[] Reverse(this byte[] bytes){
+ Array.Reverse(bytes);
+ return bytes;
+ }
+
+ public static byte[] ToSubByte(this byte[] bytes,int index,int length){
+ byte[] resultByte = new byte[length];
+ Array.Copy(bytes,index,resultByte,0,length);
+ return resultByte;
+ }
+
+ public static float[] ToSubFloat(this float[] floats,int index,int length){
+ float[] resultFloats = new float[length];
+ Array.Copy(floats,index,resultFloats,0,length);
+ return resultFloats;
+ }
+ public static float[] ToSubArrayByCount(this float[] originalArray, int targetLength)
+ {
+ float[] reducedArray = new float[targetLength];
+ float ratio = (float)(originalArray.Length - 1) / (targetLength - 1);
+ for (int i = 0; i < targetLength; i++)
+ {
+ int originalIndex = (int)Math.Round(ratio * i);
+ reducedArray[i] = originalArray[originalIndex];
+ }
+ return reducedArray;
+ }
+
+ }
+}
diff --git a/EGFramework/Module/Extension/EGCrcExtension.cs b/EGFramework/Module/Extension/EGCrcExtension.cs
new file mode 100644
index 0000000..7ef38ec
--- /dev/null
+++ b/EGFramework/Module/Extension/EGCrcExtension.cs
@@ -0,0 +1,154 @@
+using System;
+using System.Security.Cryptography;
+
+namespace EGFramework{
+ public static class EGCrcModbusExtension
+ {
+ /// CRC calculate is a common device verify algorithm
+ /// use
+ // hex = {0x80,0x05};
+ // Polynomial = x^16+x^15+x^2+1 = 1 80 05
+ public const ushort CRC_16_Modbus_Polynomial = 0x8005;
+ // hex = {0xFF,0xFF}
+ public const ushort CRC_16_Modbus_Start = 0xFFFF;
+ // hex = {0x00,0x00}
+ public const ushort CRC_16_Modbus_ResultXOR = 0x0000;
+ private static readonly ushort[] Crc_16_Table_Modbus ={
+ 0x00,0xC0C1,0xC181,0x140,0xC301,0x3C0,0x280,0xC241,0xC601,0x6C0,0x780,0xC741,0x500,0xC5C1,0xC481,0x440,
+ 0xCC01,0xCC0,0xD80,0xCD41,0xF00,0xCFC1,0xCE81,0xE40,0xA00,0xCAC1,0xCB81,0xB40,0xC901,0x9C0,0x880,0xC841,
+ 0xD801,0x18C0,0x1980,0xD941,0x1B00,0xDBC1,0xDA81,0x1A40,0x1E00,0xDEC1,0xDF81,0x1F40,0xDD01,0x1DC0,0x1C80,0xDC41,
+ 0x1400,0xD4C1,0xD581,0x1540,0xD701,0x17C0,0x1680,0xD641,0xD201,0x12C0,0x1380,0xD341,0x1100,0xD1C1,0xD081,0x1040,
+ 0xF001,0x30C0,0x3180,0xF141,0x3300,0xF3C1,0xF281,0x3240,0x3600,0xF6C1,0xF781,0x3740,0xF501,0x35C0,0x3480,0xF441,
+ 0x3C00,0xFCC1,0xFD81,0x3D40,0xFF01,0x3FC0,0x3E80,0xFE41,0xFA01,0x3AC0,0x3B80,0xFB41,0x3900,0xF9C1,0xF881,0x3840,
+ 0x2800,0xE8C1,0xE981,0x2940,0xEB01,0x2BC0,0x2A80,0xEA41,0xEE01,0x2EC0,0x2F80,0xEF41,0x2D00,0xEDC1,0xEC81,0x2C40,
+ 0xE401,0x24C0,0x2580,0xE541,0x2700,0xE7C1,0xE681,0x2640,0x2200,0xE2C1,0xE381,0x2340,0xE101,0x21C0,0x2080,0xE041,
+ 0xA001,0x60C0,0x6180,0xA141,0x6300,0xA3C1,0xA281,0x6240,0x6600,0xA6C1,0xA781,0x6740,0xA501,0x65C0,0x6480,0xA441,
+ 0x6C00,0xACC1,0xAD81,0x6D40,0xAF01,0x6FC0,0x6E80,0xAE41,0xAA01,0x6AC0,0x6B80,0xAB41,0x6900,0xA9C1,0xA881,0x6840,
+ 0x7800,0xB8C1,0xB981,0x7940,0xBB01,0x7BC0,0x7A80,0xBA41,0xBE01,0x7EC0,0x7F80,0xBF41,0x7D00,0xBDC1,0xBC81,0x7C40,
+ 0xB401,0x74C0,0x7580,0xB541,0x7700,0xB7C1,0xB681,0x7640,0x7200,0xB2C1,0xB381,0x7340,0xB101,0x71C0,0x7080,0xB041,
+ 0x5000,0x90C1,0x9181,0x5140,0x9301,0x53C0,0x5280,0x9241,0x9601,0x56C0,0x5780,0x9741,0x5500,0x95C1,0x9481,0x5440,
+ 0x9C01,0x5CC0,0x5D80,0x9D41,0x5F00,0x9FC1,0x9E81,0x5E40,0x5A00,0x9AC1,0x9B81,0x5B40,0x9901,0x59C0,0x5880,0x9841,
+ 0x8801,0x48C0,0x4980,0x8941,0x4B00,0x8BC1,0x8A81,0x4A40,0x4E00,0x8EC1,0x8F81,0x4F40,0x8D01,0x4DC0,0x4C80,0x8C41,
+ 0x4400,0x84C1,0x8581,0x4540,0x8701,0x47C0,0x4680,0x8641,0x8201,0x42C0,0x4380,0x8341,0x4100,0x81C1,0x8081,0x4040,
+ };
+ public static ushort CalculateCRC16Modbus(this byte[] bytes)
+ {
+ CRC16 provider = new CRC16(Crc_16_Table_Modbus);
+ byte[] hash = provider.ComputeHash(bytes);
+
+ ushort crc16 = BitConverter.ToUInt16(hash, 0);
+
+ ushort reversedResult = (ushort)((crc16 >> 8) | (crc16 << 8));
+ return reversedResult;
+ }
+
+ }
+ public static class EGCrcUtility
+ {
+ //Crc with table
+ public static uint CalculateCrc(byte[] data, uint initialValue, uint xorValue, bool inputReverse, bool outputReverse,uint[] CrcTable)
+ {
+ uint crc = initialValue;
+
+ for (int i = 0; i < data.Length; i++)
+ {
+ if (inputReverse)
+ data[i] = ReverseBits(data[i]);
+
+ crc ^= (uint)(data[i] << 24);
+
+ for (int j = 0; j < 8; j++)
+ {
+ crc = (crc << 8) ^ CrcTable[crc >> 24];
+ }
+ }
+
+ if (outputReverse)
+ crc = ReverseBits(crc);
+
+ return crc ^ xorValue;
+ }
+
+ //Crc without table
+ public static uint CalculateCrc(byte[] data, uint polynomial, uint initialValue, uint xorValue, bool inputReverse, bool outputReverse)
+ {
+ uint crc = initialValue;
+
+ for (int i = 0; i < data.Length; i++)
+ {
+ if (inputReverse)
+ data[i] = ReverseBits(data[i]);
+
+ crc ^= (uint)(data[i] << 24);
+
+ for (int j = 0; j < 8; j++)
+ {
+ if ((crc & 0x80000000) != 0)
+ {
+ crc = (crc << 1) ^ polynomial;
+ }
+ else
+ {
+ crc <<= 1;
+ }
+ }
+ }
+
+ if (outputReverse)
+ crc = ReverseBits(crc);
+
+ return crc ^ xorValue;
+ }
+
+ private static uint ReverseBits(uint value)
+ {
+ uint result = 0;
+ for (int i = 0; i < 8; i++)
+ {
+ result = (result << 1) | ((value >> i) & 1);
+ }
+ return result;
+ }
+
+ private static byte ReverseBits(byte value)
+ {
+ byte result = 0;
+ for (int i = 0; i < 8; i++)
+ {
+ result = (byte)((result << 1) | ((value >> i) & 1));
+ }
+ return result;
+ }
+ }
+ public class CRC16 : HashAlgorithm
+ {
+ private const ushort polynomial = 0x8005;
+ private ushort[] table = new ushort[256];
+ private ushort crc = 0xFFFF;
+
+ public CRC16(ushort[] table)
+ {
+ HashSizeValue = 16;
+ this.table = table;
+ }
+
+ protected override void HashCore(byte[] array, int ibStart, int cbSize)
+ {
+ for (int i = ibStart; i < ibStart + cbSize; i++)
+ {
+ byte index = (byte)(crc ^ array[i]);
+ crc = (ushort)((crc >> 8) ^ table[index]);
+ }
+ }
+
+ protected override byte[] HashFinal()
+ {
+ return BitConverter.GetBytes(crc);
+ }
+
+ public override void Initialize()
+ {
+ crc = ushort.MaxValue;
+ }
+ }
+}
diff --git a/EGFramework/Module/Extension/EGDateTimeExtension.cs b/EGFramework/Module/Extension/EGDateTimeExtension.cs
new file mode 100644
index 0000000..8fc3f00
--- /dev/null
+++ b/EGFramework/Module/Extension/EGDateTimeExtension.cs
@@ -0,0 +1,31 @@
+using System;
+namespace EGFramework{
+ public static class EGDateTimeExtension
+ {
+ public static string GetFullDateMsg(this IEGFramework self)
+ {
+ return DateTime.Now.ToString("yyyy-MM-dd") + " " + DateTime.Now.ToString("HH:mm:ss");
+ }
+ public static string GetDayDateMsg(this IEGFramework self)
+ {
+ return DateTime.Now.ToString("HH:mm:ss");
+ }
+ public static long GetDateTime(this object self)
+ {
+ DateTime dt = DateTime.Now;
+ return dt.Ticks;
+ }
+ public static string GetFullDateMsg(this long ticks){
+ DateTime dateTime = new DateTime(ticks);
+ return dateTime.ToString("yyyy-MM-dd") + " " + dateTime.ToString("HH:mm:ss");
+ }
+ public static string GetDayDateMsg(this long ticks){
+ DateTime dateTime = new DateTime(ticks);
+ return dateTime.ToString("HH:mm:ss");
+ }
+ public static string GetDateMsg(this long ticks){
+ DateTime dateTime = new DateTime(ticks);
+ return dateTime.ToString("yyyy-MM-dd");
+ }
+ }
+}
\ No newline at end of file
diff --git a/EGFramework/Module/Extension/EGEncodingExtension.cs b/EGFramework/Module/Extension/EGEncodingExtension.cs
new file mode 100644
index 0000000..297785d
--- /dev/null
+++ b/EGFramework/Module/Extension/EGEncodingExtension.cs
@@ -0,0 +1,78 @@
+using System.Text;
+
+namespace EGFramework{
+ //use this extension,you should add System.Text.Encoding.CodePages package from Nuget
+ public static class EGEncodingExtension
+ {
+ public static bool IsInit{ set; get; }
+
+ ///
+ /// get encoding from encoding params(string).
+ ///
+ ///
+ ///
+ ///
+ public static Encoding GetEncoding(this IEGFramework self,string encodingTxt){
+ if(!IsInit){
+ IsInit = true;
+ Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
+ }
+ return Encoding.GetEncoding(encodingTxt);
+ }
+
+ ///
+ /// Make a string to bytes with encoding params(string).
+ ///
+ ///
+ ///
+ ///
+ public static byte[] ToBytesByEncoding(this string self,string encodingTxt){
+ if(!IsInit){
+ IsInit = true;
+ Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
+ }
+ return Encoding.GetEncoding(encodingTxt).GetBytes(self);
+ }
+ ///
+ /// Make a string to bytes with encoding.
+ ///
+ ///
+ ///
+ ///
+ public static byte[] ToBytesByEncoding(this string self,Encoding encoding){
+ if(!IsInit){
+ IsInit = true;
+ Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
+ }
+ return encoding.GetBytes(self);
+ }
+
+ ///
+ /// Make a bytes to string with encoding params(string).
+ ///
+ ///
+ ///
+ ///
+ public static string ToStringByEncoding(this byte[] self,string encodingTxt){
+ if(!IsInit){
+ IsInit = true;
+ Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
+ }
+ return Encoding.GetEncoding(encodingTxt).GetString(self);
+ }
+ ///
+ /// Make a bytes to string with encoding.
+ ///
+ ///
+ ///
+ ///
+ public static string ToStringByEncoding(this byte[] self,Encoding encoding){
+ if(!IsInit){
+ IsInit = true;
+ Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
+ }
+ return encoding.GetString(self);
+ }
+ }
+}
+
diff --git a/EGFramework/Module/Extension/EGIpExtension.cs b/EGFramework/Module/Extension/EGIpExtension.cs
new file mode 100644
index 0000000..a836fe4
--- /dev/null
+++ b/EGFramework/Module/Extension/EGIpExtension.cs
@@ -0,0 +1,54 @@
+
+namespace EGFramework {
+ public static class EGIpExtension
+ {
+ ///
+ /// Get host from IP. Such as 192.168.0.1:5555 => get 192.168.0.1
+ ///
+ ///
+ ///
+ public static string GetHostByIp(this string ip)
+ {
+ int colonIndex = ip.IndexOf(":");
+ string host = "";
+ if (colonIndex != -1)
+ {
+ host = ip.Substring(0, colonIndex);
+ }
+ return host;
+ }
+
+ public static int GetPortByIp(this string ip)
+ {
+ int colonIndex = ip.IndexOf(":");
+ string portString = ip.Substring(colonIndex + 1);
+ int port;
+ if (int.TryParse(portString, out port))
+ {
+ //nothing to do
+ }
+ else
+ {
+ port = 0;
+ }
+ return port;
+ }
+
+ public static string GetStrFrontSymbol(this string str,char symbol){
+ int colonIndex = str.IndexOf(symbol);
+ string frontStr = "";
+ if (colonIndex != -1)
+ {
+ frontStr = str.Substring(0, colonIndex);
+ }
+ return frontStr;
+ }
+
+ public static string GetStrBehindSymbol(this string str,char symbol){
+ int colonIndex = str.IndexOf(symbol);
+ string behindStr = str.Substring(colonIndex + 1);
+ return behindStr;
+ }
+ }
+}
+
diff --git a/EGFramework/Module/Extension/EGSqlExtension.cs b/EGFramework/Module/Extension/EGSqlExtension.cs
new file mode 100644
index 0000000..51d7328
--- /dev/null
+++ b/EGFramework/Module/Extension/EGSqlExtension.cs
@@ -0,0 +1,146 @@
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+
+namespace EGFramework
+{
+ public static class EGSqlExtension
+ {
+ public static string ToCreateTableSQL(this PropertyInfo property)
+ {
+ string sqlCommand;
+ if (property.Name == "ID" || property.Name == "id" || property.Name == "Id")
+ {
+ return "";
+ }
+ if (property.PropertyType == typeof(int) || property.PropertyType.IsEnum)
+ {
+ sqlCommand = "`" + property.Name + "` INTEGER" + " NOT NULL,";
+ }
+ else if (property.PropertyType == typeof(double) || property.PropertyType == typeof(float))
+ {
+ sqlCommand = "`" + property.Name + "` REAL" + " NOT NULL,";
+ }
+ else if (property.PropertyType == typeof(bool))
+ {
+ sqlCommand = "`" + property.Name + "` REAL" + " NOT NULL,";
+ }
+ else if (property.PropertyType == typeof(long))
+ {
+ sqlCommand = "`" + property.Name + "` BIGINT(20)" + " NOT NULL,";
+ }
+ else if (property.PropertyType == typeof(string))
+ {
+ sqlCommand = "`" + property.Name + "` VARCHAR(255)" + " NOT NULL,";
+ }
+ else
+ {
+ sqlCommand = "`" + property.Name + "` VARCHAR(255)" + " NOT NULL,";
+ }
+ return sqlCommand;
+ }
+
+ public static string ToCreateTableSQL(this FieldInfo field)
+ {
+ string sqlCommand;
+ if (field.Name == "ID" || field.Name == "id" || field.Name == "Id")
+ {
+ return "";
+ }
+ if (field.FieldType == typeof(int) || field.FieldType.IsEnum)
+ {
+ sqlCommand = "`" + field.Name + "` INTEGER" + " NOT NULL,";
+ }
+ else if (field.FieldType == typeof(double) || field.FieldType == typeof(float))
+ {
+ sqlCommand = "`" + field.Name + "` REAL" + " NOT NULL,";
+ }
+ else if (field.FieldType == typeof(bool))
+ {
+ sqlCommand = "`" + field.Name + "` REAL" + " NOT NULL,";
+ }
+ else if (field.FieldType == typeof(long))
+ {
+ sqlCommand = "`" + field.Name + "` BIGINT(20)" + " NOT NULL,";
+ }
+ else if (field.FieldType == typeof(string))
+ {
+ sqlCommand = "`" + field.Name + "` VARCHAR(255)" + " NOT NULL,";
+ }
+ else
+ {
+ sqlCommand = "`" + field.Name + "` VARCHAR(255)" + " NOT NULL,";
+ }
+ return sqlCommand;
+ }
+
+ public static string ToCreateTableSQL(this KeyValuePair param)
+ {
+ string sqlCommand;
+ if (param.Key == "ID" || param.Key == "id" || param.Key == "Id")
+ {
+ return "";
+ }
+ if (param.Value == typeof(int) || param.Value.IsEnum)
+ {
+ sqlCommand = "`" + param.Key + "` INTEGER" + " NOT NULL,";
+ }
+ else if (param.Value == typeof(double) || param.Value == typeof(float))
+ {
+ sqlCommand = "`" + param.Key + "` REAL" + " NOT NULL,";
+ }
+ else if (param.Value == typeof(bool))
+ {
+ sqlCommand = "`" + param.Key + "` REAL" + " NOT NULL,";
+ }
+ else if (param.Value == typeof(long))
+ {
+ sqlCommand = "`" + param.Key + "` BIGINT(20)" + " NOT NULL,";
+ }
+ else if (param.Value == typeof(string))
+ {
+ sqlCommand = "`" + param.Key + "` VARCHAR(255)" + " NOT NULL,";
+ }
+ else
+ {
+ sqlCommand = "`" + param.Key + "` VARCHAR(255)" + " NOT NULL,";
+ }
+ return sqlCommand;
+ }
+
+ public static string ToCreateTableSQL(this Type type, string tableName)
+ {
+ var properties = type.GetProperties();
+ FieldInfo[] fields = type.GetFields();
+ string keySet = "";
+ foreach (PropertyInfo key in properties)
+ {
+ keySet += key.ToCreateTableSQL();
+ }
+ foreach (FieldInfo key in fields)
+ {
+ keySet += key.ToCreateTableSQL();
+ }
+ keySet = keySet.TrimEnd(',');
+ string createSql = @"CREATE TABLE " + tableName + " (" +
+ "`ID` INTEGER PRIMARY KEY AUTO_INCREMENT, " + keySet
+ + ");";
+ return createSql;
+ }
+
+ public static string ToCreateTableSQL(this Dictionary tableParam,string tableName)
+ {
+
+ string keySet = "";
+ foreach(KeyValuePair key in tableParam){
+ keySet += key.ToCreateTableSQL();
+ }
+ keySet = keySet.TrimEnd(',');
+ string createSql = @"CREATE TABLE "+tableName+" ("+
+ "`ID` INTEGER PRIMARY KEY AUTOINCREMENT, "+keySet
+ +");";
+ return createSql;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/EGFramework/Module/GenerateTools/EGGenerate.cs b/EGFramework/Module/GenerateTools/EGGenerate.cs
new file mode 100644
index 0000000..cd69606
--- /dev/null
+++ b/EGFramework/Module/GenerateTools/EGGenerate.cs
@@ -0,0 +1,16 @@
+namespace EGFramework
+{
+ public class EGGenerate : EGModule
+ {
+ public override void Init()
+ {
+
+ }
+
+ public T GenerateUI(object data) where T : new()
+ {
+ T ui = new T();
+ return ui;
+ }
+ }
+}
\ No newline at end of file
diff --git a/EGFramework/Module/GenerateTools/GenerateToolsInterface.cs b/EGFramework/Module/GenerateTools/GenerateToolsInterface.cs
new file mode 100644
index 0000000..8a6efb1
--- /dev/null
+++ b/EGFramework/Module/GenerateTools/GenerateToolsInterface.cs
@@ -0,0 +1,34 @@
+namespace EGFramework
+{
+ public interface IGenerateToolsInterface
+ {
+ public string GenerateCode();
+ }
+ public interface IGodotTable
+ {
+
+ }
+ public interface IGodotRowData
+ {
+
+ }
+
+ public interface ITableData
+ {
+ ///
+ /// Get the data of the table.
+ ///
+ ///
+ string[][] GetTableData();
+ ///
+ /// Get the header of the table.
+ ///
+ ///
+ string[] GetTableHeader();
+ }
+
+ public interface ITableRowData
+ {
+ string[] GetRowData();
+ }
+}
\ No newline at end of file
diff --git a/EGFramework/Module/GenerateTools/Templete/Code/EGSvgGenerator.cs b/EGFramework/Module/GenerateTools/Templete/Code/EGSvgGenerator.cs
new file mode 100644
index 0000000..6d29bc3
--- /dev/null
+++ b/EGFramework/Module/GenerateTools/Templete/Code/EGSvgGenerator.cs
@@ -0,0 +1,90 @@
+namespace EGFramework.Code{
+ public class EGSvgGenerator : IGenerateToolsInterface
+ {
+ public string SvgHeader { get ; private set;}
+ public const string SvgFooter = "";
+
+ public int Width { get; set; }
+ public int Height { get; set; }
+ public EGSvgViewBox ViewBox { get; set; }
+
+ public EGSvgGenerator(int width, int height, EGSvgViewBox viewBox)
+ {
+ Width = width;
+ Height = height;
+ ViewBox = viewBox;
+ SvgHeader = $"