张泳健 8 years ago
parent
commit
5e052e69bb

BIN
.vs/GWSocketClient/v15/.suo View File


+ 13 - 0
GWSocketClient/Form1.Designer.cs View File

@@ -62,6 +62,7 @@
62 62
             this.cmslistboxRightMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
63 63
             this.rightMenuCopyCmd = new System.Windows.Forms.ToolStripMenuItem();
64 64
             this.rightMenuClearInfo = new System.Windows.Forms.ToolStripMenuItem();
65
+            this.button1 = new System.Windows.Forms.Button();
65 66
             this.groupBox1.SuspendLayout();
66 67
             this.menuStrip1.SuspendLayout();
67 68
             this.statusStrip1.SuspendLayout();
@@ -73,6 +74,7 @@
73 74
             // 
74 75
             this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
75 76
             | System.Windows.Forms.AnchorStyles.Right)));
77
+            this.groupBox1.Controls.Add(this.button1);
76 78
             this.groupBox1.Controls.Add(this.label7);
77 79
             this.groupBox1.Controls.Add(this.tfTmpResponse);
78 80
             this.groupBox1.Controls.Add(this.label6);
@@ -399,6 +401,16 @@
399 401
             this.rightMenuClearInfo.Text = "清空信息(&L)";
400 402
             this.rightMenuClearInfo.Click += new System.EventHandler(this.rightMenuClearInfo_Click);
401 403
             // 
404
+            // button1
405
+            // 
406
+            this.button1.Location = new System.Drawing.Point(586, 71);
407
+            this.button1.Name = "button1";
408
+            this.button1.Size = new System.Drawing.Size(75, 23);
409
+            this.button1.TabIndex = 17;
410
+            this.button1.Text = "button1";
411
+            this.button1.UseVisualStyleBackColor = true;
412
+            this.button1.Click += new System.EventHandler(this.button1_Click);
413
+            // 
402 414
             // Form1
403 415
             // 
404 416
             this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
@@ -462,6 +474,7 @@
462 474
         private System.Windows.Forms.TextBox tfTmpResponse;
463 475
         private System.Windows.Forms.Label label6;
464 476
         private System.Windows.Forms.ToolStripMenuItem rightMenuClearInfo;
477
+        private System.Windows.Forms.Button button1;
465 478
     }
466 479
 }
467 480
 

+ 25 - 0
GWSocketClient/Form1.cs View File

@@ -2,15 +2,21 @@
2 2
 using System.Collections.Generic;
3 3
 using System.ComponentModel;
4 4
 using System.Data;
5
+using System.Data.OleDb;
5 6
 using System.Drawing;
7
+using System.IO;
6 8
 using System.Linq;
9
+using System.Runtime.Serialization.Json;
7 10
 using System.Text;
8 11
 using System.Text.RegularExpressions;
9 12
 using System.Threading;
10 13
 using System.Threading.Tasks;
11 14
 using System.Windows.Forms;
15
+using GWSocketClient.model;
12 16
 using GWSocketClient.util;
13 17
 using GWSocketClient.xml;
18
+using Newtonsoft.Json;
19
+using Newtonsoft.Json.Linq;
14 20
 using XuanJiSocket;
15 21
 
16 22
 
@@ -354,5 +360,24 @@ namespace GWSocketClient
354 360
                 }
355 361
             }
356 362
         }
363
+
364
+        private void button1_Click(object sender, EventArgs e)
365
+        {
366
+//            var persons = JsonConvert.DeserializeObject<List<WvBean>>(json);
367
+//            var ja = JArray.Parse(jsonString);
368
+
369
+            /*WvBean wb = new WvBean();
370
+            wb.id = "0502";
371
+            wb.idInfo = "alkflkaslkjfjsalfjlf";
372
+            wb.len = "-1";
373
+            wb.mode = "R/W";
374
+            wb.desp = "DESPPPPPPP";
375
+            wb.remark = "alkskjlajslkf------------------------------";*/
376
+
377
+            //            Console.WriteLine(wb.ToString());
378
+
379
+            //            WebViewForm wf = new WebViewForm();
380
+            //            wf.ShowDialog();
381
+        }
357 382
     }
