| | |
| | | using HDL_ON.UI; |
| | | using HDL_ON.DAL.Net; |
| | | using HDL_ON.DAL; |
| | | using HDL_ON.Entity; |
| | | |
| | | namespace HDL_ON.MyIO |
| | | { |
| | |
| | | { |
| | | continue; |
| | | } |
| | | System.IO.FileInfo fileInfo = new System.IO.FileInfo(regionRootPath + NextFile.Name); |
| | | FileInfo fileInfo = new FileInfo(regionRootPath + NextFile.Name); |
| | | if (fileInfo.Exists) |
| | | { |
| | | fileInfo.MoveTo(Application.RootPath + NextFile.Name); |
| | |
| | | /// 所以Common.GetType()获取不到真实的设备类型 |
| | | /// 所以这里要手动传入设备的类型 |
| | | /// </param> |
| | | public static string ReadEquipmentMessage(Common common) |
| | | public static void ReadFunctionMessage(Function common) |
| | | { |
| | | string fileName = "Equipment_"; |
| | | if (common.Type.ToString() == "WirelessPanel") |
| | | { |
| | | fileName += DeviceType.ButtonPanel.ToString() + "_" + common.SubnetID.ToString() + "_" + common.DeviceID.ToString(); |
| | | } |
| | | else |
| | | { |
| | | fileName += common.Type + "_" + common.SubnetID.ToString() + "_" + common.DeviceID.ToString(); |
| | | } |
| | | byte[] bytes1 = ReadFile(fileName); |
| | | string one = System.Text.Encoding.UTF8.GetString(bytes1); |
| | | return one; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Saves the equipment message. |
| | | /// </summary> |
| | | public static void SaveEquipmentMessage(Common common, string loopID = "") |
| | | public static void SaveFunctionMessage(Function common ) |
| | | { |
| | | string deviceType = common.Type.ToString(); |
| | | if (common.Type == DeviceType.LightSwitchSocket) |
| | | deviceType = DeviceType.LightSwitch.ToString(); |
| | | string fileName = "Equipment_" + deviceType + "_" + common.SubnetID + "_" + common.DeviceID; |
| | | if (loopID != "") |
| | | { |
| | | fileName += "_" + (loopID.Length < 2 ? "0" + loopID : loopID); |
| | | } |
| | | common.SavePath = fileName; |
| | | MainPage.Log(fileName); |
| | | WriteFileByBytes(fileName, CommonPage.MyEncodingUTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(common))); |
| | | |
| | | } |
| | | |
| | | /// <summary> |