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 | 24 +++++++++++++++++++-----
1 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/Crabtree/SmartHome/HDL/Operation/Device/Scene.cs b/Crabtree/SmartHome/HDL/Operation/Device/Scene.cs
index d1ef92d..e4ff071 100644
--- a/Crabtree/SmartHome/HDL/Operation/Device/Scene.cs
+++ b/Crabtree/SmartHome/HDL/Operation/Device/Scene.cs
@@ -9,16 +9,16 @@
/// <summary>
/// 鍦烘櫙
/// </summary>
-[System.Serializable]
+ [System.Serializable]
public class Scene : Common
{
public readonly static string GlobalSceneFilePath = "GlobalScene";
static Scene ()
{
- Refresh ();
+ Refresh ();
}
- public static void Refresh()
+ public static void Refresh ()
{
if (null == Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>> (Encoding.UTF8.GetString (IO.FileUtils.ReadFile (GlobalSceneFilePath)))) {
//鍒濆鍖栨埧闂村垪琛�
@@ -30,10 +30,15 @@
{
this.Type = DeviceType.Scene;
DeviceTextID = SimpleControl.R.MyInternationalizationString.Scenes;
+
}
-
+
+ /// <summary>
+ /// 鍦烘櫙鍞竴ID
+ /// </summary>
+ public string Sid = "";
/// <summary>
/// 鍦烘櫙灏忓浘鏍�
@@ -44,6 +49,11 @@
/// 鍦烘櫙鐨勮儗鏅浘
/// </summary>
public string BackgroundImagePath = "Scene/s1.png";
+
+ /// <summary>
+ /// 鍦烘櫙淇濆瓨璺緞
+ /// </summary>
+ public string SceneFilePath = "";
/// <summary>
/// 鏍规嵁鍦烘櫙璺緞鎭㈠鍦烘櫙瀵硅薄
@@ -75,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)));
}
@@ -98,6 +112,6 @@
//var ssfsdf = IO.FileUtils.ReadFile ("GlobalScene_busScene");
//var cp = CommonPage.MyEncodingUTF8.GetString (ssfsdf);
}
-
+
}
}
\ No newline at end of file
--
Gitblit v1.8.0