358 383
 }

+ 25 - 1
GWSocketClient/GWSocketClient.csproj View File

@@ -5,7 +5,7 @@
5 5
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6 6
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7 7
     <ProjectGuid>{1E7C256A-9CA5-4937-A5DD-7F281A2EBB21}</ProjectGuid>
8
-    <OutputType>WinExe</OutputType>
8
+    <OutputType>Exe</OutputType>
9 9
     <RootNamespace>GWSocketClient</RootNamespace>
10 10
     <AssemblyName>GWSocketClient</AssemblyName>
11 11
     <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
@@ -38,8 +38,12 @@
38 38
     <ApplicationIcon>GWSocket.ico</ApplicationIcon>
39 39
   </PropertyGroup>
40 40
   <ItemGroup>
41
+    <Reference Include="Newtonsoft.Json">
42
+      <HintPath>dlls\Newtonsoft.Json.dll</HintPath>
43
+    </Reference>
41 44
     <Reference Include="System" />
42 45
     <Reference Include="System.Core" />
46
+    <Reference Include="System.Runtime.Serialization" />
43 47
     <Reference Include="System.Xml.Linq" />
44 48
     <Reference Include="System.Data.DataSetExtensions" />
45 49
     <Reference Include="Microsoft.CSharp" />
@@ -60,12 +64,26 @@
60 64
     <Compile Include="Form1.Designer.cs">
61 65
       <DependentUpon>Form1.cs</DependentUpon>
62 66
     </Compile>
67
+    <Compile Include="model\WvBean.cs" />
68
+    <Compile Include="MyMessageBox.cs">
69
+      <SubType>Form</SubType>
70
+    </Compile>
71
+    <Compile Include="MyMessageBox.Designer.cs">
72
+      <DependentUpon>MyMessageBox.cs</DependentUpon>
73
+    </Compile>
63 74
     <Compile Include="Program.cs" />
64 75
     <Compile Include="Properties\AssemblyInfo.cs" />
65 76
     <Compile Include="property\PropertiesLoader.cs" />
66 77
     <Compile Include="util\CheckUtil.cs" />
67 78
     <Compile Include="util\HexUtil.cs" />
79
+    <Compile Include="util\JsonHelper.cs" />
68 80
     <Compile Include="util\Utils.cs" />
81
+    <Compile Include="WebViewForm.cs">
82
+      <SubType>Form</SubType>
83
+    </Compile>
84
+    <Compile Include="WebViewForm.Designer.cs">
85
+      <DependentUpon>WebViewForm.cs</DependentUpon>
86
+    </Compile>
69 87
     <Compile Include="xml\AFN.cs" />
70 88
     <Compile Include="xml\dataItem\DataElementType.cs" />
71 89
     <Compile Include="xml\dataItem\DataType.cs" />
@@ -77,6 +95,9 @@
77 95
     <EmbeddedResource Include="Form1.resx">
78 96
       <DependentUpon>Form1.cs</DependentUpon>
79 97
     </EmbeddedResource>
98
+    <EmbeddedResource Include="MyMessageBox.resx">
99
+      <DependentUpon>MyMessageBox.cs</DependentUpon>
100
+    </EmbeddedResource>
80 101
     <EmbeddedResource Include="Properties\Resources.resx">
81 102
       <Generator>ResXFileCodeGenerator</Generator>
82 103
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
@@ -86,6 +107,9 @@
86 107
       <AutoGen>True</AutoGen>
87 108
       <DependentUpon>Resources.resx</DependentUpon>
88 109
     </Compile>
110
+    <EmbeddedResource Include="WebViewForm.resx">
111
+      <DependentUpon>WebViewForm.cs</DependentUpon>
112
+    </EmbeddedResource>
89 113
     <None Include="Properties\Settings.settings">
90 114
       <Generator>SettingsSingleFileGenerator</Generator>
91 115
       <LastGenOutput>Settings.Designer.cs</LastGenOutput>

+ 111 - 0
GWSocketClient/MyMessageBox.Designer.cs View File

