wxr
2020-01-10 1a4b95a7ebef71838bd3eda2c22056bbf0db65ec
HDL_ON/DAL/FileUtils.cs
@@ -7,6 +7,7 @@
using HDL_ON.UI;
using HDL_ON.DAL.Net;
using HDL_ON.DAL;
using HDL_ON.Entity;
namespace HDL_ON.MyIO
{
@@ -78,7 +79,7 @@
                {
                    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);
@@ -237,38 +238,16 @@
        /// 所以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>