diff --git a/.gitignore b/.gitignore
index 90d59640d4b907885def52f27278768b2ef1e579..268fe78193d3002c22d7838d9c68f94e0f4bf18c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -108,7 +108,6 @@ csx
AppPackages/
# Others
-sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
@@ -151,48 +150,10 @@ $RECYCLE.BIN/
.DS_Store
.vs
*.cache
-/Build/netcoreapp2.1/GB28181.Service.dll
-/Build/netcoreapp2.1/GB28181.Service.dll
-/Build/netcoreapp2.1/SIPSorcery.28181.dll
-/Build/netcoreapp2.1/SIPSorcery.28181.dll
-/Build/netcoreapp2.1/SIPSorcery.28181.pdb
-/GB28181.Service/obj/Debug/netcoreapp2.1/GB28181.Service.csprojAssemblyReference.cache
-/GrpcAgent/bin/Debug/netcoreapp2.1/SIPSorcery.28181.dll
-/GrpcAgent/bin/Debug/netcoreapp2.1/SIPSorcery.28181.pdb
-/GrpcAgent/obj/Debug/netcoreapp2.1/GrpcAgent.csprojAssemblyReference.cache
-/SIPSorcery.28181/bin/Debug/netcoreapp2.1/SIPSorcery.28181.dll
-/SIPSorcery.28181/bin/Debug/netcoreapp2.1/SIPSorcery.28181.pdb
-/SIPSorcery.28181/obj/Debug/netcoreapp2.1/SIPSorcery.28181.dll
-/SIPSorcery.28181/obj/Debug/netcoreapp2.1/SIPSorcery.28181.pdb
-/Test.GB28181.Service/bin/Debug/netcoreapp2.1/SIPSorcery.28181.dll
-/Test.GB28181.Service/bin/Debug/netcoreapp2.1/SIPSorcery.28181.pdb
-/Test.GB28181.Service/obj/Debug/netcoreapp2.1/Test.GB28181.Service.csprojAssemblyReference.cache
-/Build/netcoreapp2.1/GB28181.Service.dll
-/Build/netcoreapp2.1/GB28181.Service.pdb
-/GB28181.Service/obj/Debug/netcoreapp2.1/GB28181.Service.dll
-/GB28181.Service/obj/Debug/netcoreapp2.1/GB28181.Service.pdb
-/Logger4Net/obj/Debug/netcoreapp2.1/Logger4Net.csproj.FileListAbsolute.txt
-/Logger4Net/obj/Debug/netcoreapp2.1/Logger4Net.csprojAssemblyReference.cache
-/NATS.Client/obj/Debug/netcoreapp2.1/NATS.Client.csproj.FileListAbsolute.txt
-/NATS.Client/obj/Debug/netcoreapp2.1/NATS.Client.csprojAssemblyReference.cache
-/Proto.Grpc/obj/Debug/netcoreapp2.1/GrpcProtocol.csproj.FileListAbsolute.txt
-/Proto.Grpc/obj/Debug/netcoreapp2.1/GrpcProtocol.csprojAssemblyReference.cache
-/SIPSorcery.28181/obj/Debug/netcoreapp2.1/SIPSorcery.28181.csprojAssemblyReference.cache
-/Test.GB28181.Service/bin/Debug/netcoreapp2.1/GB28181.Service.dll
-/Test.GB28181.Service/bin/Debug/netcoreapp2.1/GB28181.Service.pdb
-/Build/netcoreapp2.1/GB28181.Service.dll
-/Build/netcoreapp2.1/GB28181.Service.pdb
-/GB28181.Service/obj/Debug/netcoreapp2.1/GB28181.Service.dll
-/GB28181.Service/obj/Debug/netcoreapp2.1/GB28181.Service.pdb
-/Logger4Net/obj/Debug/netcoreapp2.1/Logger4Net.csproj.FileListAbsolute.txt
-/Logger4Net/obj/Debug/netcoreapp2.1/Logger4Net.csprojAssemblyReference.cache
-/NATS.Client/obj/Debug/netcoreapp2.1/NATS.Client.csproj.FileListAbsolute.txt
-/NATS.Client/obj/Debug/netcoreapp2.1/NATS.Client.csprojAssemblyReference.cache
-/Proto.Grpc/obj/Debug/netcoreapp2.1/GrpcProtocol.csproj.FileListAbsolute.txt
-/Proto.Grpc/obj/Debug/netcoreapp2.1/GrpcProtocol.csprojAssemblyReference.cache
-/SIPSorcery.28181/obj/Debug/netcoreapp2.1/SIPSorcery.28181.csprojAssemblyReference.cache
-/Test.GB28181.Service/bin/Debug/netcoreapp2.1/GB28181.Service.dll
-/Test.GB28181.Service/bin/Debug/netcoreapp2.1/GB28181.Service.pdb
-/SIPSorcery.28181/obj/Debug/netcoreapp2.1/SIPSorcery.28181.csproj.FileListAbsolute.txt
obj/
bin/
+/.vs/
+/packages
+packages.config
+obj/
+*.orig
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 34f2fc0fe72b19267cbb4f8963e45347d3899f3e..211467cf063d43b5f2cdd3fa82d36d636744e525 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,12 +1,3 @@
-## release v6.0.0.1
-* realtime video and playback video successfully finished
+# Important Change
-## release v6.0.0.1
-* Registered device to DMS
-* Get GBserver config info from devicemanagementservice
-* Real video request and play
-* Keepalive of real video request
-
-## release v6.0.0.0
-
-* add md log file
+## a lot of change ,as a basic codes
\ No newline at end of file
diff --git a/CallStack1.dgml b/CallStack1.dgml
new file mode 100644
index 0000000000000000000000000000000000000000..7654bf88f0b45a7c3ec78e54f62f2068798324da
--- /dev/null
+++ b/CallStack1.dgml
@@ -0,0 +1,689 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Common.GLib.WinControls/Common.GLib.WinControls.csproj b/Common.GLib.WinControls/Common.GLib.WinControls.csproj
new file mode 100644
index 0000000000000000000000000000000000000000..0b89b8f59dd290f1197ce31f568ce53ffe4f99e7
--- /dev/null
+++ b/Common.GLib.WinControls/Common.GLib.WinControls.csproj
@@ -0,0 +1,11 @@
+
+
+
+ Library
+ netcoreapp3.1
+ Common.GLib.WinControls
+ Common.GLib.WinControls
+ true
+
+
+
diff --git a/Common.GLib.WinControls/GLib.Controls.Form/AXDataGridView.cs b/Common.GLib.WinControls/GLib.Controls.Form/AXDataGridView.cs
new file mode 100644
index 0000000000000000000000000000000000000000..3a0259ff86ecfd9ba6268a1225cf8a34a1156fa1
--- /dev/null
+++ b/Common.GLib.WinControls/GLib.Controls.Form/AXDataGridView.cs
@@ -0,0 +1,136 @@
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace GLib.Controls.Form
+{
+ public class AXDataGridView : DataGridView
+ {
+ private int _index = 0;
+
+ private bool _isScorll = true;
+
+ private int _move = 30;
+
+ private IContainer components = null;
+
+ private Timer timer1;
+
+ [Browsable(true)]
+ [DefaultValue(true)]
+ public new bool ReadOnly
+ {
+ get
+ {
+ return base.ReadOnly;
+ }
+ set
+ {
+ base.ReadOnly = value;
+ }
+ }
+
+ public AXDataGridView()
+ {
+ InitializeComponent();
+ Init();
+ }
+
+ private void Init()
+ {
+ base.AllowUserToAddRows = false;
+ base.AllowUserToDeleteRows = false;
+ base.BorderStyle = BorderStyle.None;
+ base.BackgroundColor = SystemColors.Window;
+ base.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
+ base.EnableHeadersVisualStyles = false;
+ base.RowHeadersVisible = false;
+ base.RowTemplate.Height = 20;
+ base.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
+ base.AutoGenerateColumns = false;
+ base.AllowUserToResizeRows = false;
+ SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer | ControlStyles.OptimizedDoubleBuffer, value: true);
+ UpdateStyles();
+ }
+
+ private void AXDataGridView_MouseWheel(object sender, MouseEventArgs e)
+ {
+ _move = 0;
+ }
+
+ private void AXDataGridView_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
+ {
+ if (_isScorll && base.FirstDisplayedScrollingRowIndex != -1)
+ {
+ _index++;
+ base.FirstDisplayedScrollingRowIndex = ((base.Rows.Count > 0) ? (base.Rows.Count - 1) : 0);
+ }
+ }
+
+ private void AXDataGridView_RowsRemoved(object sender, DataGridViewRowsRemovedEventArgs e)
+ {
+ _index--;
+ if (_isScorll && base.FirstDisplayedScrollingRowIndex != -1)
+ {
+ base.FirstDisplayedScrollingRowIndex = base.Rows.Count - 2;
+ }
+ }
+
+ private void AXDataGridView_Scroll(object sender, ScrollEventArgs e)
+ {
+ if (_index > e.NewValue)
+ {
+ _move = 0;
+ _isScorll = false;
+ }
+ else
+ {
+ _isScorll = true;
+ }
+ if (_isScorll)
+ {
+ _index = e.NewValue;
+ }
+ }
+
+ private void AXDataGridView_MouseClick(object sender, MouseEventArgs e)
+ {
+ _isScorll = false;
+ }
+
+ private void AXDataGridView_MouseMove(object sender, MouseEventArgs e)
+ {
+ _move = 0;
+ }
+
+ private void timer1_Tick(object sender, EventArgs e)
+ {
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && components != null)
+ {
+ timer1.Enabled = false;
+ timer1.Dispose();
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ private void InitializeComponent()
+ {
+ components = new System.ComponentModel.Container();
+ timer1 = new System.Windows.Forms.Timer(components);
+ ((System.ComponentModel.ISupportInitialize)this).BeginInit();
+ SuspendLayout();
+ timer1.Enabled = true;
+ timer1.Interval = 1000;
+ timer1.Tick += new System.EventHandler(timer1_Tick);
+ base.RowTemplate.Height = 23;
+ ((System.ComponentModel.ISupportInitialize)this).EndInit();
+ ResumeLayout(false);
+ }
+ }
+}
diff --git a/Common.GLib.WinControls/GLib.Controls.Web/BulletedList.cs b/Common.GLib.WinControls/GLib.Controls.Web/BulletedList.cs
new file mode 100644
index 0000000000000000000000000000000000000000..fe4798f002962598f25dd5264952073160c70b83
--- /dev/null
+++ b/Common.GLib.WinControls/GLib.Controls.Web/BulletedList.cs
@@ -0,0 +1,13 @@
+//using System.Web.UI.WebControls;
+
+namespace GLib.Controls.Web
+{
+ //public class BulletedList : System.Web.UI.WebControls.BulletedList
+ //{
+ // public BulletedList()
+ // {
+ // DataValueField = ControlsConfig.Controls_DataValueField;
+ // DataTextField = ControlsConfig.Controls_DataTextField;
+ // }
+ //}
+}
diff --git a/Common.GLib.WinControls/GLib.Controls.Web/Button.cs b/Common.GLib.WinControls/GLib.Controls.Web/Button.cs
new file mode 100644
index 0000000000000000000000000000000000000000..2395a44f5f4aa02aa61162a06eea22b38ff83d12
--- /dev/null
+++ b/Common.GLib.WinControls/GLib.Controls.Web/Button.cs
@@ -0,0 +1,8 @@
+//using System.Web.UI.WebControls;
+
+//namespace GLib.Controls.Web
+//{
+// public class Button : System.Web.UI.WebControls.Button
+// {
+// }
+//}
diff --git a/Common.GLib.WinControls/GLib.Controls.Web/CheckBox.cs b/Common.GLib.WinControls/GLib.Controls.Web/CheckBox.cs
new file mode 100644
index 0000000000000000000000000000000000000000..8f36f8175ac13a7d6eedbcc01efe6f8b9880f752
--- /dev/null
+++ b/Common.GLib.WinControls/GLib.Controls.Web/CheckBox.cs
@@ -0,0 +1,8 @@
+//using System.Web.UI.WebControls;
+
+//namespace GLib.Controls.Web
+//{
+// public class CheckBox : System.Web.UI.WebControls.CheckBox
+// {
+// }
+//}
diff --git a/Common.GLib.WinControls/GLib.Controls.Web/CheckBoxList.cs b/Common.GLib.WinControls/GLib.Controls.Web/CheckBoxList.cs
new file mode 100644
index 0000000000000000000000000000000000000000..be793b8acafde6a2596e5f7f7418be92c27cb3b2
--- /dev/null
+++ b/Common.GLib.WinControls/GLib.Controls.Web/CheckBoxList.cs
@@ -0,0 +1,13 @@
+//using System.Web.UI.WebControls;
+
+//namespace GLib.Controls.Web
+//{
+// public class CheckBoxList : System.Web.UI.WebControls.CheckBoxList
+// {
+// public CheckBoxList()
+// {
+// DataValueField = ControlsConfig.Controls_DataValueField;
+// DataTextField = ControlsConfig.Controls_DataTextField;
+// }
+// }
+//}
diff --git a/Common.GLib.WinControls/GLib.Controls.Web/ControlsConfig.cs b/Common.GLib.WinControls/GLib.Controls.Web/ControlsConfig.cs
new file mode 100644
index 0000000000000000000000000000000000000000..944360397a383fab58233590db89f4d9d630d394
--- /dev/null
+++ b/Common.GLib.WinControls/GLib.Controls.Web/ControlsConfig.cs
@@ -0,0 +1,9 @@
+namespace GLib.Controls.Web
+{
+ internal class ControlsConfig
+ {
+ public static string Controls_DataValueField => "Key";
+
+ public static string Controls_DataTextField => "Value";
+ }
+}
diff --git a/Common.GLib.WinControls/GLib.Controls.Web/DropDownList.cs b/Common.GLib.WinControls/GLib.Controls.Web/DropDownList.cs
new file mode 100644
index 0000000000000000000000000000000000000000..ade7f336a34240af87e8e39de0bc609ca8b8f87d
--- /dev/null
+++ b/Common.GLib.WinControls/GLib.Controls.Web/DropDownList.cs
@@ -0,0 +1,13 @@
+//using System.Web.UI.WebControls;
+
+//namespace GLib.Controls.Web
+//{
+// public class DropDownList : System.Web.UI.WebControls.DropDownList
+// {
+// public DropDownList()
+// {
+// DataValueField = ControlsConfig.Controls_DataValueField;
+// DataTextField = ControlsConfig.Controls_DataTextField;
+// }
+// }
+//}
diff --git a/Common.GLib.WinControls/GLib.Controls.Web/GridView.cs b/Common.GLib.WinControls/GLib.Controls.Web/GridView.cs
new file mode 100644
index 0000000000000000000000000000000000000000..4dd4297b30f1357858e8fea16ea56e3c99f884da
--- /dev/null
+++ b/Common.GLib.WinControls/GLib.Controls.Web/GridView.cs
@@ -0,0 +1,8 @@
+//using System.Web.UI.WebControls;
+
+//namespace GLib.Controls.Web
+//{
+// public class GridView : System.Web.UI.WebControls.GridView
+// {
+// }
+//}
diff --git a/Common.GLib.WinControls/GLib.Controls.Web/HiddenField.cs b/Common.GLib.WinControls/GLib.Controls.Web/HiddenField.cs
new file mode 100644
index 0000000000000000000000000000000000000000..9745e50906403b603df7d78928ff4543123a9df3
--- /dev/null
+++ b/Common.GLib.WinControls/GLib.Controls.Web/HiddenField.cs
@@ -0,0 +1,8 @@
+//using System.Web.UI.WebControls;
+
+namespace GLib.Controls.Web
+{
+ //public class HiddenField : System.Web.UI.WebControls.HiddenField
+ //{
+ //}
+}
diff --git a/Common.GLib.WinControls/GLib.Controls.Web/HyperLink.cs b/Common.GLib.WinControls/GLib.Controls.Web/HyperLink.cs
new file mode 100644
index 0000000000000000000000000000000000000000..d5f1a6d07750dc1a99ba7984f8abe7bfba657efd
--- /dev/null
+++ b/Common.GLib.WinControls/GLib.Controls.Web/HyperLink.cs
@@ -0,0 +1,8 @@
+//using System.Web.UI.WebControls;
+
+//namespace GLib.Controls.Web
+//{
+// public class HyperLink : System.Web.UI.WebControls.HyperLink
+// {
+// }
+//}
diff --git a/Common.GLib.WinControls/GLib.Controls.Web/Image.cs b/Common.GLib.WinControls/GLib.Controls.Web/Image.cs
new file mode 100644
index 0000000000000000000000000000000000000000..c5dc76b49e89cc822bd18f579062d633cc53c34a
--- /dev/null
+++ b/Common.GLib.WinControls/GLib.Controls.Web/Image.cs
@@ -0,0 +1,8 @@
+//using System.Web.UI.WebControls;
+
+//namespace GLib.Controls.Web
+//{
+// public class Image : System.Web.UI.WebControls.Image
+// {
+// }
+//}
diff --git a/Common.GLib.WinControls/GLib.Controls.Web/ImageButton.cs b/Common.GLib.WinControls/GLib.Controls.Web/ImageButton.cs
new file mode 100644
index 0000000000000000000000000000000000000000..bf9ec45e065c9f3680da7af4ea8c0074c3d4a004
--- /dev/null
+++ b/Common.GLib.WinControls/GLib.Controls.Web/ImageButton.cs
@@ -0,0 +1,8 @@
+//using System.Web.UI.WebControls;
+
+namespace GLib.Controls.Web
+{
+ //public class ImageButton : System.Web.UI.WebControls.ImageButton
+ //{
+ //}
+}
diff --git a/Common.GLib.WinControls/GLib.Controls.Web/ImageMap.cs b/Common.GLib.WinControls/GLib.Controls.Web/ImageMap.cs
new file mode 100644
index 0000000000000000000000000000000000000000..0c89a3bd4b7ebf74421c59d503bae64ee722705b
--- /dev/null
+++ b/Common.GLib.WinControls/GLib.Controls.Web/ImageMap.cs
@@ -0,0 +1,8 @@
+//using System.Web.UI.WebControls;
+
+//namespace GLib.Controls.Web
+//{
+// public class ImageMap : System.Web.UI.WebControls.ImageMap
+// {
+// }
+//}
diff --git a/Common.GLib.WinControls/GLib.Controls.Web/Label.cs b/Common.GLib.WinControls/GLib.Controls.Web/Label.cs
new file mode 100644
index 0000000000000000000000000000000000000000..55a45c3d254e1f9aa1082cbfc039ec78fed5a6e6
--- /dev/null
+++ b/Common.GLib.WinControls/GLib.Controls.Web/Label.cs
@@ -0,0 +1,8 @@
+//using System.Web.UI.WebControls;
+
+//namespace GLib.Controls.Web
+//{
+// public class Label : System.Web.UI.WebControls.Label
+// {
+// }
+//}
diff --git a/Common.GLib.WinControls/GLib.Controls.Web/LinkButton.cs b/Common.GLib.WinControls/GLib.Controls.Web/LinkButton.cs
new file mode 100644
index 0000000000000000000000000000000000000000..ac0a81b4b6c5260cdd5743218aac9f8badff7212
--- /dev/null
+++ b/Common.GLib.WinControls/GLib.Controls.Web/LinkButton.cs
@@ -0,0 +1,8 @@
+//using System.Web.UI.WebControls;
+
+//namespace GLib.Controls.Web
+//{
+// public class LinkButton : System.Web.UI.WebControls.LinkButton
+// {
+// }
+//}
diff --git a/Common.GLib.WinControls/GLib.Controls.Web/ListBox.cs b/Common.GLib.WinControls/GLib.Controls.Web/ListBox.cs
new file mode 100644
index 0000000000000000000000000000000000000000..667b4559a314dc40120734520e8b82434325095e
--- /dev/null
+++ b/Common.GLib.WinControls/GLib.Controls.Web/ListBox.cs
@@ -0,0 +1,13 @@
+//using System.Web.UI.WebControls;
+
+//namespace GLib.Controls.Web
+//{
+// public class ListBox : System.Web.UI.WebControls.ListBox
+// {
+// public ListBox()
+// {
+// DataValueField = ControlsConfig.Controls_DataValueField;
+// DataTextField = ControlsConfig.Controls_DataTextField;
+// }
+// }
+//}
diff --git a/Common.GLib.WinControls/GLib.Controls.Web/ListView.cs b/Common.GLib.WinControls/GLib.Controls.Web/ListView.cs
new file mode 100644
index 0000000000000000000000000000000000000000..e2cf2766b25ab40cb738422ea879e52711ad692f
--- /dev/null
+++ b/Common.GLib.WinControls/GLib.Controls.Web/ListView.cs
@@ -0,0 +1,8 @@
+//using System.Web.UI.WebControls;
+
+//namespace GLib.Controls.Web
+//{
+// public class ListView : System.Web.UI.WebControls.ListView
+// {
+// }
+//}
diff --git a/Common.GLib.WinControls/GLib.Controls.Web/Literal.cs b/Common.GLib.WinControls/GLib.Controls.Web/Literal.cs
new file mode 100644
index 0000000000000000000000000000000000000000..af74d54f7c3f4c5f55661797b14759f15f4abe4a
--- /dev/null
+++ b/Common.GLib.WinControls/GLib.Controls.Web/Literal.cs
@@ -0,0 +1,8 @@
+//using System.Web.UI.WebControls;
+
+//namespace GLib.Controls.Web
+//{
+// public class Literal : System.Web.UI.WebControls.Literal
+// {
+// }
+//}
diff --git a/Common.GLib.WinControls/GLib.Controls.Web/Panel.cs b/Common.GLib.WinControls/GLib.Controls.Web/Panel.cs
new file mode 100644
index 0000000000000000000000000000000000000000..bc77e509fe38f91d8d732df5d617008ec4c043c5
--- /dev/null
+++ b/Common.GLib.WinControls/GLib.Controls.Web/Panel.cs
@@ -0,0 +1,8 @@
+//using System.Web.UI.WebControls;
+
+//namespace GLib.Controls.Web
+//{
+// public class Panel : System.Web.UI.WebControls.Panel
+// {
+// }
+//}
diff --git a/Common.GLib.WinControls/GLib.Controls.Web/PlaceHolder.cs b/Common.GLib.WinControls/GLib.Controls.Web/PlaceHolder.cs
new file mode 100644
index 0000000000000000000000000000000000000000..97515f62ebb10cebc1594f8b8b2f0fbe9a26d2b9
--- /dev/null
+++ b/Common.GLib.WinControls/GLib.Controls.Web/PlaceHolder.cs
@@ -0,0 +1,8 @@
+//using System.Web.UI.WebControls;
+
+//namespace GLib.Controls.Web
+//{
+// public class PlaceHolder : System.Web.UI.WebControls.PlaceHolder
+// {
+// }
+//}
diff --git a/Common.GLib.WinControls/GLib.Controls.Web/RadioButton.cs b/Common.GLib.WinControls/GLib.Controls.Web/RadioButton.cs
new file mode 100644
index 0000000000000000000000000000000000000000..baf418e271c4b829fd8453a6a2c660fbb567eb80
--- /dev/null
+++ b/Common.GLib.WinControls/GLib.Controls.Web/RadioButton.cs
@@ -0,0 +1,8 @@
+//using System.Web.UI.WebControls;
+
+//namespace GLib.Controls.Web
+//{
+// public class RadioButton : System.Web.UI.WebControls.RadioButton
+// {
+// }
+//}
diff --git a/Common.GLib.WinControls/GLib.Controls.Web/RadioButtonList.cs b/Common.GLib.WinControls/GLib.Controls.Web/RadioButtonList.cs
new file mode 100644
index 0000000000000000000000000000000000000000..f661398f4296316363d0ba6ce343673c7f1d3e50
--- /dev/null
+++ b/Common.GLib.WinControls/GLib.Controls.Web/RadioButtonList.cs
@@ -0,0 +1,13 @@
+//using System.Web.UI.WebControls;
+
+//namespace GLib.Controls.Web
+//{
+// public class RadioButtonList : System.Web.UI.WebControls.RadioButtonList
+// {
+// public RadioButtonList()
+// {
+// DataValueField = ControlsConfig.Controls_DataValueField;
+// DataTextField = ControlsConfig.Controls_DataTextField;
+// }
+// }
+//}
diff --git a/Common.GLib.WinControls/GLib.Controls.Web/TextBox.cs b/Common.GLib.WinControls/GLib.Controls.Web/TextBox.cs
new file mode 100644
index 0000000000000000000000000000000000000000..84a193c9a0cc85e6f8fb6c1aa48f9a2e157161f0
--- /dev/null
+++ b/Common.GLib.WinControls/GLib.Controls.Web/TextBox.cs
@@ -0,0 +1,8 @@
+//using System.Web.UI.WebControls;
+
+//namespace GLib.Controls.Web
+//{
+// public class TextBox : System.Web.UI.WebControls.TextBox
+// {
+// }
+//}
diff --git a/Common.GLib.WinControls/GLib/DebugEx.cs b/Common.GLib.WinControls/GLib/DebugEx.cs
new file mode 100644
index 0000000000000000000000000000000000000000..02df780fb0e5731860f7e7a9f0cd36af600ddaab
--- /dev/null
+++ b/Common.GLib.WinControls/GLib/DebugEx.cs
@@ -0,0 +1,131 @@
+using System;
+using System.IO;
+using System.Reflection;
+using System.Text;
+using System.Threading;
+using System.Windows.Forms;
+
+namespace GLib
+{
+ public static class DebugEx
+ {
+ private static string _appName = "";
+
+ private static Action _unhandledExceptionCallBack = null;
+
+ private static bool _alertExceptionMsg = false;
+
+ public static string LogPath = Application.StartupPath + "\\log\\";
+
+ public static string Version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
+
+ public static event Action EvtTrace;
+
+ public static void Trace(string flag, string msg)
+ {
+ string text = $"{flag}___{msg}";
+ Console.WriteLine(text);
+ if (EvtTrace != null)
+ {
+ EvtTrace(text);
+ }
+ }
+
+ public static void RegisterUnHandldException()
+ {
+ RegisterUnHandldException(Application.ProductName, null, alertExceptionMsg: true);
+ }
+
+ public static void RegisterUnHandldException(string appName, Action unhandledExceptionCallBack, bool alertExceptionMsg = false)
+ {
+ _appName = appName;
+ _alertExceptionMsg = alertExceptionMsg;
+ _unhandledExceptionCallBack = unhandledExceptionCallBack;
+ Application.ThreadException += Application_ThreadException;
+ AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
+ }
+
+ private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
+ {
+ OnFatalException(e.ExceptionObject as Exception);
+ if (e.IsTerminating && _unhandledExceptionCallBack != null)
+ {
+ _unhandledExceptionCallBack(e);
+ }
+ }
+
+ private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
+ {
+ OnFatalException(e.Exception);
+ }
+
+ public static void OnFatalException(Exception ex, bool isEnd = false)
+ {
+ StringBuilder stringBuilder = new StringBuilder();
+ string text = "";
+ string version = Version;
+ text = $"{_appName} {version} {DateTime.Now}";
+ if (isEnd)
+ {
+ text = string.Format("=================致命错误==================\r\n{0} {1}", _appName, "");
+ }
+ stringBuilder.AppendLine(text);
+ stringBuilder.AppendLine(GetErrorString(ex));
+ WriteLog(stringBuilder.ToString());
+ string text2 = $"{text}出现一个未处理的异常\r\n请将程序安装目录下的日志反馈给软件提供商。\r\n详细信息:{ex.Message + ex.StackTrace}\r\n发生时间:{DateTime.Now}";
+ if (!_alertExceptionMsg)
+ {
+ }
+ }
+
+ public static string GetLog(Exception ex, bool isEnd = false)
+ {
+ StringBuilder stringBuilder = new StringBuilder();
+ string text = "";
+ string arg = Assembly.GetExecutingAssembly().GetName().Version.ToString();
+ text = $"{_appName} {arg} {DateTime.Now}";
+ if (isEnd)
+ {
+ text = string.Format("=================致命错误==================\r\n{0} {1}", _appName, "");
+ }
+ stringBuilder.AppendLine(text);
+ stringBuilder.AppendLine(GetErrorString(ex));
+ return stringBuilder.ToString();
+ }
+
+ public static void WriteLog(string msg)
+ {
+ string text = LogPath.ToSystemPath();
+ if (!Directory.Exists(text))
+ {
+ Directory.CreateDirectory(text);
+ }
+ string path = string.Format("{0}\\Log_{1}.txt", text, DateTime.Now.ToString("yyyy-MM-dd")).ToSystemPath();
+ File.AppendAllText(path, msg + "\r\n", Encoding.UTF8);
+ }
+
+ private static string GetErrorString(Exception ex, string pleft = "")
+ {
+ StringBuilder stringBuilder = new StringBuilder();
+ stringBuilder.AppendLine(pleft + ex.Message);
+ stringBuilder.AppendLine(pleft + ex.GetType().Name);
+ stringBuilder.AppendLine(pleft + ex.StackTrace);
+ if (ex.InnerException != null)
+ {
+ stringBuilder.AppendLine("---------------------------------------------->");
+ stringBuilder.AppendLine(GetErrorString(ex.InnerException, pleft + " "));
+ }
+ return stringBuilder.ToString();
+ }
+
+ public static string ToSystemPath(this string path)
+ {
+ if (Environment.OSVersion.Platform == PlatformID.Unix)
+ {
+ return path.Replace("\\", "/");
+ }
+ return path.Replace("/", "\\");
+ }
+ }
+
+}
diff --git a/Common.GLib.WinControls/RegistryHelper.cs b/Common.GLib.WinControls/RegistryHelper.cs
new file mode 100644
index 0000000000000000000000000000000000000000..54aa27b7b766c7a331f15d806d77e1d4b0b24575
--- /dev/null
+++ b/Common.GLib.WinControls/RegistryHelper.cs
@@ -0,0 +1,81 @@
+using Microsoft.Win32;
+using System;
+using System.Diagnostics;
+using System.Windows.Forms;
+
+public class RegistryHelper
+{
+ public static bool ConfigAutoStart(bool isAutoStart, string[] args)
+ {
+ try
+ {
+ string processName = Process.GetCurrentProcess().ProcessName;
+ RegistryKey registryKey = null;
+ using (registryKey = OpenKeyForWrite("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"))
+ {
+ if (registryKey == null)
+ {
+ return false;
+ }
+ string text = $"\"{Application.ExecutablePath}\"";
+ for (int i = 0; i < args.Length; i++)
+ {
+ text = ((i != 2) ? (text + " " + args[i]) : (text + " " + $"\"{args[i]}\""));
+ }
+ if (isAutoStart)
+ {
+ registryKey.SetValue(processName, text);
+ }
+ else
+ {
+ registryKey.DeleteValue(processName, throwOnMissingValue: false);
+ }
+ registryKey.Close();
+ return true;
+ }
+ }
+ catch (Exception)
+ {
+ return false;
+ }
+ }
+
+ public static RegistryKey OpenKeyForWrite(string subKey)
+ {
+ return OpenKeyForWrite(Registry.LocalMachine, subKey);
+ }
+
+ public static RegistryKey OpenKeyForWrite(RegistryKey key, string subKey)
+ {
+ RegistryKey registryKey = null;
+ registryKey = key.OpenSubKey(subKey, writable: true);
+ if (registryKey == null)
+ {
+ registryKey = key.CreateSubKey(subKey);
+ }
+ return registryKey;
+ }
+
+ public static void WriteAutoLoginWindowRegistryKey(bool isAutoLogin, string defaultUserName, string defaultPassword)
+ {
+ try
+ {
+ RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon", writable: true);
+ if (isAutoLogin)
+ {
+ registryKey.SetValue("AutoAdminLogon", "1");
+ registryKey.SetValue("DefaultUserName", defaultUserName);
+ registryKey.SetValue("DefaultPassword", defaultPassword);
+ }
+ else
+ {
+ registryKey.SetValue("AutoAdminLogon", "0");
+ registryKey.SetValue("DefaultPassword", string.Empty);
+ }
+ registryKey.Close();
+ }
+ catch (Exception)
+ {
+ }
+ }
+}
diff --git a/Common.GLib.WinControls/Watchdog.cs b/Common.GLib.WinControls/Watchdog.cs
new file mode 100644
index 0000000000000000000000000000000000000000..b0a9479b060cee8fa316c88f8655b8de1bc46386
--- /dev/null
+++ b/Common.GLib.WinControls/Watchdog.cs
@@ -0,0 +1,236 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading;
+using System.Windows.Forms;
+
+public static class Watchdog
+{
+ private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
+ {
+ OnFatalException(e.Exception);
+ }
+
+ private static int CheckActive(string appName)
+ {
+ int num = 0;
+ Process[] processes = Process.GetProcesses();
+ foreach (Process process in processes)
+ {
+ if (process.ProcessName == appName)
+ {
+ num++;
+ }
+ }
+ return num;
+ }
+
+ private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
+ {
+ OnFatalException(e.ExceptionObject as Exception);
+ }
+
+ [DllImport("user32.dll", CharSet = CharSet.Unicode)]
+ public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
+
+ [DllImport("User32.dll", CharSet = CharSet.Unicode)]
+ public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string strClassName, string strWindowName);
+
+ [DllImport("user32.dll")]
+ private static extern int GetWindowThreadProcessId(IntPtr hWnd, out int ProcessId);
+
+ private static void HideConsoleWindow()
+ {
+ Console.Title = Application.ProductName;
+ IntPtr intPtr = FindWindow("ConsoleWindowClass", Application.ProductName);
+ if (intPtr != IntPtr.Zero)
+ {
+ ShowWindow(intPtr, 0u);
+ }
+ }
+
+ private static void KillDApp(string appName)
+ {
+ List list = Enumerable.ToList(Enumerable.Select(new string[6]
+ {
+ "WerFault.exe",
+ "dwwin.exe",
+ "dw20.exe",
+ "WerFault",
+ "dwwin",
+ "dw20"
+ }, (string p) => p.ToUpper()));
+ Process[] processes = Process.GetProcesses();
+ Process[] array = processes;
+ foreach (Process process in array)
+ {
+ try
+ {
+ if (list.Contains(process.ProcessName.ToUpper().Replace(" *32", "")))
+ {
+ Log($"异常进程:{process.ProcessName}");
+ process.Kill();
+ }
+ }
+ catch (Exception)
+ {
+ }
+ }
+ try
+ {
+ IntPtr intPtr = FindWindowEx(IntPtr.Zero, IntPtr.Zero, null, $"{appName}.exe - 应用程序错误");
+ if (intPtr != IntPtr.Zero)
+ {
+ int ProcessId = 0;
+ GetWindowThreadProcessId(intPtr, out ProcessId);
+ if (ProcessId != 0)
+ {
+ Process.GetProcessById(ProcessId).Kill();
+ Log($"异常窗口 {appName}.exe - 应用程序错误");
+ }
+ }
+ intPtr = FindWindowEx(IntPtr.Zero, IntPtr.Zero, null, "Microsoft Visual C++ Runtime Library");
+ if (intPtr != IntPtr.Zero)
+ {
+ int ProcessId2 = 0;
+ GetWindowThreadProcessId(intPtr, out ProcessId2);
+ if (ProcessId2 != 0)
+ {
+ Process.GetProcessById(ProcessId2).Kill();
+ Log($"异常窗口 {appName}.exe - Microsoft Visual C++ Runtime Library");
+ }
+ }
+ }
+ catch (Exception)
+ {
+ }
+ }
+
+ private static void KillOtherDog()
+ {
+ Process currentProcess = Process.GetCurrentProcess();
+ Process[] processes = Process.GetProcesses();
+ foreach (Process process in processes)
+ {
+ if (process.ProcessName.ToUpper() == currentProcess.ProcessName.ToUpper())
+ {
+ try
+ {
+ if (currentProcess.Id != process.Id)
+ {
+ process.Kill();
+ }
+ }
+ catch (Exception)
+ {
+ }
+ }
+ }
+ }
+
+ private static void Log(string msg)
+ {
+ msg = $"{DateTime.Now} {msg}";
+ Console.WriteLine(msg);
+ string text = Application.StartupPath + "\\Watchdog";
+ if (!Directory.Exists(text))
+ {
+ Directory.CreateDirectory(text);
+ }
+ File.AppendAllText(string.Format("{0}\\{1}.txt", text, DateTime.Now.ToString("yyyy_MM")), msg + "\r\n");
+ }
+
+ private static void Main(string[] args)
+ {
+ try
+ {
+ RegisterUnHandldException();
+ HideConsoleWindow();
+ string text = args[0];
+ string text2 = args[1];
+ string text3 = args[2];
+ int num = int.Parse(args[3]);
+ string text4 = args[4];
+ string text5 = args[5];
+ string text6 = (args.Length > 6) ? args[6] : null;
+ string text7 = (args.Length > 7) ? args[7] : null;
+ Console.WriteLine(string.Format("{0} {1} {2} {3} {4} {5} {6}", text, text2, text3, num, text4, text5, text6, text7));
+ if (!(text == "0"))
+ {
+ RegistryHelper.ConfigAutoStart(text4 == "1", args);
+ KillOtherDog();
+ DateTime now = DateTime.Now;
+ while (true)
+ {
+ bool flag = true;
+ KillDApp(text2);
+ if (CheckActive(text2) > 0)
+ {
+ now = DateTime.Now;
+ }
+ if (now.AddSeconds(num) < DateTime.Now)
+ {
+ StartApp(text2, text3);
+ now = DateTime.Now;
+ }
+ Thread.Sleep(1000);
+ }
+ }
+ RegistryHelper.ConfigAutoStart(isAutoStart: false, args);
+ KillOtherDog();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex.ToString());
+ Console.Read();
+ }
+ }
+
+ private static void OnFatalException(Exception ex)
+ {
+ StringBuilder stringBuilder = new StringBuilder();
+ string value = string.Format("{0} {1}", "Watchdog", "");
+ stringBuilder.AppendLine(value);
+ stringBuilder.AppendLine(ex.Message);
+ stringBuilder.AppendLine(ex.GetType().Name);
+ stringBuilder.AppendLine(ex.StackTrace);
+ Log(stringBuilder.ToString());
+ }
+
+ private static void RegisterUnHandldException()
+ {
+ Application.ThreadException += Application_ThreadException;
+ AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
+ }
+
+ [DllImport("user32.dll")]
+ public static extern bool ShowWindow(IntPtr hWnd, uint nCmdShow);
+
+ private static void StartApp(string appName, string exe)
+ {
+ try
+ {
+ int num = CheckActive(appName);
+ Log($"尝试启动 {appName} 路径:{exe}");
+ Directory.SetCurrentDirectory(new FileInfo(exe).Directory.ToString());
+ Process.Start(exe);
+ if (CheckActive(appName) > num)
+ {
+ Log($"启动成功 {appName} 路径:{exe}");
+ }
+ else
+ {
+ Log($"启动失败 {appName} 路径:{exe}");
+ }
+ Thread.Sleep(3000);
+ }
+ catch (Exception arg)
+ {
+ Log($"启动异常 {appName} 路径:{exe} \r\n异常信息 {arg}");
+ }
+ }
+}
diff --git a/Common.GLib/AXLib.Utility/Action.cs b/Common.GLib/AXLib.Utility/Action.cs
new file mode 100644
index 0000000000000000000000000000000000000000..dcf7b14dff928c20b1993a76dae2981b938aeffb
--- /dev/null
+++ b/Common.GLib/AXLib.Utility/Action.cs
@@ -0,0 +1,22 @@
+using System;
+
+namespace AXLib.Utility
+{
+ public class Action : IAction
+ {
+ private System.Action _action = null;
+
+ public Action(System.Action action)
+ {
+ _action = action;
+ }
+
+ public void invoke(T t)
+ {
+ if (_action != null)
+ {
+ _action(t);
+ }
+ }
+ }
+}
diff --git a/Common.GLib/AXLib.Utility/Callback.cs b/Common.GLib/AXLib.Utility/Callback.cs
new file mode 100644
index 0000000000000000000000000000000000000000..ed764c70b76d571bb34a88c3aa3ab87bd50dacb7
--- /dev/null
+++ b/Common.GLib/AXLib.Utility/Callback.cs
@@ -0,0 +1,22 @@
+using System;
+
+namespace AXLib.Utility
+{
+ public class Callback : ICallback
+ {
+ private Action _action = null;
+
+ public Callback(Action action)
+ {
+ _action = action;
+ }
+
+ public void invoke()
+ {
+ if (_action != null)
+ {
+ _action();
+ }
+ }
+ }
+}
diff --git a/Common.GLib/AXLib.Utility/IAction.cs b/Common.GLib/AXLib.Utility/IAction.cs
new file mode 100644
index 0000000000000000000000000000000000000000..7762efa40d755ec19f5fa16a988d0950e0405c98
--- /dev/null
+++ b/Common.GLib/AXLib.Utility/IAction.cs
@@ -0,0 +1,7 @@
+namespace AXLib.Utility
+{
+ public interface IAction
+ {
+ void invoke(T t);
+ }
+}
diff --git a/Common.GLib/AXLib.Utility/ICallback.cs b/Common.GLib/AXLib.Utility/ICallback.cs
new file mode 100644
index 0000000000000000000000000000000000000000..d036c8acc7f83f5de3c84d3a788f1be6c7df06ba
--- /dev/null
+++ b/Common.GLib/AXLib.Utility/ICallback.cs
@@ -0,0 +1,7 @@
+namespace AXLib.Utility
+{
+ public interface ICallback
+ {
+ void invoke();
+ }
+}
diff --git a/Common.GLib/Common.GLib.csproj b/Common.GLib/Common.GLib.csproj
new file mode 100644
index 0000000000000000000000000000000000000000..7882e1c80875fa07bbdceae1b974fdc2d25dd6a6
--- /dev/null
+++ b/Common.GLib/Common.GLib.csproj
@@ -0,0 +1,22 @@
+
+
+ Library
+ 8.0
+ false
+ GLib
+ Common.GLib
+ netstandard2.0
+ true
+
+
+
+ TRACE;DEBUG;NETCOREAPP3_1
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Common.GLib/GLib.AXLib.Utility/ALog.cs b/Common.GLib/GLib.AXLib.Utility/ALog.cs
new file mode 100644
index 0000000000000000000000000000000000000000..453c94a2a55efc1a94d55a9aa00c24b943d873ac
--- /dev/null
+++ b/Common.GLib/GLib.AXLib.Utility/ALog.cs
@@ -0,0 +1,109 @@
+using System;
+
+namespace GLib.AXLib.Utility
+{
+ public class ALog
+ {
+ public bool Enabled;
+
+ public bool EnabledT;
+
+ public bool EnabledI;
+
+ public bool EnabledD;
+
+ public bool EnabledE;
+
+ public string Tag;
+
+ private ALog(string tag)
+ {
+ Tag = tag;
+ Enabled = (EnabledT = (EnabledI = (EnabledD = (EnabledE = true))));
+ }
+
+ public static ALog Create(string tag)
+ {
+ return new ALog(tag);
+ }
+
+ public static ALog Create(Type type)
+ {
+ return new ALog(type.Name);
+ }
+
+ private void Print(string str)
+ {
+ Console.WriteLine(str);
+ }
+
+ private void Print(Exception e)
+ {
+ Console.WriteLine(e.ToString());
+ }
+
+ public void I(string format, params string[] args)
+ {
+ if (Enabled && EnabledI)
+ {
+ Print(string.Format(format, args));
+ }
+ }
+
+ public void I(Exception e)
+ {
+ if (Enabled && EnabledI)
+ {
+ Print(e);
+ }
+ }
+
+ public void T(string format, params string[] args)
+ {
+ if (Enabled && EnabledT)
+ {
+ Print(string.Format(format, args));
+ }
+ }
+
+ public void T(Exception e)
+ {
+ if (Enabled && EnabledT)
+ {
+ Print(e);
+ }
+ }
+
+ public void D(string format, params string[] args)
+ {
+ if (Enabled && EnabledD)
+ {
+ Print(string.Format(format, args));
+ }
+ }
+
+ public void D(Exception e)
+ {
+ if (Enabled && EnabledD)
+ {
+ Print(e);
+ }
+ }
+
+ public void E(string format, params string[] args)
+ {
+ if (Enabled && EnabledE)
+ {
+ Print(string.Format(format, args));
+ }
+ }
+
+ public void E(Exception e)
+ {
+ if (Enabled && EnabledE)
+ {
+ Print(e);
+ }
+ }
+ }
+}
diff --git a/Common.GLib/GLib.AXLib.Utility/Loop.cs b/Common.GLib/GLib.AXLib.Utility/Loop.cs
new file mode 100644
index 0000000000000000000000000000000000000000..39f0040c7a34e00cdb5c0768dc6c753cc5619949
--- /dev/null
+++ b/Common.GLib/GLib.AXLib.Utility/Loop.cs
@@ -0,0 +1,53 @@
+using System;
+
+namespace GLib.AXLib.Utility
+{
+ public class Loop
+ {
+ private int _interval = 0;
+
+ private Action _callback = null;
+
+ private Action _error = null;
+
+ private bool _isRuning = false;
+
+ public Guid Key
+ {
+ get;
+ private set;
+ }
+
+ public int Interval => _interval;
+
+ public Loop(int interval, Action callback)
+ : this(interval, callback, null)
+ {
+ }
+
+ public Loop(int interval, Action callback, Action error)
+ {
+ _interval = interval;
+ _callback = callback;
+ _error = error;
+ }
+
+ public void Start()
+ {
+ if (!_isRuning)
+ {
+ _isRuning = true;
+ Key = ThreadEx.NewTimer(_interval, _callback, _error);
+ }
+ }
+
+ public void Stop()
+ {
+ if (_isRuning)
+ {
+ _isRuning = false;
+ ThreadEx.FreeTimer(Key);
+ }
+ }
+ }
+}
diff --git a/Common.GLib/GLib.AXLib.Utility/ObjectPool.cs b/Common.GLib/GLib.AXLib.Utility/ObjectPool.cs
new file mode 100644
index 0000000000000000000000000000000000000000..fc9f8771e16bae0c3c8f488a6b0bf1e5776e5d34
--- /dev/null
+++ b/Common.GLib/GLib.AXLib.Utility/ObjectPool.cs
@@ -0,0 +1,154 @@
+using GLib.GeneralModel;
+using System;
+using System.Collections.Generic;
+
+namespace GLib.AXLib.Utility
+{
+ public class ObjectPool
+ {
+ public class Item
+ {
+ private int _refCount = 0;
+
+ private object _lockObj = new object();
+
+ private ObjectPool _control = null;
+
+ public T Object
+ {
+ get;
+ private set;
+ }
+
+ public Item(ObjectPool control, T @object)
+ {
+ Object = @object;
+ _control = control;
+ }
+
+ public void AddRef()
+ {
+ lock (_lockObj)
+ {
+ _refCount++;
+ if (_refCount > 1)
+ {
+ throw new Exception();
+ }
+ }
+ }
+
+ public void DelRef()
+ {
+ lock (_lockObj)
+ {
+ _refCount--;
+ if (_refCount < 0)
+ {
+ throw new Exception();
+ }
+ if (_refCount == 0)
+ {
+ _control.ReleaseItem(this);
+ }
+ }
+ }
+ }
+
+ private int _min = 0;
+
+ private int _max = 0;
+
+ private int _count = 0;
+
+ private AQueue- _qIdle = new AQueue
- ();
+
+ private List
- _listUsed = new List
- ();
+
+ private Func _getObjectItemCallback = null;
+
+ public ObjectPool(int count, Func getObjectItemCallback)
+ : this(count, count, getObjectItemCallback)
+ {
+ }
+
+ public ObjectPool(int min, int max, Func getObjectItemCallback)
+ {
+ _min = min;
+ _max = max;
+ _getObjectItemCallback = getObjectItemCallback;
+ Init();
+ }
+
+ public ObjectPool(T[] arr)
+ {
+ _min = arr.Length;
+ _max = arr.Length;
+ lock (_qIdle)
+ {
+ foreach (T @object in arr)
+ {
+ Item item = new Item(this, @object);
+ _qIdle.Enqueue(item);
+ _count++;
+ }
+ }
+ }
+
+ private void Init()
+ {
+ for (int i = 0; i < _min; i++)
+ {
+ AddItem();
+ }
+ }
+
+ private void AddItem()
+ {
+ lock (_qIdle)
+ {
+ Item item = new Item(this, _getObjectItemCallback());
+ _qIdle.Enqueue(item);
+ _count++;
+ }
+ }
+
+ public Item AllowItem()
+ {
+ lock (_qIdle)
+ {
+ if (_qIdle.Count > 0)
+ {
+ Item item = _qIdle.Dequeue();
+ item.AddRef();
+ lock (_listUsed)
+ {
+ if (!_listUsed.Contains(item))
+ {
+ _listUsed.Add(item);
+ }
+ }
+ return item;
+ }
+ if (_count < _max)
+ {
+ AddItem();
+ return AllowItem();
+ }
+ return null;
+ }
+ }
+
+ public void ReleaseItem(Item item)
+ {
+ lock (_qIdle)
+ {
+ lock (_listUsed)
+ {
+ _listUsed.Remove(item);
+ }
+ _qIdle.Enqueue(item);
+ }
+ }
+ }
+}
diff --git a/Common.GLib/GLib.AXLib.Utility/RuntimeExceptionEx.cs b/Common.GLib/GLib.AXLib.Utility/RuntimeExceptionEx.cs
new file mode 100644
index 0000000000000000000000000000000000000000..dd05e448406d97c3f4e9a84b4e7dc9534c115b23
--- /dev/null
+++ b/Common.GLib/GLib.AXLib.Utility/RuntimeExceptionEx.cs
@@ -0,0 +1,62 @@
+using System;
+
+namespace GLib.AXLib.Utility
+{
+ public class RuntimeExceptionEx : Exception
+ {
+ private bool _setMsged = false;
+
+ public new string Message = null;
+
+ public bool CanCancel = false;
+
+ public string StackTraceString = "";
+
+ public RuntimeExceptionEx(string msg)
+ : base(msg)
+ {
+ SetStackTraceString();
+ }
+
+ public RuntimeExceptionEx(Exception e)
+ : base(e.Message, e)
+ {
+ SetStackTraceString();
+ }
+
+ public RuntimeExceptionEx(string msg, Exception e)
+ : base(msg, e)
+ {
+ }
+
+ private void SetStackTraceString()
+ {
+ StackTraceString = ToString();
+ }
+
+ public static string GetStackTraceString(Exception e)
+ {
+ return GetStackTraceString(e, "");
+ }
+
+ public static string GetStackTraceString(Exception e, string span)
+ {
+ return e?.ToString();
+ }
+
+ public static void PrintException(Exception e)
+ {
+ Console.WriteLine("PrintException", GetStackTraceString(e));
+ }
+
+ public static RuntimeExceptionEx Create(Exception e)
+ {
+ return new RuntimeExceptionEx(e);
+ }
+
+ public static RuntimeExceptionEx Create(string msg)
+ {
+ return new RuntimeExceptionEx(msg);
+ }
+ }
+}
diff --git a/Common.GLib/GLib.AXLib.Utility/ThreadEx.cs b/Common.GLib/GLib.AXLib.Utility/ThreadEx.cs
new file mode 100644
index 0000000000000000000000000000000000000000..e5595ae6112ba56c626e0a7dd92cb3f47a2b7a41
--- /dev/null
+++ b/Common.GLib/GLib.AXLib.Utility/ThreadEx.cs
@@ -0,0 +1,554 @@
+using GLib.GeneralModel;
+using System;
+using System.Collections.Generic;
+using System.Threading;
+
+namespace GLib.AXLib.Utility
+{
+ public class ThreadEx
+ {
+ private class TimerExecuter
+ {
+ private bool _isworking = false;
+
+ private Semaphore _semaphore = new Semaphore(0, 1);
+
+ private TimerInfo _timerInfo;
+
+ private Thread _loopThread = null;
+
+ private Action _completed;
+
+ private bool _rerun = false;
+
+ private object _syncObj = new object();
+
+ public bool IsRuning
+ {
+ get;
+ private set;
+ }
+
+ public long CompleteTime
+ {
+ get;
+ private set;
+ }
+
+ public Thread Thread => _loopThread;
+
+ public TimerExecuter(Action completed)
+ {
+ _completed = completed;
+ }
+
+ public void Run(TimerInfo info)
+ {
+ if (!_isworking)
+ {
+ throw new Exception("status error");
+ }
+ if (IsRuning)
+ {
+ throw new Exception("status error");
+ }
+ _timerInfo = info;
+ _timerInfo.TimerThread = this;
+ if (!_DEBUG)
+ {
+ _semaphore.Release(1);
+ }
+ }
+
+ public void ReRun(TimerInfo info)
+ {
+ if (!_isworking)
+ {
+ throw new Exception("status error");
+ }
+ if (IsRuning)
+ {
+ throw new Exception("status error");
+ }
+ _rerun = true;
+ _timerInfo = info;
+ _timerInfo.TimerThread = this;
+ }
+
+ public void Start()
+ {
+ if (!_isworking)
+ {
+ _isworking = true;
+ _loopThread = ThreadCall(Loop);
+ }
+ }
+
+ public void Stop()
+ {
+ if (_isworking)
+ {
+ _isworking = false;
+ ThreadStop(_loopThread);
+ }
+ }
+
+ public void Reset()
+ {
+ if (_isworking)
+ {
+ _loopThread.Abort();
+ _loopThread.Join(10);
+ _semaphore.Close();
+ _semaphore = new Semaphore(0, 1);
+ if (_timerInfo != null && _timerInfo.TimerThread != null)
+ {
+ _timerInfo.TimerThread = null;
+ }
+ _timerInfo = null;
+ IsRuning = false;
+ _loopThread = ThreadCall(Loop);
+ ThreadReset(this);
+ }
+ }
+
+ private void Loop()
+ {
+ Loop(null);
+ }
+
+ private void Loop(object obj)
+ {
+ while (_isworking)
+ {
+ if (_DEBUG)
+ {
+ if (_timerInfo == null)
+ {
+ Thread.Sleep(5);
+ continue;
+ }
+ }
+ else if (!_rerun)
+ {
+ _semaphore.WaitOne();
+ }
+ _rerun = false;
+ IsRuning = true;
+ Call();
+ IsRuning = false;
+ OnCompleted();
+ CompleteTime = TickCount;
+ }
+ }
+
+ private void Call()
+ {
+ TimerInfo timerInfo = _timerInfo;
+ object syncObject = default(object);
+ try
+ {
+ bool lockTaken = false;
+ try
+ {
+ Monitor.Enter(syncObject = timerInfo.SyncObject, ref lockTaken);
+ timerInfo.IsRuning = true;
+ timerInfo.IsReady = false;
+ }
+ finally
+ {
+ if (lockTaken)
+ {
+ Monitor.Exit(syncObject);
+ }
+ }
+ timerInfo.LastBeginTime = TickCount;
+ timerInfo.Callback();
+ timerInfo.LastEndTime = TickCount;
+ _timerInfo = null;
+ }
+ catch (Exception ex)
+ {
+ if (!(timerInfo?.IsFree ?? true))
+ {
+ timerInfo.IsError = true;
+ timerInfo.Error = ex;
+ timerInfo.LastEndTime = TickCount;
+ OnError(ex);
+ }
+ _timerInfo = null;
+ }
+ finally
+ {
+ if (!(timerInfo?.IsFree ?? true))
+ {
+ bool lockTaken2 = false;
+ try
+ {
+ Monitor.Enter(syncObject = timerInfo.SyncObject, ref lockTaken2);
+ timerInfo.IsRuning = false;
+ timerInfo.TimerThread = null;
+ }
+ finally
+ {
+ if (lockTaken2)
+ {
+ Monitor.Exit(syncObject);
+ }
+ }
+ }
+ }
+ }
+
+ private void OnCompleted()
+ {
+ _completed(this);
+ }
+
+ private void OnError(Exception e)
+ {
+ if (_timerInfo.ErrorHandle != null)
+ {
+ _timerInfo.ErrorHandle.BeginInvoke(e, null, null);
+ }
+ FreeTimer(_timerInfo.Key);
+ }
+ }
+
+ private class TimerInfo
+ {
+ public Guid Key;
+
+ public long LastBeginTime;
+
+ public long LastEndTime;
+
+ public string Name;
+
+ public Action Callback;
+
+ public int Interval;
+
+ public bool IsReady;
+
+ public bool IsRuning;
+
+ public bool IsError;
+
+ public bool IsFree;
+
+ public Exception Error;
+
+ public Action ErrorHandle;
+
+ public object SyncObject = new object();
+
+ public TimerExecuter TimerThread;
+ }
+
+ private static bool _DEBUG = false;
+
+ private static int _maxThread = 400;
+
+ private static bool _runing = false;
+
+ private static Dictionary _dicTimers = new Dictionary();
+
+ private static AQueue _queueTimers = new AQueue();
+
+ private static AQueue _queueIdleThreads = new AQueue();
+
+ private static AQueue _queueCompleteThreads = new AQueue();
+
+ private static List _timerThreads = new List();
+
+ private static long _lastSystemTick = 0L;
+
+ private static long _TickStart = 0L;
+
+ private static long _TickCount = 0L;
+
+ public static long TickCount
+ {
+ get
+ {
+ if (_TickCount == 0)
+ {
+ _TickCount = DateTime.Now.Ticks / 10000;
+ }
+ if (_lastSystemTick == Environment.TickCount)
+ {
+ return _TickCount;
+ }
+ _lastSystemTick = Environment.TickCount;
+ _TickCount = DateTime.Now.Ticks / 10000 - _TickStart;
+ return _TickCount;
+ }
+ }
+
+ public static Thread Call(Action action, string name)
+ {
+ Thread thread = new Thread(action.Invoke);
+ if (name != null)
+ {
+ thread.Name = name;
+ }
+ thread.Start();
+ return thread;
+ }
+
+ public static Thread ThreadCall(Action action)
+ {
+ return ThreadCall(action, null);
+ }
+
+ public static Thread ThreadCall(Action action, string name)
+ {
+ return Call(action, name);
+ }
+
+ public static Loop LoopCall(int interval, Action callback, Action error)
+ {
+ Loop loop = new Loop(interval, callback, error);
+ loop.Start();
+ return loop;
+ }
+
+ public static void PoolCall(Action