@@ -0,0 +1,111 @@
1
+namespace GWSocketClient
2
+{
3
+    partial class MyMessageBox
4
+    {
5
+        /// <summary>
6
+        /// Required designer variable.
7
+        /// </summary>
8
+        private System.ComponentModel.IContainer components = null;
9
+
10
+        /// <summary>
11
+        /// Clean up any resources being used.
12
+        /// </summary>
13
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
14
+        protected override void Dispose(bool disposing)
15
+        {
16
+            if (disposing && (components != null))
17
+            {
18
+                components.Dispose();
19
+            }
20
+            base.Dispose(disposing);
21
+        }
22
+
23
+        #region Windows Form Designer generated code
24
+
25
+        /// <summary>
26
+        /// Required method for Designer support - do not modify
27
+        /// the contents of this method with the code editor.
28
+        /// </summary>
29
+        private void InitializeComponent()
30
+        {
31
+            this.buttonOK = new System.Windows.Forms.Button();
32
+            this.buttonCancle = new System.Windows.Forms.Button();
33
+            this.richTextBox1 = new System.Windows.Forms.RichTextBox();
34
+            this.buttonClipboard = new System.Windows.Forms.Button();
35
+            this.SuspendLayout();
36
+            // 
37
+            // buttonOK
38
+            // 
39
+            this.buttonOK.Location = new System.Drawing.Point(205, 178);
40
+            this.buttonOK.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
41
+            this.buttonOK.Name = "buttonOK";
42
+            this.buttonOK.Size = new System.Drawing.Size(100, 36);
43
+            this.buttonOK.TabIndex = 0;
44
+            this.buttonOK.Text = "确定";
45
+            this.buttonOK.UseVisualStyleBackColor = true;
46
+            this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
47
+            // 
48
+            // buttonCancle
49
+            // 
50
+            this.buttonCancle.DialogResult = System.Windows.Forms.DialogResult.Cancel;
51
+            this.buttonCancle.Location = new System.Drawing.Point(313, 178);
52
+            this.buttonCancle.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
53
+            this.buttonCancle.Name = "buttonCancle";
54
+            this.buttonCancle.Size = new System.Drawing.Size(100, 36);
55
+            this.buttonCancle.TabIndex = 1;
56
+            this.buttonCancle.Text = "取消";
57
+            this.buttonCancle.UseVisualStyleBackColor = true;
58
+            this.buttonCancle.Click += new System.EventHandler(this.buttonCancle_Click);
59
+            // 
60
+            // richTextBox1
61
+            // 
62
+            this.richTextBox1.Location = new System.Drawing.Point(12, 12);
63
+            this.richTextBox1.Name = "richTextBox1";
64
+            this.richTextBox1.Size = new System.Drawing.Size(401, 158);
65
+            this.richTextBox1.TabIndex = 2;
66
+            this.richTextBox1.Text = "请确定已经安装:http://download.microsoft.com/download/7/0/3/703ffbcb-dc0c-4e19-b0da-1463" +
67
+    "960fdcdb/AccessDatabaseEngine.exe";
68
+            // 
69
+            // buttonClipboard
70
+            // 
71
+            this.buttonClipboard.Location = new System.Drawing.Point(97, 178);
72
+            this.buttonClipboard.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
73
+            this.buttonClipboard.Name = "buttonClipboard";
74
+            this.buttonClipboard.Size = new System.Drawing.Size(100, 36);
75
+            this.buttonClipboard.TabIndex = 3;
76
+            this.buttonClipboard.Text = "复制到剪贴板";
77
+            this.buttonClipboard.UseVisualStyleBackColor = true;
78
+            this.buttonClipboard.Click += new System.EventHandler(this.buttonClipboard_Click);
79
+            // 
80
+            // MyMessageBox
81
+            // 
82
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 19F);
83
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
84
+            this.CancelButton = this.buttonCancle;
85
+            this.ClientSize = new System.Drawing.Size(426, 228);
86
+            this.Controls.Add(this.buttonClipboard);
87
+            this.Controls.Add(this.richTextBox1);
88
+            this.Controls.Add(this.buttonCancle);
89
+            this.Controls.Add(this.buttonOK);
90
+            this.Font = new System.Drawing.Font("微软雅黑", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
91
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
92
+            this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
93
+            this.MaximizeBox = false;
94
+            this.MinimizeBox = false;
95
+            this.Name = "MyMessageBox";
96
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
97
+            this.Text = "提示";
98
+            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MyMessageBox_FormClosing);
99
+            this.Load += new System.EventHandler(this.MyMessageBox_Load);
100
+            this.ResumeLayout(false);
101
+
102
+        }
103
+
104
+        #endregion
105
+
106
+        private System.Windows.Forms.Button buttonOK;
107
+        private System.Windows.Forms.Button buttonCancle;
108
+        private System.Windows.Forms.RichTextBox richTextBox1;
109
+        private System.Windows.Forms.Button buttonClipboard;
110
+    }
111
+}

+ 57 - 0
GWSocketClient/MyMessageBox.cs View File

@@ -0,0 +1,57 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.ComponentModel;
4
+using System.Data;
5
+using System.Drawing;
6
+using System.Linq;
7
+using System.Runtime.CompilerServices;
8
+using System.Text;
9
+using System.Threading.Tasks;
10
+using System.Windows.Forms;
11
+
12
+namespace GWSocketClient
13
+{
14
+    public partial class MyMessageBox : Form
15
+    {
16
+        private string msg;
17
+
18
+        public static void ShowMessageBox(string msg = "")
19
+        {
20
+            new MyMessageBox(msg).ShowDialog();
21
+        }
22
+
23
+
24
+        public MyMessageBox(string msg)
25
+        {
26
+            InitializeComponent();
27
+            this.msg = msg;
28
+        }
29
+
30
+        private void MyMessageBox_FormClosing(object sender, FormClosingEventArgs e)
31
+        {
32
+        }
33
+
34
+        private void buttonClipboard_Click(object sender, EventArgs e)
35
+        {
36
+            Clipboard.SetText(
37
+                "http://download.microsoft.com/download/7/0/3/703ffbcb-dc0c-4e19-b0da-1463960fdcdb/AccessDatabaseEngine.exe \n" +
38
+                msg);
39
+            this.Close();
40
+        }
41
+
42
+
43
+        private void buttonOK_Click(object sender, EventArgs e)
44
+        {
45
+            this.Close();
46
+        }
47
+
48
+        private void buttonCancle_Click(object sender, EventArgs e)
49
+        {
50
+            this.Close();
51
+        }
52
+
53
+        private void MyMessageBox_Load(object sender, EventArgs e)
54
+        {
55
+        }
56
+    }
57
+}

+ 120 - 0
GWSocketClient/MyMessageBox.resx View File

@@ -0,0 +1,120 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<root>
3
+  <!-- 
4
+    Microsoft ResX Schema 
5
+    
6
+    Version 2.0
7
+    
8
+    The primary goals of this format is to allow a simple XML format 
9
+    that is mostly human readable. The generation and parsing of the 
10
+    various data types are done through the TypeConverter classes 
11
+    associated with the data types.
12
+    
13
+    Example:
14
+    
15
+    ... ado.net/XML headers & schema ...
16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
+    <resheader name="version">2.0</resheader>
18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
+    </data>
25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
+        <comment>This is a comment</comment>
28
+    </data>
29
+                
30
+    There are any number of "resheader" rows that contain simple 
31
+    name/value pairs.
32
+    
33
+    Each data row contains a name, and value. The row also contains a 
34
+    type or mimetype. Type corresponds to a .NET class that support 
35
+    text/value conversion through the TypeConverter architecture. 
36
+    Classes that don't support this are serialized and stored with the 
37
+    mimetype set.
38
+    
39
+    The mimetype is used for serialized objects, and tells the 
40
+    ResXResourceReader how to depersist the object. This is currently not 
41
+    extensible. For a given mimetype the value must be set accordingly:
42
+    
43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
+    that the ResXResourceWriter will generate, however the reader can 
45
+    read any of the formats listed below.
46
+    
47
+    mimetype: application/x-microsoft.net.object.binary.base64
48
+    value   : The object must be serialized with 
49
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
+            : and then encoded with base64 encoding.
51
+    
52
+    mimetype: application/x-microsoft.net.object.soap.base64
53
+    value   : The object must be serialized with 
54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
+            : and then encoded with base64 encoding.
56
+
57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
58
+    value   : The object must be serialized into a byte array 
59
+            : using a System.ComponentModel.TypeConverter
60
+            : and then encoded with base64 encoding.
61
+    -->
62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
+    <xsd:element name="root" msdata:IsDataSet="true">
65
+      <xsd:complexType>
66
+        <xsd:choice maxOccurs="unbounded">
67
+          <xsd:element name="metadata">
68
+            <xsd:complexType>
69
+              <xsd:sequence>
70
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
71
+              </xsd:sequence>
72
+              <xsd:attribute name="name" use="required" type="xsd:string" />
73
+              <xsd:attribute name="type" type="xsd:string" />
74
+              <xsd:attribute name="mimetype" type="xsd:string" />
75
+              <xsd:attribute ref="xml:space" />
76
+            </xsd:complexType>
77
+          </xsd:element>
78
+          <xsd:element name="assembly">
79
+            <xsd:complexType>
80
+              <xsd:attribute name="alias" type="xsd:string" />
81
+              <xsd:attribute name="name" type="xsd:string" />
82
+            </xsd:complexType>
83
+          </xsd:element>
84
+          <xsd:element name="data">
85
+            <xsd:complexType>
86
+              <xsd:sequence>
87
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
+              </xsd:sequence>
90
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
+              <xsd:attribute ref="xml:space" />
94
+            </xsd:complexType>
95
+          </xsd:element>
96
+          <xsd:element name="resheader">
97
+            <xsd:complexType>
98
+              <xsd:sequence>
99
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
+              </xsd:sequence>
101
+              <xsd:attribute name="name" type="xsd:string" use="required" />
102
+            </xsd:complexType>
103
+          </xsd:element>
104
+        </xsd:choice>
105
+      </xsd:complexType>
106
+    </xsd:element>
107
+  </xsd:schema>
108
+  <resheader name="resmimetype">
109
+    <value>text/microsoft-resx</value>
110
+  </resheader>
111
+  <resheader name="version">
112
+    <value>2.0</value>
113
+  </resheader>
114
+  <resheader name="reader">
115
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
+  </resheader>
117
+  <resheader name="writer">
118
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
+  </resheader>
120
+</root>

+ 61 - 0
GWSocketClient/WebViewForm.Designer.cs View File

@@ -0,0 +1,61 @@
1
+namespace GWSocketClient
2
+{
3
+    partial class WebViewForm
4
+    {
5
+        /// <summary>
6
+        /// Required designer variable.
7
+        /// </summary>
8
+        private System.ComponentModel.IContainer components = null;
9
+
10
+        /// <summary>
11
+        /// Clean up any resources being used.
12
+        /// </summary>
13
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
14
+        protected override void Dispose(bool disposing)
15
+        {
16
+            if (disposing && (components != null))
17
+            {
18
+                components.Dispose();
19
+            }
20
+            base.Dispose(disposing);
21
+        }
22
+
23
+        #region Windows Form Designer generated code
24
+
25
+        /// <summary>
26
+        /// Required method for Designer support - do not modify
27
+        /// the contents of this method with the code editor.
28
+        /// </summary>
29
+        private void InitializeComponent()
30
+        {
31
+            this.webBrowser1 = new System.Windows.Forms.WebBrowser();
32
+            this.SuspendLayout();
33
+            // 
34
+            // webBrowser1
35
+            // 
36
+            this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Fill;
37
+            this.webBrowser1.Location = new System.Drawing.Point(0, 0);
38
+            this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
39
+            this.webBrowser1.Name = "webBrowser1";
40
+            this.webBrowser1.Size = new System.Drawing.Size(1018, 649);
41
+            this.webBrowser1.TabIndex = 0;
42
+            this.webBrowser1.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.webBrowser1_DocumentCompleted);
43
+            // 
44
+            // WebViewForm
45
+            // 
46
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
47
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
48
+            this.ClientSize = new System.Drawing.Size(1018, 649);
49
+            this.Controls.Add(this.webBrowser1);
50
+            this.Name = "WebViewForm";
51
+            this.Text = "WebViewForm";
52
+            this.Load += new System.EventHandler(this.WebViewForm_Load);
53
+            this.ResumeLayout(false);
54
+
55
+        }
56
+
57
+        #endregion
58
+
59
+        private System.Windows.Forms.WebBrowser webBrowser1;
60
+    }
61
+}

+ 37 - 0
GWSocketClient/WebViewForm.cs View File

@@ -0,0 +1,37 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.ComponentModel;
4
+using System.Data;
5
+using System.Drawing;
6
+using System.Linq;
7
+using System.Text;
8
+using System.Threading.Tasks;
9
+using System.Windows.Forms;
10
+
11
+namespace GWSocketClient
12
+{
13
+    public partial class WebViewForm : Form
14
+    {
15
+        public WebViewForm()
16
+        {
17
+            InitializeComponent();
18
+        }
19
+
20
+        private void WebViewForm_Load(object sender, EventArgs e)
21
+        {
22
+            webBrowser1.Navigate(Application.StartupPath + @"\html\index.html");
23
+            webBrowser1.ScriptErrorsSuppressed = true;
24
+        }
25
+
26
+        private void readPropertiesJSONFile()
27
+        {
28
+            
29
+        }
30
+
31
+        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
32
+        {
33
+            //取数据.设备数据过去
34
+            webBrowser1.Document.GetElementById("all_data").SetAttribute("value", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
35
+        }
36
+    }
37
+}

+ 120 - 0
GWSocketClient/WebViewForm.resx View File

@@ -0,0 +1,120 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<root>
3
+  <!-- 
4
+    Microsoft ResX Schema 
5
+    
6
+    Version 2.0
7
+    
8
+    The primary goals of this format is to allow a simple XML format 
9
+    that is mostly human readable. The generation and parsing of the 
10
+    various data types are done through the TypeConverter classes 
11
+    associated with the data types.
12
+    
13
+    Example:
14
+    
15
+    ... ado.net/XML headers & schema ...
16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
+    <resheader name="version">2.0</resheader>
18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
+    </data>
25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
+        <comment>This is a comment</comment>
28
+    </data>
29
+                
30
+    There are any number of "resheader" rows that contain simple 
31
+    name/value pairs.
32
+    
33
+    Each data row contains a name, and value. The row also contains a 
34
+    type or mimetype. Type corresponds to a .NET class that support 
35
+    text/value conversion through the TypeConverter architecture. 
36
+    Classes that don't support this are serialized and stored with the 
37
+    mimetype set.
38
+    
39
+    The mimetype is used for serialized objects, and tells the 
40
+    ResXResourceReader how to depersist the object. This is currently not 
41
+    extensible. For a given mimetype the value must be set accordingly:
42
+    
43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
+    that the ResXResourceWriter will generate, however the reader can 
45
+    read any of the formats listed below.
46
+    
47
+    mimetype: application/x-microsoft.net.object.binary.base64
48
+    value   : The object must be serialized with 
49
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
+            : and then encoded with base64 encoding.
51
+    
52
+    mimetype: application/x-microsoft.net.object.soap.base64
53
+    value   : The object must be serialized with 
54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
+            : and then encoded with base64 encoding.
56
+
57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
58
+    value   : The object must be serialized into a byte array 
59
+            : using a System.ComponentModel.TypeConverter
60
+            : and then encoded with base64 encoding.
61
+    -->
62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
+    <xsd:element name="root" msdata:IsDataSet="true">
65
+      <xsd:complexType>
66
+        <xsd:choice maxOccurs="unbounded">
67
+          <xsd:element name="metadata">
68
+            <xsd:complexType>
69
+              <xsd:sequence>
70
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
71
+              </xsd:sequence>
72
+              <xsd:attribute name="name" use="required" type="xsd:string" />
73
+              <xsd:attribute name="type" type="xsd:string" />
74
+              <xsd:attribute name="mimetype" type="xsd:string" />
75
+              <xsd:attribute ref="xml:space" />
76
+            </xsd:complexType>
77
+          </xsd:element>
78
+          <xsd:element name="assembly">
79
+            <xsd:complexType>
80
+              <xsd:attribute name="alias" type="xsd:string" />
81
+              <xsd:attribute name="name" type="xsd:string" />
82
+            </xsd:complexType>
83
+          </xsd:element>
84
+          <xsd:element name="data">
85
+            <xsd:complexType>
86
+              <xsd:sequence>
87
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
+              </xsd:sequence>
90
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
+              <xsd:attribute ref="xml:space" />
94
+            </xsd:complexType>
95
+          </xsd:element>
96
+          <xsd:element name="resheader">
97
+            <xsd:complexType>
98
+              <xsd:sequence>
99
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
+              </xsd:sequence>
101
+              <xsd:attribute name="name" type="xsd:string" use="required" />
102
+            </xsd:complexType>
103
+          </xsd:element>
104
+        </xsd:choice>
105
+      </xsd:complexType>
106
+    </xsd:element>
107
+  </xsd:schema>
108
+  <resheader name="resmimetype">
109
+    <value>text/microsoft-resx</value>
110
+  </resheader>
111
+  <resheader name="version">
112
+    <value>2.0</value>
113
+  </resheader>
114
+  <resheader name="reader">
115
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
+  </resheader>
117
+  <resheader name="writer">
118
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
+  </resheader>
120
+</root>

+ 130 - 0
GWSocketClient/db/AccsessDbLoader.cs View File

@@ -0,0 +1,130 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Data.OleDb;
4
+using System.Linq;
5
+using System.Text;
6
+using System.Threading.Tasks;
7
+using System.Windows.Forms;
8
+using GWSocketClient.model;
9
+using Newtonsoft.Json;
10
+
11
+namespace GWSocketClient.db
12
+{
13
+    class AccsessDbLoader
14
+    {
15
+        private static AccsessDbLoader INSTANCE = null;
16
+
17
+        private static List<WvBean> wvBeans = new List<WvBean>();
18
+        public static Dictionary<string, string> ID_INFO = new Dictionary<string, string>();
19
+
20
+        public static AccsessDbLoader getInstance(string dbssPath = "")
21
+        {
22
+            return INSTANCE ?? (INSTANCE = new AccsessDbLoader(dbssPath));
23
+        }
24
+
25
+        public Dictionary<string, string> getUserIdInfo()
26
+        {
27
+            return ID_INFO;
28
+        }
29
+
30
+        public string getWebViewJson()
31
+        {
32
+            return JsonConvert.SerializeObject(wvBeans);
33
+        }
34
+
35
+        private AccsessDbLoader(string dbPath = "")
36
+        {
37
+            if (dbPath.Equals(""))
38
+            {
39
+                dbPath = Application.StartupPath + "/dbfile/ID_INFO.accdb;";
40
+            }
41
+            reloadAccessDb(dbPath);
42
+        }
43
+
44
+
45
+        public AccsessDbLoader reloadAccessDb(string dbPath)
46
+        {
47
+            OleDbConnection mycon = null;
48
+            OleDbDataReader myReader = null;
49
+
50
+            try
51
+            {
52
+                string strConnection = "Provider = Microsoft.ACE.OLEDB.12.0;";
53
+                strConnection += "Data Source = " + dbPath;
54
+                using (OleDbConnection objConnection = new OleDbConnection(strConnection)
55
+                ) //用using替代objConnection.Close()  
56
+                {
57
+                    objConnection.Open(); //打开连接   
58
+                    OleDbCommand sqlcmd = new OleDbCommand(@"select * from fw", objConnection); //sql语句     
59
+                    using (OleDbDataReader reader = sqlcmd.ExecuteReader()) //执行查询,用using替代reader.Close()  
60
+                    {
61
+                        if (reader.Read()) //这个read调用很重要!不写的话运行时将提示找不到数据  
62
+                        {
63
+                            WvBean wb = new WvBean();
64
+                            int id = 0;
65
+                            int index = 0;
66
+                            string myId = "";
67
+                            string idInfo = "";
68
+                            string len = "";
69
+                            string mode = "";
70
+                            string desp = "";
71
+                            string defalutValue = "";
72
+                            string userValue = "";
73
+                            string remark = "";
74
+                            try
75
+                            {
76
+                                id = reader.GetInt32(0);
77
+                                index = reader.GetInt32(1);
78
+                                myId = reader.GetString(2);
79
+                                idInfo = calcNull(reader.GetString(3));
80
+                                len = calcNull(reader.GetString(4));
81
+                                mode = calcNull(reader.GetString(5));
82
+                                desp = calcNull(reader.GetString(6));
83
+                                defalutValue = calcNull(reader.GetString(8));
84
+                                userValue = calcNull(reader.GetString(9));
85
+                                remark = calcNull(reader.GetString(7));
86
+                            }
87
+                            catch (Exception exception)
88
+                            {
89
+                            }
90
+
91
+                            wb.id = id;
92
+                            wb.index = index;
93
+                            wb.myId = myId;
94
+                            wb.idInfo = idInfo;
95
+                            wb.len = len;
96
+                            wb.mode = mode;
97
+                            wb.desp = desp;
98
+                            wb.defalutValue = defalutValue;
99
+                            wb.userValue = userValue;
100
+                            wb.remark = remark;
101
+
102
+                            ID_INFO.Add(myId, userValue);
103
+
104
+                            wvBeans.Add(wb);
105
+                        }
106
+                    }
107
+                }
108
+                return this;
109
+            }
110
+            catch (OleDbException oe)
111
+            {
112
+                MessageBox.Show(oe.Message);
113
+            }
114
+            catch (Exception exception)
115
+            {
116
+                MyMessageBox.ShowMessageBox(exception.Message);
117
+            }
118
+            return null;
119
+        }
120
+
121
+        private string calcNull(string ojb)
122
+        {
123
+            if (ojb.Trim().Equals("") || ojb == null)
124
+            {
125
+                return "";
126
+            }
127
+            return ojb;
128
+        }
129
+    }
130
+}

BIN
GWSocketClient/dlls/Newtonsoft.Json.dll View File


+ 37 - 0
GWSocketClient/model/WvBean.cs View File

@@ -0,0 +1,37 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace GWSocketClient.model
8
+{
9
+    class WvBean
10
+    {
11
+        public int id;
12
+        public int index;
13
+        public string myId = "";
14
+        public string idInfo = "";
15
+        public string len = "";
16
+        public string mode = "";
17
+        public string desp = "";
18
+        public string remark = "";
19
+        public string defalutValue = "";
20
+        public string userValue = "";
21
+
22
+        public override string ToString()
23
+        {
24
+            return "{\"myId\":\"" + myId + "\",\"idInfo\":\"" + idInfo + "\",\"len\":\"" + len + "\","
25
+                   + "\"mode\":\"" + mode + "\",\"desp\":\"" + desp + "\",\"remark\":\""
26
+                   + "\"}";
27
+        }
28
+    }
29
+
30
+    class WvBeanComparer : IComparer<WvBean>
31
+    {
32
+        public int Compare(WvBean x, WvBean y)
33
+        {
34
+            return x.index.CompareTo(y.index);
35
+        }
36
+    }
37
+}

+ 30 - 0
GWSocketClient/util/JsonHelper.cs View File

@@ -0,0 +1,30 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.IO;
4
+using System.Linq;
5
+using System.Runtime.Serialization.Json;
6
+using System.Text;
7
+using System.Threading.Tasks;
8
+
9
+namespace GWSocketClient.util
10
+{
11
+    class JsonHelper
12
+    {
13
+        public static T parse<T>(string jsonString)
14
+        {
15
+            using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(jsonString)))
16
+            {
17
+                return (T) new DataContractJsonSerializer(typeof(T)).ReadObject(ms);
18
+            }
19
+        }
20
+
21
+        public static string stringify(object jsonObject)
22
+        {
23
+            using (var ms = new MemoryStream())
24
+            {
25
+                new DataContractJsonSerializer(jsonObject.GetType()).WriteObject(ms, jsonObject);
26
+                return Encoding.UTF8.GetString(ms.ToArray());
27
+            }
28
+        }
29
+    }
30
+}