From 50b7b7a486f56fab27c83b59eb45673c6d9f0935 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期三, 24 二月 2021 18:33:57 +0800 Subject: [PATCH] 2021-02-24 1.新增场景上传。2.优化 --- Crabtree/SmartHome/HDL/Operation/Device/Scene.cs | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Crabtree/SmartHome/HDL/Operation/Device/Scene.cs b/Crabtree/SmartHome/HDL/Operation/Device/Scene.cs index 9eecb3a..e4ff071 100644 --- a/Crabtree/SmartHome/HDL/Operation/Device/Scene.cs +++ b/Crabtree/SmartHome/HDL/Operation/Device/Scene.cs @@ -31,9 +31,6 @@ this.Type = DeviceType.Scene; DeviceTextID = SimpleControl.R.MyInternationalizationString.Scenes; - if (string.IsNullOrEmpty (SceneID)) { - SceneID = Guid.NewGuid ().ToString (); - } } @@ -41,7 +38,7 @@ /// <summary> /// 鍦烘櫙鍞竴ID /// </summary> - public string SceneID = ""; + public string Sid = ""; /// <summary> /// 鍦烘櫙灏忓浘鏍� @@ -52,6 +49,11 @@ /// 鍦烘櫙鐨勮儗鏅浘 /// </summary> public string BackgroundImagePath = "Scene/s1.png"; + + /// <summary> + /// 鍦烘櫙淇濆瓨璺緞 + /// </summary> + public string SceneFilePath = ""; /// <summary> /// 鏍规嵁鍦烘櫙璺緞鎭㈠鍦烘櫙瀵硅薄 @@ -83,6 +85,10 @@ /// <param name="sceneFilePath">Scence file path.</param> public void Save (string sceneFilePath) { + if(string.IsNullOrEmpty(this.SceneFilePath) || this.SceneFilePath != sceneFilePath) { + this.SceneFilePath = sceneFilePath; + } + IO.FileUtils.WriteFileByBytes (sceneFilePath, System.Text.Encoding.UTF8.GetBytes (Newtonsoft.Json.JsonConvert.SerializeObject (this))); } -- Gitblit v1.8.0