| | |
| | | MainPage.Log($"Save Scene Data : {savePath}"); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 修改场景 |
| | | /// </summary> |
| | | public string UpdateScene() |
| | | { |
| | | var pm = new HttpServerRequest(); |
| | | var revPack = pm.EditScene(this); |
| | | if (revPack.Code == StateCode.SUCCESS) |
| | | { |
| | | var scenes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(revPack.Data.ToString()); |
| | | var tempScene = scenes.Find((obj) => obj.sid == sid); |
| | | if (tempScene != null) |
| | | { |
| | | var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(tempScene)); |
| | | Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); |
| | | } |
| | | } |
| | | return revPack.Code; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加场景 |
| | | /// </summary> |
| | | public void AddScene() |
| | | public string AddScene() |
| | | { |
| | | var pm = new HttpServerRequest(); |
| | | var revPack = pm.AddScene(this); |
| | |
| | | var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); |
| | | Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); |
| | | } |
| | | return revPack.Code; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// 本地对应的功能 |
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public Function localFunction { |
| | | public Function localFunction |
| | | { |
| | | get |
| | | { |
| | | if(_localFunction == null) |
| | | if (_localFunction == null) |
| | | { |
| | | _localFunction = ConvertFunctionObject(); |
| | | } |
| | |
| | | Function ConvertFunctionObject() |
| | | { |
| | | var localFunction = FunctionList.List.GetDeviceFunctionList().Find((obj) => obj.sid == sid); |
| | | foreach (var s in status) |
| | | { |
| | | localFunction.attributes.Add(new FunctionAttributes() { key = s.key, curValue = s.value, value = new List<string>() { s.value } }); |
| | | } |
| | | return localFunction; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |