From b71dfb3ca100340005d56e1298292807da82322d Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 08 六月 2020 15:04:21 +0800
Subject: [PATCH] 20200608

---
 HDL_ON/DriverLayer/CommonPage.cs |   36 +++++++++++++++++++++++++++++++++---
 1 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/HDL_ON/DriverLayer/CommonPage.cs b/HDL_ON/DriverLayer/CommonPage.cs
index f684d0b..8f940e8 100644
--- a/HDL_ON/DriverLayer/CommonPage.cs
+++ b/HDL_ON/DriverLayer/CommonPage.cs
@@ -3,6 +3,8 @@
 using HDL_ON.DAL.Net;
 using HDL_ON.Entity;
 using HDL_ON.UI;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
 using Shared;
 using Shared.Net;
 
@@ -31,6 +33,16 @@
             }
         }
 
+
+        public static System.Net.IPEndPoint GetGatewayIP_EndPoint
+        {
+            get
+            {
+                //闃叉寮傚父瀵艰嚧绋嬪簭閫�鍑�
+                return new System.Net.IPEndPoint(System.Net.IPAddress.Parse("224.0.168.188"), 6688);
+            }
+        }
+
         ///淇濆瓨璁惧澶囨敞鎵嶇敤gb2312锛屽叾浠栨儏鍐电敤utf8
         public static Encoding MyEncodingUTF8 = Encoding.UTF8;//Get
         public static Encoding MyEncodingGB2312
@@ -55,7 +67,7 @@
                 }
             }
         }
-        static bool isHttpListenerStart;
+        public static bool isHttpListenerStart;
         public static DateTime dt;
 
         //public static byte currentSubnetID = 0;
@@ -65,6 +77,7 @@
             {
                 return;
             }
+            Console.WriteLine("Init Http Listener !");
             HttpListener.Start(new NetWiFi().IpAddress, 6002);
             HttpListener.EventHandler -= httpListener_EventHandler;
             HttpListener.EventHandler += httpListener_EventHandler;
@@ -98,6 +111,11 @@
         {
             try
             {
+                if(revGatewayIP == "172.16.2.237")
+                {
+
+                }
+
                 switch (command)
                 {
                     case Command.ReadLightSingleLoopBrightnessACK:
@@ -396,7 +414,7 @@
                     string tempFileName = nameValueCollection["Command"].Replace("Get", "");
                     if ("AllFiles" == tempFileName)
                     {
-                        byte[] bytes = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(FileUtils.ReadFiles()));
+                        byte[] bytes = Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(FileUtils.ReadFiles()));
                         outputStream.Write(bytes, 0, bytes.Length);
                         outputStream.Flush();
                     }
@@ -405,7 +423,7 @@
                         byte[] bytes;
                         if (!FileUtils.Exists(tempFileName))
                         {
-                            bytes = System.Text.Encoding.UTF8.GetBytes("鏂囦欢鍚嶄笉瀛樺湪锛�");
+                            bytes = Encoding.UTF8.GetBytes("鏂囦欢鍚嶄笉瀛樺湪锛�");
                             outputStream.Write(bytes, 0, bytes.Length);
                             outputStream.Flush();
                             return;
@@ -422,6 +440,18 @@
                 {
                     string path = Application.RootPath + nameValueCollection["Command"].Replace("Upload", "");
                     string dePath = nameValueCollection["Command"].Replace("Upload", "");
+                    FileUtils.WriteFileByInputStream(path, inputStream);
+                    var reString = CommonPage.MyEncodingUTF8.GetString(FileUtils.ReadFile(path));
+                    var common = JsonConvert.DeserializeObject<AProtocolEntity>(reString);
+                    //Console.WriteLine(common.ToString());
+                    if(dePath == "FunctionList")
+                    {
+                        foreach(var obj in common.objects)
+                        {
+                            DB_ResidenceData.residenceData.functionList.AddFunction(obj);
+                        }
+                        DB_ResidenceData.residenceData.functionList.GetAllFunction();
+                    }
                 }
                 else
                 {

--
Gitblit v1.8.0