.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,35 +1,60 @@ <Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default"> <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.6242be7109c740c6cb8999a8904b6e0ea8d45192" /> <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/DAL/FileUtils.cs"> <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/Common/ImageUtlis.cs"> <Files> <File FileName="HDL_ON/UI/MainPage.cs" Line="170" Column="26" /> <File FileName="HDL_ON/Common/FileUtlis.cs" Line="1" Column="1" /> <File FileName="HDL_ON/DAL/FileUtils.cs" Line="24" Column="25" /> <File FileName="HDL_ON/DAL/Mqtt/MqttInfoConfig.cs" Line="27" Column="51" /> <File FileName="HDL_ON/UI/MainPage.cs" Line="106" Column="40" /> <File FileName="HDL_ON/Entity/DB_ResidenceData.cs" Line="100" Column="1" /> <File FileName="HDL_ON/Entity/UserInfo.cs" Line="172" Column="9" /> <File FileName="HDL_ON/Entity/Room.cs" Line="505" Column="49" /> <File FileName="HDL_ON/Entity/Function/Scene.cs" Line="30" Column="81" /> <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs" Line="45" Column="14" /> <File FileName="HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs" Line="405" Column="10" /> <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/NewSceneMenuListPage.cs" Line="160" Column="126" /> <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs" Line="236" Column="26" /> <File FileName="HDL_ON/UI/UI1-Login/LoginPage.cs" Line="195" Column="50" /> <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" Line="317" Column="68" /> <File FileName="HDL_ON/Entity/FunctionList.cs" Line="607" Column="26" /> <File FileName="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs" Line="481" Column="10" /> <File FileName="HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListEditPage.cs" Line="25" Column="21" /> <File FileName="HDL_ON/Common/ImageUtlis.cs" Line="1" Column="1" /> </Files> <Pads> <Pad Id="ProjectPad"> <State name="__root__"> <Node name="HDL_APP_Project" expanded="True"> <Node name="HDL_ON" expanded="True"> <Node name="Common" expanded="True" /> <Node name="Common" expanded="True"> <Node name="ImageUtlis.cs" selected="True" /> </Node> <Node name="DAL" expanded="True"> <Node name="DriverLayer" expanded="True" /> <Node name="Mqtt" expanded="True" /> <Node name="Server" expanded="True" /> <Node name="FileUtils.cs" selected="True" /> </Node> <Node name="Entity" expanded="True" /> <Node name="Entity" expanded="True"> <Node name="Function" expanded="True" /> </Node> <Node name="UI" expanded="True"> <Node name="BindingResidence" expanded="True" /> <Node name="UI0-Public" expanded="True" /> <Node name="UI1-Login" expanded="True" /> <Node name="UI2" expanded="True"> <Node name="1-HomePage" expanded="True" /> <Node name="3-Intelligence" expanded="True"> <Node name="Scene" expanded="True" /> </Node> <Node name="4-PersonalCenter" expanded="True"> <Node name="AccountBindInfo" expanded="True" /> <Node name="RoomListManage" expanded="True"> <Node name="AddRoom" expanded="True" /> </Node> <Node name="UnlockSetting" expanded="True" /> </Node> <Node name="FuntionControlView" expanded="True"> <Node name="EnvironmentalScience" expanded="True" /> </Node> </Node> </Node> </Node> <Node name="HDL-ON_Android" expanded="True" /> <Node name="HDL-ON_iOS" expanded="True"> <Node name="Resources" expanded="True" /> </Node> @@ -48,10 +73,6 @@ <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.SelectDevice" /> <MonoDevelop.Ide.DebuggingService.Breakpoints> <BreakpointStore> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/Mqtt/MqttClient.cs" relfile="HDL_ON/DAL/Mqtt/MqttClient.cs" line="529" column="1" /> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL-ON_iOS/ViewController.cs" relfile="HDL-ON_iOS/ViewController.cs" line="87" column="1" /> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL-ON_iOS/ViewController.cs" relfile="HDL-ON_iOS/ViewController.cs" line="75" column="1" /> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/Entity/Function/Scene.cs" relfile="HDL_ON/Entity/Function/Scene.cs" line="267" column="1" /> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/Entity/Function/Function.cs" relfile="HDL_ON/Entity/Function/Function.cs" line="292" column="1" /> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/AddRoomPage.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/AddRoomPage.cs" line="449" column="1" /> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/AddRoomPage.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/AddRoomPage.cs" line="526" column="1" /> HDL-ON_Android/Application.cs
@@ -81,7 +81,7 @@ { Console.WriteLine("HHH 网络变化但处于后台"); } MainPage.InternetStatus = obj; }; }; BaseActivity.RefreshUIAction += (activity) => HDL-ON_iOS/AppDelegate.cs
@@ -165,7 +165,7 @@ public override void OnResignActivation(UIApplication application) { Console.WriteLine("OnResignActivation"); OnAppConfig.Instance.unlockTime = DateTime.Now; UserInfo.Current.unlockTime = DateTime.Now; HDL_ON.DriverLayer.UdpSocket._BusSocket.Stop(); } @@ -195,7 +195,7 @@ { Console.WriteLine("OnActivated"); base.OnActivated(application); Console.WriteLine("oooo..."); //if (haveToSignOut == true) //{ ////强制下线 HDL-ON_iOS/Resources/Language.ini
@@ -390,6 +390,8 @@ 368=欢迎使用ON+ 369=添加新住宅 370=成为家庭成员 371=功能无法使用,请绑定网关 372=无法创建场景,请绑定网关 5000=音乐 5001=组合 HDL-ON_iOS/ViewController.cs
@@ -15,7 +15,7 @@ base.ViewDidLoad(); if (string.IsNullOrEmpty(OnAppConfig.Instance.SetLanguage)) if (string.IsNullOrEmpty(UserInfo.Current.SetLanguage)) { if (NSLocale.PreferredLanguages[0].Contains("zh-")) { @@ -32,7 +32,7 @@ } else { Language.CurrentLanguage = OnAppConfig.Instance.SetLanguage; Language.CurrentLanguage = UserInfo.Current.SetLanguage; } HDL_ON.MainPage.Show(); @@ -77,14 +77,17 @@ { Control.Ins.GatewayOnline = false; Control.Ins.IsRemote = false; MainPage.InternetStatus = 0; } else if (internetStatus == NetworkStatus.ReachableViaCarrierDataNetwork)//3,4G的网络连接 1 { Control.Ins.SearchLoaclGateway(); MainPage.InternetStatus = 1; } else if (internetStatus == NetworkStatus.ReachableViaWiFiNetwork) { Control.Ins.SearchLoaclGateway(); MainPage.InternetStatus = 2; } } } HDL_ON/Common/FileUtlis.cs
@@ -23,6 +23,22 @@ /// 根目录 /// </summary> string RootPath = Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + "/"; string accountPath; string AccountPath { get { if (string.IsNullOrEmpty(accountPath) || !accountPath.Contains(UserInfo.Current.ID)) { accountPath = Path.Combine(RootPath, UserInfo.Current.CurReginID); if (!Directory.Exists(accountPath)) { Directory.CreateDirectory(accountPath); } } return accountPath + "/"; } } /// <summary> /// 住宅文件夹路径 /// </summary> @@ -31,9 +47,9 @@ { get { if (string.IsNullOrEmpty(regionPath)) if (string.IsNullOrEmpty(regionPath) || !regionPath.Contains(UserInfo.Current.CurReginID )) { regionPath = Path.Combine(RootPath, DB_ResidenceData.residenceData.CurReginID); regionPath = Path.Combine(AccountPath, UserInfo.Current.CurReginID); if (!Directory.Exists(regionPath)) { Directory.CreateDirectory(regionPath); @@ -42,15 +58,15 @@ return regionPath + "/"; } } /// <summary> /// 用户信息路径 /// 文件是否存在 /// </summary> string userInfoPath /// <param name="filePath">File path.</param> public bool Exists(string filePath) { get { return "UserInfo_File"; } return File.Exists(Path.Combine(Files.RootPath, filePath)); } /// <summary> @@ -133,6 +149,177 @@ } } } /// <summary> /// 读取userInfo文件 /// </summary> /// <returns></returns> public byte[] ReadUserInfo() { var fileName = "UserInfo_File"; FileStream fs = null; try { if (File.Exists(Path.Combine(RootPath, fileName))) { fs = new FileStream(Path.Combine(RootPath, fileName), FileMode.Open, FileAccess.Read); } else if (File.Exists(fileName)) { fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); } else { return new byte[0]; } byte[] bytes = new byte[fs.Length]; fs.Read(bytes, 0, bytes.Length); return bytes; } catch { return new byte[0]; } finally { try { if (fs != null) { fs.Close(); } } catch { } } } /// <summary> /// 保存userInfo /// </summary> /// <param name="bytes"></param> /// <returns></returns> public bool WirteUserinfo(byte[] bytes) { var fileName = "UserInfo_File"; FileStream fs = null; try { fs = new FileStream(Path.Combine(RootPath, fileName), FileMode.Create, FileAccess.Write); fs.Write(bytes, 0, bytes.Length); fs.Flush(); MainPage.Log("SaveFile:" + fileName); return true; } catch (Exception ex) { MainPage.Log("FileUtiles Code 113:" + ex.ToString()); return false; } finally { try { if (fs != null) { fs.Close(); } } catch (Exception ex) { MainPage.Log("FileUtils Code 121 :" + ex.ToString()); } } } /// <summary> /// 读取userInfo文件 /// </summary> /// <returns></returns> public byte[] ReadAppConfig() { var fileName = "OnAppConfig"; FileStream fs = null; try { if (File.Exists(Path.Combine(AccountPath, fileName))) { fs = new FileStream(Path.Combine(AccountPath, fileName), FileMode.Open, FileAccess.Read); } else if (File.Exists(fileName)) { fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); } else { return new byte[0]; } byte[] bytes = new byte[fs.Length]; fs.Read(bytes, 0, bytes.Length); return bytes; } catch { return new byte[0]; } finally { try { if (fs != null) { fs.Close(); } } catch { } } } /// <summary> /// 保存userInfo /// </summary> /// <param name="bytes"></param> /// <returns></returns> public bool WirteAppConfig(byte[] bytes) { var fileName = "OnAppConfig"; FileStream fs = null; try { fs = new FileStream(Path.Combine(AccountPath, fileName), FileMode.Create, FileAccess.Write); fs.Write(bytes, 0, bytes.Length); fs.Flush(); MainPage.Log("SaveFile:" + fileName); return true; } catch (Exception ex) { MainPage.Log("FileUtiles Code 113:" + ex.ToString()); return false; } finally { try { if (fs != null) { fs.Close(); } } catch (Exception ex) { MainPage.Log("FileUtils Code 121 :" + ex.ToString()); } } } public byte[] ReadFile(string fileName) { HDL_ON/Common/HDLCommon.cs
@@ -223,20 +223,20 @@ #endregion /// <summary> /// 恢复住宅 /// 2020-12-03 待测试未检测 /// </summary> public void RestoreHomeBackup(string RegionID) { var isExist = FileUtils.ExistRegion(RegionID); if (isExist) { //存在则恢复 string newRegionRootPath = FileUtils.CreateRegionBackup(RegionID); FileUtils.RestoreRegionFiles(newRegionRootPath); } } ///// <summary> ///// 恢复住宅 ///// 2020-12-03 待测试未检测 ///// </summary> //public void RestoreHomeBackup(string RegionID) //{ // var isExist = FileUtils.ExistRegion(RegionID); // if (isExist) // { // //存在则恢复 // string newRegionRootPath = FileUtils.CreateRegionBackup(RegionID); // FileUtils.RestoreRegionFiles(newRegionRootPath); // } //} #region ■ 推送处理_______________________ /// <summary> @@ -297,20 +297,20 @@ try { #region 保存本地数据至文件夹 string oldRegionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID.ToString()); //清空之前的住宅文件 FileUtils.DeleteRegionFiles(oldRegionRootPath); var backuplist = FileUtils.ReadFiles(); //移动文件 foreach (var fileName in backuplist) { System.IO.FileInfo fileInfo = new System.IO.FileInfo(FileUtils.RootPath + fileName); if (fileInfo.Exists) { fileInfo.MoveTo(oldRegionRootPath + fileName); MainPage.Log("move file : " + fileName); } } //string oldRegionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID.ToString()); ////清空之前的住宅文件 //FileUtils.DeleteRegionFiles(oldRegionRootPath); //var backuplist = FileUtils.ReadFiles(); ////移动文件 //foreach (var fileName in backuplist) //{ // System.IO.FileInfo fileInfo = new System.IO.FileInfo(FileUtils.RootPath + fileName); // if (fileInfo.Exists) // { // fileInfo.MoveTo(oldRegionRootPath + fileName); // MainPage.Log("move file : " + fileName); // } //} #endregion } catch (Exception ex) @@ -319,7 +319,7 @@ } finally { FileUtils.DeleteAllFile(); //FileUtils.DeleteAllFile(); //2.注销推送 new HttpServerRequest().SignOutPush(); //3.跳转登录页面 HDL_ON/Common/ImageUtlis.cs
@@ -107,12 +107,12 @@ else { //2.自定义图片,检测是否本地缓存过,没有则云端下载然后缓存 if (!ignoreCache && FileUtils.Exists(imageKey)) if (!ignoreCache && Common.FileUtlis.Files.Exists(imageKey)) { //2.1 本地有缓存并且不忽略缓存,直接本地读取 if (imageView != null) { imageView.ImageBytes = FileUtils.ReadFile(imageKey); imageView.ImageBytes = Common.FileUtlis.Files.ReadFile(imageKey); //Utlis.WriteLine("imageKey 加载自定义缓存图片成功"); } } @@ -124,7 +124,7 @@ byte[] imageBytes = GetImageDownloadUrl(imageKey); if (imageBytes != null) { FileUtils.WriteFileByBytes(imageKey, imageBytes); Common.FileUtlis.Files.WriteFileByBytes(imageKey, imageBytes); //2.3 下载成功,显示并缓存本地 Application.RunOnMainThread(() => { @@ -178,7 +178,7 @@ else { //2.自定义图片,检测是否本地缓存过,没有则云端下载然后缓存 if (!ignoreCache && FileUtils.Exists(imageKey)) if (!ignoreCache && Common.FileUtlis.Files.Exists(imageKey)) { //2.1 本地有缓存并且不忽略缓存,直接本地读取 if (frameLayout != null) @@ -195,7 +195,7 @@ byte[] imageBytes = GetImageDownloadUrl(imageKey); if (imageBytes != null) { FileUtils.WriteFileByBytes(imageKey, imageBytes); Common.FileUtlis.Files.WriteFileByBytes(imageKey, imageBytes); //2.3 下载成功,显示并缓存本地 Application.RunOnMainThread(() => { @@ -259,10 +259,10 @@ { var imageKey = GetHeadImageKey(userId); byte[] imageBytes; if (!ignoreCache && FileUtils.Exists(imageKey)) if (!ignoreCache && Common.FileUtlis.Files.Exists(imageKey)) { //本地有缓存 imageBytes = FileUtils.ReadFile(imageKey); imageBytes = Common.FileUtlis.Files.ReadFile(imageKey); } else { @@ -271,7 +271,7 @@ if(imageBytes != null) { //保存到本地 FileUtils.WriteFileByBytes(imageKey, imageBytes); Common.FileUtlis.Files.WriteFileByBytes(imageKey, imageBytes); } } HDL_ON/Common/R.cs
@@ -4,6 +4,8 @@ { public static class StringId { public const int UnableToCreateScenarioPleaseBindGateway = 372; public const int FunctionCannotBeUsedPleaseBindGateway = 371; public const int TobeFamily = 370; public const int AddNewResidence = 369; public const int WelcomeToOnPlus = 368; HDL_ON/DAL/DriverLayer/Control.cs
@@ -279,6 +279,12 @@ } } public void SendApiReadCommand(List<string> functionIds) { var pm = new DAL.Server.HttpServerRequest(); var pack = pm.RefreshDeviceStatus(functionIds); } /// <summary> /// 发送读取命令 /// 自动判断是否为A协议设备 HDL_ON/DAL/DriverLayer/Control_TcpServer.cs
@@ -203,7 +203,7 @@ break; case CommunicationTopic.BusPcGetAppOids: var bytes = FileUtils.ReadFile(DB_ResidenceData.OidSavePathName); var bytes = Common.FileUtlis.Files.ReadFile(DB_ResidenceData.OidSavePathName); if (bytes.Length > 0) { socket.Send(bytes); HDL_ON/DAL/FileUtils.cs
@@ -1,448 +1,448 @@ using System; using System.IO; using System.Collections.Generic; using Shared; //using System; //using System.IO; //using System.Collections.Generic; //using Shared; namespace HDL_ON { public static class FileUtils { public static string RootPath = Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + "/"; /// <summary> /// 是否存在文件夹 /// </summary> /// <returns></returns> public static bool IsExisFolder(string folderName) { bool result = false; var path = Path.Combine(RootPath, folderName); result = Directory.Exists(path); return result; } /// <summary> /// 创建一个住宅的备份文件夹 /// </summary> public static string CreateRegionBackup(string regionId) { var path = Path.Combine(RootPath, regionId); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } return path + "/"; } /// <summary> /// 判断是否已经存在住宅的本地文件夹 /// </summary> public static bool ExistRegion(string regionId) { var path = Path.Combine(RootPath, regionId); return Directory.Exists(path); } /// <summary> /// 删除指定区域里面的所有文件 /// </summary> /// <param name="path">Path.</param> public static void DeleteRegionFiles(string path) { foreach (var fileName in ReadRegionFiles(path)) { File.Delete(Path.Combine(path, fileName)); MainPage.Log("删除文件名为:" + fileName); } } /// <summary> /// 读取区域文件夹里面的文件 /// </summary> static List<string> ReadRegionFiles(string regionRootPath) { List<string> listFiles = new List<string>(); DirectoryInfo TheFolder = new DirectoryInfo(regionRootPath); foreach (FileInfo NextFile in TheFolder.GetFiles()) { listFiles.Add(NextFile.Name); } return listFiles; } /// <summary> /// 恢复区域文件夹里面的文件 /// </summary> public static void RestoreRegionFiles(string regionRootPath) { DirectoryInfo TheFolder = new DirectoryInfo(regionRootPath); int index = 0; var thFolders = TheFolder.GetFiles(); int folderCount = thFolders.Length; foreach (FileInfo NextFile in thFolders) { index++; if (NextFile.Name.Contains(ImageUtlis.HEADIMAGE)) { continue; } if (NextFile.Name == "null" || NextFile.Name == "UserConfig" || NextFile.Name == "UserInfo_File" || NextFile.Name == "AccountListDB" || NextFile.Name == OnAppConfig.ConfigFile) { continue; } FileInfo fileInfo = new FileInfo(regionRootPath + NextFile.Name); if (fileInfo.Exists) { fileInfo.MoveTo(Application.RootPath + NextFile.Name); MainPage.Log("Restroe : " + NextFile.Name); } } } /// <summary> /// 遍历文件 /// </summary> public static List<string> ReadFiles() { List<string> listFiles = new List<string>(); DirectoryInfo TheFolder = new DirectoryInfo(RootPath); foreach (FileInfo NextFile in TheFolder.GetFiles()) { listFiles.Add(NextFile.Name); } return listFiles; } /// <summary> /// 更改文件名 /// </summary> /// <param name="oldFilePath">Old file path.</param> /// <param name="newFilePath">New file path.</param> public static void ReNameFile(string oldFilePath, string newFilePath) { if (oldFilePath == newFilePath) { return; } DeleteFile(newFilePath); FileInfo fileInfo = new FileInfo(Application.RootPath + oldFilePath); if (fileInfo.Exists) { fileInfo.MoveTo(Application.RootPath + newFilePath); } } public static void ReNameFoler(string srcFolderPath, string destFolderPath) { if (srcFolderPath == destFolderPath) { return; } var srcPath = Path.Combine(RootPath, srcFolderPath); #if DEBUG DirectoryInfo root = new DirectoryInfo (RootPath); foreach (DirectoryInfo d in root.GetDirectories ()) { MainPage.Log ("文件夹:" + d.Name); } #endif if (Directory.Exists(srcPath)) { DirectoryInfo folder = new DirectoryInfo(srcPath); var path = Path.Combine(RootPath, destFolderPath); if (Directory.Exists(path)) { FileAttributes attr0 = File.GetAttributes(path); if (attr0 == FileAttributes.Directory) { Directory.Delete(path, true); } else { File.Delete(path); } } folder.MoveTo(path); #if DEBUG List<string> listFiles = new List<string> (); DirectoryInfo TheFolder = new DirectoryInfo (path); foreach (FileInfo NextFile in TheFolder.GetFiles ()) { MainPage.Log (NextFile.Name); } #endif } #if DEBUG foreach (DirectoryInfo d in root.GetDirectories ()) { MainPage.Log ("文件夹:" + d.Name); } #endif } /// <summary> /// 文件是否存在 /// </summary> /// <param name="filePath">File path.</param> public static bool Exists(string filePath) { //System.MainPage.WriteLog ("Exists==" + Path.Combine (RootPath, filePath)); return File.Exists(Path.Combine(RootPath, filePath)); } /// <summary> /// Deletes the file. /// </summary> /// <param name="fileName">File name.</param> public static void DeleteFile(string fileName) { if (fileName == null || fileName == "Language.ini" || fileName == "AccountListDB" || fileName == OnAppConfig.ConfigFile) { return; } File.Delete(Path.Combine(RootPath, fileName)); MainPage.Log("删除文件名为:" + fileName); } /// <summary> /// Deletes all file. /// </summary> public static void DeleteAllFile() { List<string> filesList = ReadFiles(); for (int j = 0; j < filesList.Count; j++) { var f = filesList[j]; if (f == "linphonerc" || f == "AccountListDB" || f == "UserInfo_File" || f == OnAppConfig.ConfigFile) continue; DeleteFile(f); } } /// <summary> /// Writes the file by bytes. /// </summary> /// <returns><c>true</c>, if file by bytes was writed, <c>false</c> otherwise.</returns> /// <param name="fileName">File name.</param> /// <param name="bytes">Bytes.</param> public static bool WriteFileByBytes(string fileName, byte[] bytes) { if (fileName == null || (fileName = fileName.Trim()) == ("")) { return false; } FileStream fs = null; try { fs = new FileStream(Path.Combine(RootPath, fileName), FileMode.Create, FileAccess.Write); fs.Write(bytes, 0, bytes.Length); fs.Flush(); MainPage.Log("SaveFile:" + fileName); return true; } catch (Exception ex) { MainPage.Log("FileUtiles Code 113:" + ex.ToString()); return false; } finally { try { if (fs != null) { fs.Close(); } } catch (Exception ex) { MainPage.Log("FileUtils Code 121 :" + ex.ToString()); } } } /// <summary> /// Writes the file by input stream. /// </summary> /// <returns><c>true</c>, if file by input stream was writed, <c>false</c> otherwise.</returns> /// <param name="fileName">File name.</param> /// <param name="inputStream">Input stream.</param> /// <param name="isNeedRootPath">If set to <c>true</c> is need root path.</param> public static bool WriteFileByInputStream(string fileName, Stream inputStream) { if (fileName == null || (fileName = fileName.Trim()) == ("")) { return false; } FileStream fs = null; try { byte[] buffer = new byte[4 * 1024]; int length = 0; while ((length = inputStream.Read(buffer, 0, buffer.Length)) != 0) { if (fs == null) { fs = new FileStream(Path.Combine(RootPath, fileName), FileMode.Create, FileAccess.Write); } fs.Write(buffer, 0, length); fs.Flush(); } return true; } catch { return false; } finally { try { if (fs != null) { fs.Close(); } } catch { } } } /// <summary> /// read file /// </summary> /// <returns>The file.</returns> /// <param name="fileName">File name.</param> public static byte[] ReadImage(string fileName) { if (Shared.Application.IsPad) { fileName = "Pad/" + fileName; } else { fileName = "Phone/" + fileName; } FileStream fs = null; try { if (File.Exists(Path.Combine(RootPath, fileName))) { fs = new FileStream(Path.Combine(RootPath, fileName), FileMode.Open, FileAccess.Read); } else if (File.Exists(fileName)) { fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); } else { return new byte[0]; } byte[] bytes = new byte[fs.Length]; fs.Read(bytes, 0, bytes.Length); return bytes; } catch { return new byte[0]; } finally { try { if (fs != null) { fs.Close(); } } catch { } } } public static byte[] ReadFile(string fileName) { FileStream fs = null; try { if (File.Exists(Path.Combine(RootPath, fileName))) { fs = new FileStream(Path.Combine(RootPath, fileName), FileMode.Open, FileAccess.Read); } else if (File.Exists(fileName)) { fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); } else { return new byte[0]; } byte[] bytes = new byte[fs.Length]; fs.Read(bytes, 0, bytes.Length); return bytes; } catch { return new byte[0]; } finally { try { if (fs != null) { fs.Close(); } } catch { } } } /// <summary> /// /// </summary> /// <param name="fileName"></param> /// <param name="imagePath"></param> public static void FileCopyToRootPath(string oldPath, string fileName) { System.IO.FileInfo fileInfo = new System.IO.FileInfo(oldPath); if (fileInfo.Exists) { fileInfo.CopyTo(Path.Combine(RootPath, fileName), true); //Utlis.WriteLine("FileCopyToRootPath : " + Path.Combine(RootPath, fileName)); } } } //[System.Serializable] //class Song //namespace HDL_ON //{ // //string [] ss = new string [] { }; // public List<Album> album = new List<Album>(); // public List<Artist> artist = new List<Artist>(); // public string sss; // public static class FileUtils // { // public static string RootPath = Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + "/"; // /// <summary> // /// 是否存在文件夹 // /// </summary> // /// <returns></returns> // public static bool IsExisFolder(string folderName) // { // bool result = false; // var path = Path.Combine(RootPath, folderName); // result = Directory.Exists(path); // return result; //} //[System.Serializable] //class Album // /// <summary> // /// 创建一个住宅的备份文件夹 // /// </summary> // public static string CreateRegionBackup(string regionId) //{ // public string albumname; // public string artistname; // public string artistpic; // var path = Path.Combine(RootPath, regionId); // if (!Directory.Exists(path)) // { // Directory.CreateDirectory(path); //} //[System.Serializable] //class Artist // return path + "/"; // } // /// <summary> // /// 判断是否已经存在住宅的本地文件夹 // /// </summary> // public static bool ExistRegion(string regionId) //{ // public string artistname; // public string artistpic; // var path = Path.Combine(RootPath, regionId); // return Directory.Exists(path); //} // /// <summary> // /// 删除指定区域里面的所有文件 // /// </summary> // /// <param name="path">Path.</param> // public static void DeleteRegionFiles(string path) // { // foreach (var fileName in ReadRegionFiles(path)) // { // File.Delete(Path.Combine(path, fileName)); // MainPage.Log("删除文件名为:" + fileName); // } // } } // /// <summary> // /// 读取区域文件夹里面的文件 // /// </summary> // static List<string> ReadRegionFiles(string regionRootPath) // { // List<string> listFiles = new List<string>(); // DirectoryInfo TheFolder = new DirectoryInfo(regionRootPath); // foreach (FileInfo NextFile in TheFolder.GetFiles()) // { // listFiles.Add(NextFile.Name); // } // return listFiles; // } // /// <summary> // /// 恢复区域文件夹里面的文件 // /// </summary> // public static void RestoreRegionFiles(string regionRootPath) // { // DirectoryInfo TheFolder = new DirectoryInfo(regionRootPath); // int index = 0; // var thFolders = TheFolder.GetFiles(); // int folderCount = thFolders.Length; // foreach (FileInfo NextFile in thFolders) // { // index++; // if (NextFile.Name.Contains(ImageUtlis.HEADIMAGE)) // { // continue; // } // if (NextFile.Name == "null" || NextFile.Name == "UserConfig" || NextFile.Name == "UserInfo_File" || NextFile.Name == "AccountListDB" || NextFile.Name == OnAppConfig.ConfigFile) // { // continue; // } // FileInfo fileInfo = new FileInfo(regionRootPath + NextFile.Name); // if (fileInfo.Exists) // { // fileInfo.MoveTo(Application.RootPath + NextFile.Name); // MainPage.Log("Restroe : " + NextFile.Name); // } // } // } // /// <summary> // /// 遍历文件 // /// </summary> // public static List<string> ReadFiles() // { // List<string> listFiles = new List<string>(); // DirectoryInfo TheFolder = new DirectoryInfo(RootPath); // foreach (FileInfo NextFile in TheFolder.GetFiles()) // { // listFiles.Add(NextFile.Name); // } // return listFiles; // } // /// <summary> // /// 更改文件名 // /// </summary> // /// <param name="oldFilePath">Old file path.</param> // /// <param name="newFilePath">New file path.</param> // public static void ReNameFile(string oldFilePath, string newFilePath) // { // if (oldFilePath == newFilePath) // { // return; // } // DeleteFile(newFilePath); // FileInfo fileInfo = new FileInfo(Application.RootPath + oldFilePath); // if (fileInfo.Exists) // { // fileInfo.MoveTo(Application.RootPath + newFilePath); // } // } // public static void ReNameFoler(string srcFolderPath, string destFolderPath) // { // if (srcFolderPath == destFolderPath) // { // return; // } // var srcPath = Path.Combine(RootPath, srcFolderPath); //#if DEBUG // DirectoryInfo root = new DirectoryInfo (RootPath); // foreach (DirectoryInfo d in root.GetDirectories ()) { // MainPage.Log ("文件夹:" + d.Name); // } //#endif // if (Directory.Exists(srcPath)) // { // DirectoryInfo folder = new DirectoryInfo(srcPath); // var path = Path.Combine(RootPath, destFolderPath); // if (Directory.Exists(path)) // { // FileAttributes attr0 = File.GetAttributes(path); // if (attr0 == FileAttributes.Directory) // { // Directory.Delete(path, true); // } // else // { // File.Delete(path); // } // } // folder.MoveTo(path); //#if DEBUG // List<string> listFiles = new List<string> (); // DirectoryInfo TheFolder = new DirectoryInfo (path); // foreach (FileInfo NextFile in TheFolder.GetFiles ()) { // MainPage.Log (NextFile.Name); // } //#endif // } //#if DEBUG // foreach (DirectoryInfo d in root.GetDirectories ()) { // MainPage.Log ("文件夹:" + d.Name); // } //#endif // } // /// <summary> // /// 文件是否存在 // /// </summary> // /// <param name="filePath">File path.</param> // public static bool Exists(string filePath) // { // //System.MainPage.WriteLog ("Exists==" + Path.Combine (RootPath, filePath)); // return File.Exists(Path.Combine(RootPath, filePath)); // } // /// <summary> // /// Deletes the file. // /// </summary> // /// <param name="fileName">File name.</param> // public static void DeleteFile(string fileName) // { // if (fileName == null || fileName == "Language.ini" || fileName == "AccountListDB" || fileName == OnAppConfig.ConfigFile) // { // return; // } // File.Delete(Path.Combine(RootPath, fileName)); // MainPage.Log("删除文件名为:" + fileName); // } // /// <summary> // /// Deletes all file. // /// </summary> // public static void DeleteAllFile() // { // List<string> filesList = ReadFiles(); // for (int j = 0; j < filesList.Count; j++) // { // var f = filesList[j]; // if (f == "linphonerc" || f == "AccountListDB" || f == "UserInfo_File" || f == OnAppConfig.ConfigFile) // continue; // DeleteFile(f); // } // } // /// <summary> // /// Writes the file by bytes. // /// </summary> // /// <returns><c>true</c>, if file by bytes was writed, <c>false</c> otherwise.</returns> // /// <param name="fileName">File name.</param> // /// <param name="bytes">Bytes.</param> // public static bool WriteFileByBytes(string fileName, byte[] bytes) // { // if (fileName == null || (fileName = fileName.Trim()) == ("")) // { // return false; // } // FileStream fs = null; // try // { // fs = new FileStream(Path.Combine(RootPath, fileName), FileMode.Create, FileAccess.Write); // fs.Write(bytes, 0, bytes.Length); // fs.Flush(); // MainPage.Log("SaveFile:" + fileName); // return true; // } // catch (Exception ex) // { // MainPage.Log("FileUtiles Code 113:" + ex.ToString()); // return false; // } // finally // { // try // { // if (fs != null) // { // fs.Close(); // } // } // catch (Exception ex) // { // MainPage.Log("FileUtils Code 121 :" + ex.ToString()); // } // } // } // /// <summary> // /// Writes the file by input stream. // /// </summary> // /// <returns><c>true</c>, if file by input stream was writed, <c>false</c> otherwise.</returns> // /// <param name="fileName">File name.</param> // /// <param name="inputStream">Input stream.</param> // /// <param name="isNeedRootPath">If set to <c>true</c> is need root path.</param> // public static bool WriteFileByInputStream(string fileName, Stream inputStream) // { // if (fileName == null || (fileName = fileName.Trim()) == ("")) // { // return false; // } // FileStream fs = null; // try // { // byte[] buffer = new byte[4 * 1024]; // int length = 0; // while ((length = inputStream.Read(buffer, 0, buffer.Length)) != 0) // { // if (fs == null) // { // fs = new FileStream(Path.Combine(RootPath, fileName), FileMode.Create, FileAccess.Write); // } // fs.Write(buffer, 0, length); // fs.Flush(); // } // return true; // } // catch // { // return false; // } // finally // { // try // { // if (fs != null) // { // fs.Close(); // } // } // catch // { // } // } // } // /// <summary> // /// read file // /// </summary> // /// <returns>The file.</returns> // /// <param name="fileName">File name.</param> // public static byte[] ReadImage(string fileName) // { // if (Shared.Application.IsPad) // { // fileName = "Pad/" + fileName; // } // else // { // fileName = "Phone/" + fileName; // } // FileStream fs = null; // try // { // if (File.Exists(Path.Combine(RootPath, fileName))) // { // fs = new FileStream(Path.Combine(RootPath, fileName), FileMode.Open, FileAccess.Read); // } // else if (File.Exists(fileName)) // { // fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); // } // else // { // return new byte[0]; // } // byte[] bytes = new byte[fs.Length]; // fs.Read(bytes, 0, bytes.Length); // return bytes; // } // catch // { // return new byte[0]; // } // finally // { // try // { // if (fs != null) // { // fs.Close(); // } // } // catch // { // } // } // } // public static byte[] ReadFile(string fileName) // { // FileStream fs = null; // try // { // if (File.Exists(Path.Combine(RootPath, fileName))) // { // fs = new FileStream(Path.Combine(RootPath, fileName), FileMode.Open, FileAccess.Read); // } // else if (File.Exists(fileName)) // { // fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); // } // else // { // return new byte[0]; // } // byte[] bytes = new byte[fs.Length]; // fs.Read(bytes, 0, bytes.Length); // return bytes; // } // catch // { // return new byte[0]; // } // finally // { // try // { // if (fs != null) // { // fs.Close(); // } // } // catch // { // } // } // } // /// <summary> // /// // /// </summary> // /// <param name="fileName"></param> // /// <param name="imagePath"></param> // public static void FileCopyToRootPath(string oldPath, string fileName) // { // System.IO.FileInfo fileInfo = new System.IO.FileInfo(oldPath); // if (fileInfo.Exists) // { // fileInfo.CopyTo(Path.Combine(RootPath, fileName), true); // //Utlis.WriteLine("FileCopyToRootPath : " + Path.Combine(RootPath, fileName)); // } // } // } // //[System.Serializable] // //class Song // //{ // // //string [] ss = new string [] { }; // // public List<Album> album = new List<Album>(); // // public List<Artist> artist = new List<Artist>(); // // public string sss; // //} // //[System.Serializable] // //class Album // //{ // // public string albumname; // // public string artistname; // // public string artistpic; // //} // //[System.Serializable] // //class Artist // //{ // // public string artistname; // // public string artistpic; // //} //} HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -210,7 +210,7 @@ /// </summary> public static async Task StartCloudMqtt() { if (OnAppConfig.Instance.internetStatus == 0) if (MainPage.InternetStatus == 0) { return; } @@ -268,7 +268,8 @@ else { SetGatewayOnlineResetCheck(); Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, DB_ResidenceData.residenceData.HomeGateway.aesKey); var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, DB_ResidenceData.residenceData.HomeGateway.aesKey); //bus数据解析 if (DB_ResidenceData.residenceData.GatewayType == 0) { @@ -287,7 +288,7 @@ else { //A协议数据处理 var revString = Encoding.UTF8.GetString(e.ApplicationMessage.Payload); var revString = Encoding.UTF8.GetString(bytes); Control.Ins.UpdataFunctionStatus(revString); } } @@ -309,6 +310,7 @@ if (RemoteMqttClient.ConnectedHandler == null) { RemoteMqttClient.UseConnectedHandler(async (e) => { Control.Ins.GatewayOnline = true; IfNeedReadAllDeviceStatus = true; Utlis.WriteLine($"============>Mqtt远程连接成功"); SendPushSignOut(); HDL_ON/DAL/Mqtt/MqttInfoConfig.cs
@@ -24,7 +24,7 @@ { try { var MqttInfoConfigBytes = FileUtils.ReadFile(ConfigFile); var MqttInfoConfigBytes = Common.FileUtlis.Files.ReadFile(ConfigFile); var MqttInfoConfigString = Encoding.UTF8.GetString(MqttInfoConfigBytes); MqttInfoConfig temp = null; if (MqttInfoConfigString != null) @@ -72,7 +72,7 @@ public void Save() { FileUtils.WriteFileByBytes(ConfigFile, GetMqttInfoConfigBytes()); Common.FileUtlis.Files.WriteFileByBytes(ConfigFile, GetMqttInfoConfigBytes()); } } } HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -492,20 +492,20 @@ UserInfo.Current.regionList.Add(home); } if (string.IsNullOrEmpty(DB_ResidenceData.residenceData.CurReginID)) if (string.IsNullOrEmpty(UserInfo.Current.CurReginID)) { DB_ResidenceData.residenceData.CurReginID = UserInfo.Current.regionList[0].RegionID; UserInfo.Current.CurReginID = UserInfo.Current.regionList[0].RegionID; //恢复备份 HDLCommon.Current.RestoreHomeBackup(DB_ResidenceData.residenceData.CurReginID); //HDLCommon.Current.RestoreHomeBackup(DB_ResidenceData.residenceData.CurReginID); } else { var curRegion = UserInfo.Current.regionList.Find((obj) => obj.RegionID == DB_ResidenceData.residenceData.CurReginID); var curRegion = UserInfo.Current.regionList.Find((obj) => obj.RegionID == UserInfo.Current.CurReginID); if(curRegion == null) { DB_ResidenceData.residenceData.CurReginID = UserInfo.Current.regionList[0].RegionID; UserInfo.Current.CurReginID = UserInfo.Current.regionList[0].RegionID; //恢复备份 HDLCommon.Current.RestoreHomeBackup(DB_ResidenceData.residenceData.CurReginID); //HDLCommon.Current.RestoreHomeBackup(DB_ResidenceData.residenceData.CurReginID); } } HDL_ON/Entity/DB_ResidenceData.cs
@@ -29,14 +29,14 @@ } else { var curRegion = UserInfo.Current.regionList.Find((obj) => obj.RegionID == CurReginID); var curRegion = UserInfo.Current.regionList.Find((obj) => obj.RegionID == UserInfo.Current.CurReginID); if (curRegion == null) { if (UserInfo.Current.regionList != null && UserInfo.Current.regionList.Count > 0) { CurReginID = UserInfo.Current.regionList[0].RegionID; UserInfo.Current.CurReginID = UserInfo.Current.regionList[0].RegionID; //恢复备份 HDLCommon.Current.RestoreHomeBackup(CurReginID); //HDLCommon.Current.RestoreHomeBackup(CurReginID); return UserInfo.Current.regionList[0]; } @@ -81,10 +81,6 @@ // } //} /// <summary> /// 当前选择的住宅索引 /// </summary> public string CurReginID = ""; /// <summary> /// 功能类型列表 /// </summary> public List<ShowFunction> functionTypeList = new List<ShowFunction>(); @@ -98,7 +94,7 @@ { try { var residenceDataBytes = FileUtils.ReadFile("DB_ResidenceData"); var residenceDataBytes = Common.FileUtlis.Files.ReadFile("DB_ResidenceData"); var userConfigString = System.Text.Encoding.UTF8.GetString(residenceDataBytes); DB_ResidenceData temp = null; @@ -246,7 +242,7 @@ if (this == null || this.residecenInfo == null) return; var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); FileUtils.WriteFileByBytes("DB_ResidenceData", ssd); Common.FileUtlis.Files.WriteFileByBytes("DB_ResidenceData", ssd); MainPage.Log("Save DB_ResidenceData"); } @@ -293,7 +289,7 @@ { if (ins_OidList == null) { var bytes = FileUtils.ReadFile(OidSavePathName); var bytes = Common.FileUtlis.Files.ReadFile(OidSavePathName); if (bytes == null || bytes.Length == 0) { ins_OidList = new List<FunctionOid>(); @@ -329,7 +325,7 @@ { var oidBytes = System.Text.Encoding.UTF8.GetBytes(oidJsonString); FileUtils.WriteFileByBytes(OidSavePathName, oidBytes); Common.FileUtlis.Files.WriteFileByBytes(OidSavePathName, oidBytes); } #endregion HDL_ON/Entity/Function/Function.cs
@@ -292,7 +292,7 @@ if (pack.Code == DAL.Server.StateCode.SUCCESS) { var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); FileUtils.WriteFileByBytes(savePath, ssd); Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); } else { @@ -302,7 +302,7 @@ else { var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); FileUtils.WriteFileByBytes(savePath, ssd); Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); } } HDL_ON/Entity/Function/Scene.cs
@@ -27,7 +27,10 @@ public Scene() { sid = NewSid(); if (!string.IsNullOrEmpty(DB_ResidenceData.residenceData.HomeGateway.gatewayId)) { gatewayId = DB_ResidenceData.residenceData.HomeGateway.gatewayId; } } /// <summary> /// 云端唯一ID @@ -249,7 +252,7 @@ else { var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); FileUtils.WriteFileByBytes(savePath, ssd); Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); MainPage.Log($"Save Scene Data : {savePath}"); } } @@ -267,7 +270,7 @@ if (revPack.Code == StateCode.SUCCESS) { var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); FileUtils.WriteFileByBytes(savePath, ssd); Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); } } else if (!string.IsNullOrEmpty(createTime) && !string.IsNullOrEmpty(modifyTime)) @@ -280,7 +283,7 @@ if (tempScene != null) { var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(tempScene)); FileUtils.WriteFileByBytes(savePath, ssd); Common.FileUtlis.Files.WriteFileByBytes(savePath, ssd); } } } HDL_ON/Entity/FunctionList.cs
@@ -18,7 +18,7 @@ { _FunctionList = new FunctionList(); #region 恢复数据 var filePathList = FileUtils.ReadFiles(); var filePathList = Common.FileUtlis.Files.ReadFiles(); foreach (var filePath in filePathList) { _FunctionList.IniFunctionList(filePath); @@ -109,12 +109,12 @@ { if (filePath.StartsWith("FunctionData_")) { var functionDataBytes = FileUtils.ReadFile(filePath); var functionDataBytes = Common.FileUtlis.Files.ReadFile(filePath); var functionDataString = System.Text.Encoding.UTF8.GetString(functionDataBytes); var tempFunction = Newtonsoft.Json.JsonConvert.DeserializeObject<Function>(functionDataString); if (tempFunction == null) { FileUtils.DeleteFile(filePath); Common.FileUtlis.Files.DeleteFile(filePath); return; } if (tempFunction.DeleteSign) @@ -170,7 +170,7 @@ } if (filePath.StartsWith("SceneData_")) { var sceneDataBytes = FileUtils.ReadFile(filePath); var sceneDataBytes = Common.FileUtlis.Files.ReadFile(filePath); var sceneDataString = System.Text.Encoding.UTF8.GetString(sceneDataBytes); var tempScene = Newtonsoft.Json.JsonConvert.DeserializeObject<Scene>(sceneDataString); List.scenes.Add(tempScene); @@ -495,12 +495,12 @@ /// </summary> public void DelAllFunctionData() { var filePathList = FileUtils.ReadFiles(); var filePathList = Common.FileUtlis.Files.ReadFiles(); foreach (var filePath in filePathList) { if (filePath.StartsWith("FunctionData_") && filePath.Length == 13 + 28) { FileUtils.DeleteFile(filePath); Common.FileUtlis.Files.DeleteFile(filePath); } } _FunctionList = new FunctionList(); @@ -516,7 +516,7 @@ var packCode = pm.DeleteScene(scene.userSceneId); if (packCode == StateCode.SUCCESS) { FileUtils.DeleteFile(scene.savePath); Common.FileUtlis.Files.DeleteFile(scene.savePath); List.scenes.Remove(scene); } else @@ -526,7 +526,7 @@ } else { FileUtils.DeleteFile(scene.savePath); Common.FileUtlis.Files.DeleteFile(scene.savePath); List.scenes.Remove(scene); } } @@ -573,7 +573,7 @@ _FunctionList.fans.Remove(_FunctionList.fans.Find((obj) => obj.deviceId == delTemp.deviceId)); break; } FileUtils.DeleteFile(delTemp.savePath); Common.FileUtlis.Files.DeleteFile(delTemp.savePath); } bool lockReadFunctionStatus = false; @@ -598,6 +598,17 @@ lockReadFunctionStatus = true; try { if (DriverLayer.Control.Ins.IsRemote) { var functionIds = new List<string>(); foreach (var function in GetAllDeviceFunctionList()) { functionIds.Add(function.deviceId); } DriverLayer.Control.Ins.SendApiReadCommand(functionIds); } else { foreach (var function in GetAllDeviceFunctionList()) { switch (function.functionCategory) @@ -612,6 +623,7 @@ } } } } catch (Exception ex) { MainPage.Log($"Refresh Residence Function Status Error : {ex.Message}"); HDL_ON/Entity/OnAppConfig.cs
@@ -12,14 +12,14 @@ /// <summary> /// OnAppConfig /// </summary> public const string ConfigFile = "OnAppConfig"; //public const string ConfigFile = "OnAppConfig"; static OnAppConfig instance; public static OnAppConfig Instance { get { if (instance == null) { try { var userConfigBytes = FileUtils.ReadFile (ConfigFile); var userConfigBytes = Common.FileUtlis.Files.ReadAppConfig (); var userConfigString = System.Text.Encoding.UTF8.GetString (userConfigBytes); OnAppConfig temp = null; if (userConfigString != null) { @@ -42,11 +42,7 @@ { return System.Text.Encoding.UTF8.GetBytes (Newtonsoft.Json.JsonConvert.SerializeObject (this)); } /// <summary> /// 网络连接状态 /// 0:无网络 /// </summary> public int internetStatus = 2; public void RefreshUserConfig () { @@ -55,33 +51,8 @@ public void SaveUserConfig () { FileUtils.WriteFileByBytes (ConfigFile, GetUserConfigBytes ()); Common.FileUtlis.Files.WirteAppConfig ( GetUserConfigBytes ()); } public string SetLanguage = ""; /// <summary> /// 软件解锁界面 /// 1:启动时 /// 2:布防撤防时 /// 3:远程开锁时 /// </summary> public List<string> appUnlockPage = new List<string>(); /// <summary> /// 软件解锁方式 /// 1:数字密码 /// 2:手势密码 /// 3:指纹密码 /// 4:面容ID /// </summary> public List<string> appUnlockType = new List<string>(); /// <summary> /// 软件解锁密码 /// </summary> public string appUnlockPasswrod = ""; /// <summary> /// 解锁时间 /// </summary> public DateTime unlockTime = DateTime.MinValue; } } HDL_ON/Entity/Room.cs
@@ -46,7 +46,7 @@ public SpatialInfo(string spatialType) { roomType = "FLOOR"; parentId = DB_ResidenceData.residenceData.CurReginID; parentId = UserInfo.Current.CurReginID; } public string roomId = ""; @@ -182,7 +182,7 @@ } } var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(FloorList)); FileUtils.WriteFileByBytes(dataSavePath, ssd); Common.FileUtlis.Files.WriteFileByBytes(dataSavePath, ssd); } } @@ -202,7 +202,7 @@ { try { var floorsDataBytes = FileUtils.ReadFile("FloorsData"); var floorsDataBytes = Common.FileUtlis.Files.ReadFile("FloorsData"); if (floorsDataBytes != null) { var floorsDataString = System.Text.Encoding.UTF8.GetString(floorsDataBytes); @@ -264,7 +264,7 @@ } } var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(CurrentSpatial.FloorList)); FileUtils.WriteFileByBytes(dataSavePath, ssd); Common.FileUtlis.Files.WriteFileByBytes(dataSavePath, ssd); } return revPack.Code; } @@ -279,7 +279,7 @@ if (revPack.Code == StateCode.SUCCESS) { var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(FloorList)); FileUtils.WriteFileByBytes(dataSavePath, ssd); Common.FileUtlis.Files.WriteFileByBytes(dataSavePath, ssd); } return revPack.Code; } @@ -301,7 +301,7 @@ CurrentSpatial.FloorList.Remove(tRoom); } var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(FloorList)); FileUtils.WriteFileByBytes(dataSavePath, ssd); Common.FileUtlis.Files.WriteFileByBytes(dataSavePath, ssd); } else { @@ -329,13 +329,13 @@ try { rooms = new List<Room> { }; var filePathList = FileUtils.ReadFiles(); var filePathList = Common.FileUtlis.Files.ReadFiles(); foreach (var filePath in filePathList) { if (filePath.StartsWith("RoomData_")) { var roomDataBytes = FileUtils.ReadFile(filePath); var roomDataBytes = Common.FileUtlis.Files.ReadFile(filePath); var roomDataString = System.Text.Encoding.UTF8.GetString(roomDataBytes); var room = Newtonsoft.Json.JsonConvert.DeserializeObject<Room>(roomDataString); if (room != null) @@ -375,7 +375,7 @@ room = tempRoom as Room; CurrentSpatial.RoomList.Add(room); var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(room)); FileUtils.WriteFileByBytes(dataSavePath, ssd); Common.FileUtlis.Files.WriteFileByBytes(dataSavePath, ssd); } } } @@ -397,7 +397,7 @@ { CurrentSpatial.RoomList.Remove(room); } FileUtils.DeleteFile(room.dataSavePath); Common.FileUtlis.Files.DeleteFile(room.dataSavePath); } return pack.Code; } @@ -408,7 +408,7 @@ { foreach(var localRoom in RoomList) { FileUtils.DeleteFile(localRoom.dataSavePath); Common.FileUtlis.Files.DeleteFile(localRoom.dataSavePath); } RoomList.Clear(); } @@ -450,7 +450,7 @@ if (needSave) { var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this)); FileUtils.WriteFileByBytes(dataSavePath, ssd); Common.FileUtlis.Files.WriteFileByBytes(dataSavePath, ssd); } return packCode; } @@ -503,16 +503,6 @@ if (f != null) { return f.roomName + " "; } else { foreach(var f1 in CurrentSpatial.FloorList) { if(f1.uid == parentId) { return f.roomName + " "; } } } } return ""; HDL_ON/Entity/UserInfo.cs
@@ -11,7 +11,6 @@ [System.Serializable] public class UserInfo { public static readonly string ConfigFile = "UserInfo_File"; /// <summary> /// 通用方法 /// </summary> @@ -27,7 +26,7 @@ { try { UserInfo temp = Newtonsoft.Json.JsonConvert.DeserializeObject<UserInfo>(System.Text.Encoding.UTF8.GetString(FileUtils.ReadFile(ConfigFile))); UserInfo temp = Newtonsoft.Json.JsonConvert.DeserializeObject<UserInfo>(System.Text.Encoding.UTF8.GetString(Common.FileUtlis.Files.ReadUserInfo())); if (temp == null) { m_Current = new UserInfo() { }; @@ -170,12 +169,16 @@ /// 用户住宅列表 /// </summary> public List<RegionInfoRes> regionList = new List<RegionInfoRes>(); /// <summary> /// 当前选择的住宅索引 /// </summary> public string CurReginID = ""; #endregion public void SaveUserInfo() { FileUtils.WriteFileByBytes(ConfigFile, Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this))); Common.FileUtlis.Files.WirteUserinfo( Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this))); } /// <summary> @@ -192,24 +195,30 @@ headImagePagePath = "LoginIcon/2.png";//重置用户头像 } private byte[] convertByte(Image img) { MemoryStream ms = new MemoryStream(); img.Save(ms, img.RawFormat); //byte[] bytes = new byte[ms.Length]; //ms.Read(bytes, 0, Convert.ToInt32(ms.Length)); //以上两句改成下面两句 byte[] bytes = ms.ToArray(); ms.Close(); return bytes; } private Image convertImg(byte[] datas) { MemoryStream ms = new MemoryStream(datas); Image img = Image.FromStream(ms, true);//在这里出错 //流用完要及时关闭 ms.Close(); return img; } public string SetLanguage = ""; /// <summary> /// 软件解锁界面 /// 1:启动时 /// 2:布防撤防时 /// 3:远程开锁时 /// </summary> public List<string> appUnlockPage = new List<string>(); /// <summary> /// 软件解锁方式 /// 1:数字密码 /// 2:手势密码 /// 3:指纹密码 /// 4:面容ID /// </summary> public List<string> appUnlockType = new List<string>(); /// <summary> /// 软件解锁密码 /// </summary> public string appUnlockPasswrod = ""; /// <summary> /// 解锁时间 /// </summary> public DateTime unlockTime = DateTime.MinValue; } } HDL_ON/UI/MainPage.cs
@@ -48,6 +48,11 @@ /// 远程模式 /// </summary> public static bool IsRemote = false; /// <summary> /// 网络连接状态 /// 0:无网络 /// </summary> public static int InternetStatus = 2; ///// <summary> ///// 公司代码 @@ -149,6 +154,8 @@ waitPage.Start(Language.StringByID(StringId.PleaseWait)); new System.Threading.Thread(() => { try { if (UserInfo.Current.regionList.Count == 0) { bool loadPage = true; @@ -156,7 +163,7 @@ while (UserInfo.Current.regionList.Count == 0) { pm.GetHomePager();//刷新住宅信息 System.Threading.Thread.Sleep(1000); System.Threading.Thread.Sleep(3000); if (loadPage) { loadPage = false; @@ -206,6 +213,10 @@ userPage.LoadPage(); BasePageView.PageIndex = 0; }); }catch(Exception ex) { MainPage.Log($"GoUserPage : {ex.Message}"); } }).Start(); } HDL_ON/UI/UI0-Public/AppUnlockPage.cs
@@ -15,10 +15,10 @@ } Action action = () => { OnAppConfig.Instance.unlockTime = DateTime.Now; UserInfo.Current.unlockTime = DateTime.Now; }; //1:验证指纹 if (OnAppConfig.Instance.appUnlockType.Contains("3")) if (UserInfo.Current.appUnlockType.Contains("3")) { Action fAction = () => { @@ -31,23 +31,23 @@ if (e == TouchIDUtils.TouchIDState.Success) { MainPage.Log("KK:TouchID验证成功"); OnAppConfig.Instance.unlockTime = DateTime.Now; UserInfo.Current.unlockTime = DateTime.Now; MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); } else { ///将验证指纹的页面移除 MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); if (OnAppConfig.Instance.appUnlockType.Contains("1")) if (UserInfo.Current.appUnlockType.Contains("1")) { var page = new AppUnlockPasswordPage(OnAppConfig.Instance.appUnlockPasswrod, action); var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, action); MainPage.BasePageView.AddChidren(page); page.LoadPage("7"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } else if (OnAppConfig.Instance.appUnlockType.Contains("2")) else if (UserInfo.Current.appUnlockType.Contains("2")) { var page = new AppUnlockGesturePage(OnAppConfig.Instance.appUnlockPasswrod, action); var page = new AppUnlockGesturePage(UserInfo.Current.appUnlockPasswrod, action); MainPage.BasePageView.AddChidren(page); page.LoadPage("7"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; @@ -56,20 +56,20 @@ } }; } else if (OnAppConfig.Instance.appUnlockType.Contains("4")) else if (UserInfo.Current.appUnlockType.Contains("4")) { //Face ID验证 // } else if (OnAppConfig.Instance.appUnlockType.Contains("1")) else if (UserInfo.Current.appUnlockType.Contains("1")) { var page = new AppUnlockPasswordPage(OnAppConfig.Instance.appUnlockPasswrod, action); var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, action); MainPage.BasePageView.AddChidren(page); page.LoadPage("7"); } else if (OnAppConfig.Instance.appUnlockType.Contains("2")) else if (UserInfo.Current.appUnlockType.Contains("2")) { var page = new AppUnlockGesturePage(OnAppConfig.Instance.appUnlockPasswrod, action); var page = new AppUnlockGesturePage(UserInfo.Current.appUnlockPasswrod, action); MainPage.BasePageView.AddChidren(page); page.LoadPage("7"); } @@ -97,7 +97,7 @@ public void LoadPage() { if (OnAppConfig.Instance.unlockTime.AddSeconds(60) > DateTime.Now || OnAppConfig.Instance.appUnlockPasswrod == "" || OnAppConfig.Instance.appUnlockPage.Count == 0) if (UserInfo.Current.unlockTime.AddSeconds(60) > DateTime.Now || UserInfo.Current.appUnlockPasswrod == "" || UserInfo.Current.appUnlockPage.Count == 0) { return; } @@ -153,7 +153,7 @@ TextAlignment = TextAlignment.Center, TextColor = CSS.CSS_Color.MainColor, TextSize = CSS.CSS_FontSize.TextFontSize, TextID = OnAppConfig.Instance.appUnlockType.Contains("1") ? StringId.VerifyDigitalPassword : StringId.VerifyGesturePassword, TextID = UserInfo.Current.appUnlockType.Contains("1") ? StringId.VerifyDigitalPassword : StringId.VerifyGesturePassword, }; bodyView.AddChidren(btnOtherVerify); @@ -163,18 +163,18 @@ MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); Action action = () => { OnAppConfig.Instance.unlockTime = DateTime.Now; UserInfo.Current.unlockTime = DateTime.Now; }; if (OnAppConfig.Instance.appUnlockType.Contains("1")) if (UserInfo.Current.appUnlockType.Contains("1")) { var page = new AppUnlockPasswordPage(OnAppConfig.Instance.appUnlockPasswrod, action); var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, action); MainPage.BasePageView.AddChidren(page); page.LoadPage(optionType); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } else if (OnAppConfig.Instance.appUnlockType.Contains("2")) else if (UserInfo.Current.appUnlockType.Contains("2")) { var page = new AppUnlockGesturePage(OnAppConfig.Instance.appUnlockPasswrod, action); var page = new AppUnlockGesturePage(UserInfo.Current.appUnlockPasswrod, action); MainPage.BasePageView.AddChidren(page); page.LoadPage(optionType); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; HDL_ON/UI/UI1-Login/LoginPage.cs
@@ -192,7 +192,7 @@ } else { etAccount.Text = "13697499568"; etAccount.Text = "18824864143"; } b = !b; etPassword.Text = "123456"; HDL_ON/UI/UI1-Login/LoginPageBLL.cs
@@ -617,16 +617,16 @@ * 查看本地是否存在数据 * 存在则导出 */ var isExis = FileUtils.IsExisFolder(DB_ResidenceData.residenceData.CurReginID); if (isExis) { FileUtils.DeleteAllFile(); string regionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID); FileUtils.RestoreRegionFiles(regionRootPath); DB_ResidenceData.residenceData.EixtAccount(); OnAppConfig.Instance.RefreshUserConfig(); SpatialInfo.CurrentSpatial.InitRoomFunction(); } //var isExis = FileUtils.IsExisFolder(DB_ResidenceData.residenceData.CurReginID); //if (isExis) //{ // FileUtils.DeleteAllFile(); // string regionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID); // FileUtils.RestoreRegionFiles(regionRootPath); // DB_ResidenceData.residenceData.EixtAccount(); // OnAppConfig.Instance.RefreshUserConfig(); // SpatialInfo.CurrentSpatial.InitRoomFunction(); //} Application.RunOnMainThread(() => { //跳转页面---- HDL_ON/UI/UI2/1-HomePage/HomePage.cs
@@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using HDL_ON.DAL; using HDL_ON.DriverLayer; using HDL_ON.Entity; using HDL_ON.UI.CSS; using Newtonsoft.Json; @@ -122,6 +123,21 @@ Radius = (uint)Application.GetRealWidth(3), }; topView.AddChidren(btnLinkStateTip); if (Control.Ins.GatewayOnline) { if (Control.Ins.IsRemote) { bodyView.btnLinkStateTip.BackgroundColor = CSS.CSS_Color.LinkTipRemote; } else { bodyView.btnLinkStateTip.BackgroundColor = CSS.CSS_Color.MainColor; } } else { bodyView.btnLinkStateTip.BackgroundColor = CSS.CSS_Color.LinkTipFail; } btnResidenceName = new Button() { HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
@@ -101,7 +101,7 @@ { Y = btnTipNot.Bottom, Height = Application.GetRealWidth(100), TextID = StringId.TipNotOpen, TextID = StringId.ContentIsEmpty, TextAlignment = TextAlignment.Center, TextColor = CSS.CSS_Color.TextualColor, TextSize = CSS.CSS_FontSize.PromptFontSize_FirstLevel, HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs
@@ -12,7 +12,7 @@ /// <summary> /// 住宅ID /// </summary> public static string homeId = Entity.DB_ResidenceData.residenceData.CurReginID; public static string homeId = UserInfo.Current.CurReginID; /// <summary> /// 网关ID /// </summary> HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs
@@ -69,6 +69,27 @@ }; bodyView.AddChidren(topView); if (DB_ResidenceData.residenceData.GatewayType == 0) { btnSceneTilte = new Button() { Y = Application.GetRealHeight(30), //Width = Application.GetRealWidth(170), Height = Application.GetRealHeight(25), TextAlignment = TextAlignment.Center, TextSize = CSS_FontSize.HeadlineFontSize, TextColor = CSS_Color.PromptingColor1, SelectedTextColor = CSS_Color.MainColor, TextID = StringId.Scenes, IsSelected = true }; topView.AddChidren(btnSceneTilte); btnAutomationTitle = new Button(); } else { btnSceneTilte = new Button() { Y = Application.GetRealHeight(30), @@ -96,7 +117,7 @@ TextID = StringId.Automation, }; topView.AddChidren(btnAutomationTitle); } var btnAddIconBg = new Button() { X = Application.GetRealWidth(337), @@ -318,7 +339,6 @@ }; view.AddChidren(btnZone); Button btnSettingIcon; btnSettingIcon = new Button() { @@ -380,9 +400,8 @@ //btnAddIcon.RemoveFromParent(); automationPage = new FrameLayout(); contentPageView.AddChidren(automationPage); HDL_ON.UI.UI2.Intelligence.Automation.MainView.automationPage = automationPage; HDL_ON.UI.UI2.Intelligence.Automation.MainView.MainShow(); UI2.Intelligence.Automation.MainView.automationPage = automationPage; UI2.Intelligence.Automation.MainView.MainShow(); } #endregion } @@ -474,7 +493,7 @@ else { //跳转到逻辑界面 HDL_ON.UI.UI2.Intelligence.Automation.MainView.SkipAddLogicPage(); UI2.Intelligence.Automation.MainView.SkipAddLogicPage(); } }; } HDL_ON/UI/UI2/3-Intelligence/Scene/NewSceneMenuListPage.cs
@@ -1,4 +1,5 @@ using System; using HDL_ON.Entity; using HDL_ON.UI.CSS; using Shared; namespace HDL_ON.UI @@ -154,6 +155,11 @@ { btnAddSceneBg.MouseUpEventHandler = (sender, e) => { if (!string.IsNullOrEmpty(DB_ResidenceData.residenceData.HomeGateway.gatewayId)) { new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.UnableToCreateScenarioPleaseBindGateway), true); return; } Action backAction = () => { this.RemoveFromParent(); action(); HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs
@@ -982,7 +982,7 @@ System.IO.File.Delete(imageView.ImagePath); } //重命名保存 FileUtils.WriteFileByBytes(imageUrl, imageBytes); Common.FileUtlis.Files.WriteFileByBytes(imageUrl, imageBytes); imageView.ImagePath = null; imageView.ImageBytes = imageBytes; //上传成功 HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs
@@ -177,14 +177,14 @@ /// <param name="homeTemp"></param> void LoadEvent_ChangeCurHome(RegionInfoRes homeTemp) { if (DB_ResidenceData.residenceData.CurReginID == homeTemp.RegionID) if (UserInfo.Current.CurReginID == homeTemp.RegionID) { return; } string oldRegionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID.ToString()); string newRegionRootPath = FileUtils.CreateRegionBackup(homeTemp.RegionID.ToString()); DB_ResidenceData.residenceData.CurReginID = homeTemp.RegionID; DB_ResidenceData.residenceData.SaveResidenceData(); //string oldRegionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID.ToString()); //string newRegionRootPath = FileUtils.CreateRegionBackup(homeTemp.RegionID.ToString()); UserInfo.Current.CurReginID = homeTemp.RegionID; UserInfo.Current.SaveUserInfo(); var waitPage = new Loading(); bodyView.AddChidren(waitPage); waitPage.Start(Language.StringByID(StringId.PleaseWait)); @@ -192,43 +192,43 @@ { try { var backuplist = FileUtils.ReadFiles(); int index = 0; FileUtils.DeleteRegionFiles(oldRegionRootPath); //移动文件 foreach (var fileName in backuplist) { System.IO.FileInfo fileInfo = new System.IO.FileInfo(FileUtils.RootPath + fileName); if (fileName.Contains(ImageUtlis.HEADIMAGE) || fileName == OnAppConfig.ConfigFile) { continue; } if (fileInfo.Exists) { fileInfo.MoveTo(oldRegionRootPath + fileName); MainPage.Log("move file : " + fileName); } index++; Application.RunOnMainThread(() => { int pro = (int)(index * 1.0 / backuplist.Count * 50); waitPage.Text = pro.ToString() + "%"; }); } //删除本地文件 foreach (var fileName in backuplist) { if (fileName.Contains(ImageUtlis.HEADIMAGE)) { continue; } FileUtils.DeleteFile(fileName); } //倒出新住宅数据 FileUtils.RestoreRegionFiles(newRegionRootPath); //var backuplist = FileUtils.ReadFiles(); //int index = 0; //FileUtils.DeleteRegionFiles(oldRegionRootPath); ////移动文件 //foreach (var fileName in backuplist) //{ // System.IO.FileInfo fileInfo = new System.IO.FileInfo(FileUtils.RootPath + fileName); // if (fileName.Contains(ImageUtlis.HEADIMAGE) || fileName == OnAppConfig.ConfigFile) // { // continue; // } // if (fileInfo.Exists) // { // fileInfo.MoveTo(oldRegionRootPath + fileName); // MainPage.Log("move file : " + fileName); // } // index++; // Application.RunOnMainThread(() => // { // int pro = (int)(index * 1.0 / backuplist.Count * 50); // waitPage.Text = pro.ToString() + "%"; // }); //} ////删除本地文件 //foreach (var fileName in backuplist) //{ // if (fileName.Contains(ImageUtlis.HEADIMAGE)) // { // continue; // } // FileUtils.DeleteFile(fileName); //} ////倒出新住宅数据 //FileUtils.RestoreRegionFiles(newRegionRootPath); UserInfo.Current.CurReginID = homeTemp.RegionID; UserInfo.Current.SaveUserInfo(); DB_ResidenceData.residenceData.EixtAccount(); DB_ResidenceData.residenceData.CurReginID = homeTemp.RegionID; OnAppConfig.Instance.SaveUserConfig(); SpatialInfo.CurrentSpatial.InitRoomFunction(); DB_ResidenceData.residenceData.SaveResidenceData(); HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPageBLL.cs
@@ -95,20 +95,20 @@ try { #region 保存本地数据至文件夹 string oldRegionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID.ToString()); //清空之前的住宅文件 FileUtils.DeleteRegionFiles(oldRegionRootPath); var backuplist = FileUtils.ReadFiles(); //移动文件 foreach (var fileName in backuplist) { System.IO.FileInfo fileInfo = new System.IO.FileInfo(FileUtils.RootPath + fileName); if (fileInfo.Exists) { fileInfo.MoveTo(oldRegionRootPath + fileName); MainPage.Log("move file : " + fileName); } } //string oldRegionRootPath = FileUtils.CreateRegionBackup(DB_ResidenceData.residenceData.CurReginID.ToString()); ////清空之前的住宅文件 //FileUtils.DeleteRegionFiles(oldRegionRootPath); //var backuplist = FileUtils.ReadFiles(); ////移动文件 //foreach (var fileName in backuplist) //{ // System.IO.FileInfo fileInfo = new System.IO.FileInfo(FileUtils.RootPath + fileName); // if (fileInfo.Exists) // { // fileInfo.MoveTo(oldRegionRootPath + fileName); // MainPage.Log("move file : " + fileName); // } //} #endregion } catch (Exception ex) @@ -117,7 +117,7 @@ } finally { FileUtils.DeleteAllFile(); //FileUtils.DeleteAllFile(); //2.注销推送 new HttpServerRequest().SignOutPush(); //3.跳转登录页面 @@ -278,7 +278,7 @@ System.IO.File.Delete(imageView.ImagePath); } //重命名保存 FileUtils.WriteFileByBytes(imageUrl, imageBytes); Common.FileUtlis.Files.WriteFileByBytes(imageUrl, imageBytes); imageView.ImagePath = null; imageView.ImageBytes = imageBytes; //上传成功 HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/AddRoomPage.cs
@@ -695,7 +695,7 @@ System.IO.File.Delete(imageView.ImagePath); } //重命名保存 FileUtils.WriteFileByBytes(imageUrl, imageBytes); Common.FileUtlis.Files.WriteFileByBytes(imageUrl, imageBytes); imageView.ImagePath = null; imageView.ImageBytes = imageBytes; //上传成功 HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/RoomBinglingFloorPage.cs
@@ -94,7 +94,7 @@ { try { var f = new SpatialInfo("FLOOR") { roomName = floorName, parentId = DB_ResidenceData.residenceData.CurReginID }; var f = new SpatialInfo("FLOOR") { roomName = floorName, parentId = UserInfo.Current.CurReginID }; var addResult = SpatialInfo.CurrentSpatial.AddFloor(f); if (addResult == DAL.Server.StateCode.SUCCESS) { HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPage.cs
@@ -125,7 +125,7 @@ { try { var f = new SpatialInfo("FLOOR") { roomName = floorName, parentId = DB_ResidenceData.residenceData.CurReginID }; var f = new SpatialInfo("FLOOR") { roomName = floorName, parentId = UserInfo.Current.CurReginID }; var addResult = SpatialInfo.CurrentSpatial.AddFloor(f); if (addResult == DAL.Server.StateCode.SUCCESS) { HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs
@@ -365,7 +365,7 @@ System.IO.File.Delete(imageView.ImagePath); } //重命名保存 FileUtils.WriteFileByBytes(imageUrl, imageBytes); Common.FileUtlis.Files.WriteFileByBytes(imageUrl, imageBytes); imageView.ImagePath = null; imageView.ImageBytes = imageBytes; //上传成功 HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockGesturePage.cs
@@ -149,11 +149,11 @@ this.RemoveFromParent(); return; } if (OnAppConfig.Instance.appUnlockType.Contains("2")) if (UserInfo.Current.appUnlockType.Contains("2")) { OnAppConfig.Instance.appUnlockType = new System.Collections.Generic.List<string>(); OnAppConfig.Instance.appUnlockPasswrod = ""; OnAppConfig.Instance.SaveUserConfig(); UserInfo.Current.appUnlockType = new System.Collections.Generic.List<string>(); UserInfo.Current.appUnlockPasswrod = ""; UserInfo.Current.SaveUserInfo(); this.RemoveFromParent(); backAction(); } @@ -170,36 +170,36 @@ { if (passwrod == oldPasswrod) { if (optionType == "5" )//&& OnAppConfig.Instance.appUnlockType.Contains("3")) if (optionType == "5" )//&& UserInfo.Current.appUnlockType.Contains("3")) { if (OnAppConfig.Instance.appUnlockType.Contains("3")) OnAppConfig.Instance.appUnlockType.Remove("3"); if (UserInfo.Current.appUnlockType.Contains("3")) UserInfo.Current.appUnlockType.Remove("3"); else OnAppConfig.Instance.appUnlockType.Add("3"); UserInfo.Current.appUnlockType.Add("3"); OnAppConfig.Instance.SaveUserConfig(); UserInfo.Current.SaveUserInfo(); this.RemoveFromParent(); } if ( optionType == "6") { if (OnAppConfig.Instance.appUnlockType.Contains("4")) OnAppConfig.Instance.appUnlockType.Remove("4"); if (UserInfo.Current.appUnlockType.Contains("4")) UserInfo.Current.appUnlockType.Remove("4"); else OnAppConfig.Instance.appUnlockType.Add("4"); UserInfo.Current.appUnlockType.Add("4"); OnAppConfig.Instance.SaveUserConfig(); UserInfo.Current.SaveUserInfo(); this.RemoveFromParent(); } if (optionType == "8" && !OnAppConfig.Instance.appUnlockType.Contains("3")) if (optionType == "8" && !UserInfo.Current.appUnlockType.Contains("3")) { OnAppConfig.Instance.appUnlockType.Add("3"); OnAppConfig.Instance.SaveUserConfig(); UserInfo.Current.appUnlockType.Add("3"); UserInfo.Current.SaveUserInfo(); this.RemoveFromParent(); } if (!OnAppConfig.Instance.appUnlockType.Contains("4") && optionType == "9") if (!UserInfo.Current.appUnlockType.Contains("4") && optionType == "9") { OnAppConfig.Instance.appUnlockType.Remove("4"); OnAppConfig.Instance.SaveUserConfig(); UserInfo.Current.appUnlockType.Remove("4"); UserInfo.Current.SaveUserInfo(); this.RemoveFromParent(); } backAction(); @@ -228,29 +228,29 @@ var unlockType = TouchIDUtils.getTouchIDSupperType() == TouchIDUtils.TouchIDSupperType.TouchID ? "3" : "4"; if (result) { if (!OnAppConfig.Instance.appUnlockType.Contains(unlockType)) if (!UserInfo.Current.appUnlockType.Contains(unlockType)) { OnAppConfig.Instance.appUnlockType.Add(unlockType); UserInfo.Current.appUnlockType.Add(unlockType); } } else { if (OnAppConfig.Instance.appUnlockType.Contains(unlockType)) if (UserInfo.Current.appUnlockType.Contains(unlockType)) { OnAppConfig.Instance.appUnlockType.Remove(unlockType); UserInfo.Current.appUnlockType.Remove(unlockType); } } OnAppConfig.Instance.SaveUserConfig(); UserInfo.Current.SaveUserInfo(); backAction(); }; page.AdditionalOperations(tipMsg, action); } if (!OnAppConfig.Instance.appUnlockType.Contains("2")) if (!UserInfo.Current.appUnlockType.Contains("2")) { OnAppConfig.Instance.appUnlockType.Add("2"); UserInfo.Current.appUnlockType.Add("2"); } OnAppConfig.Instance.appUnlockPasswrod = passwrod; OnAppConfig.Instance.SaveUserConfig(); UserInfo.Current.appUnlockPasswrod = passwrod; UserInfo.Current.SaveUserInfo(); backAction(); } else @@ -287,9 +287,9 @@ var resultObj = new HttpServerRequest().LoginByPassword( UserInfo.Current.AccountString, pw); if (resultObj.Code == StateCode.SUCCESS) { OnAppConfig.Instance.appUnlockPasswrod = ""; OnAppConfig.Instance.appUnlockType = new System.Collections.Generic.List<string>(); OnAppConfig.Instance.SaveUserConfig(); UserInfo.Current.appUnlockPasswrod = ""; UserInfo.Current.appUnlockType = new System.Collections.Generic.List<string>(); UserInfo.Current.SaveUserInfo(); this.RemoveFromParent(); backAction(); } HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockPasswordPage.cs
@@ -229,11 +229,11 @@ this.RemoveFromParent(); return; } if (OnAppConfig.Instance.appUnlockType.Contains("1")) if (UserInfo.Current.appUnlockType.Contains("1")) { OnAppConfig.Instance.appUnlockType =new System.Collections.Generic.List<string>();//.Remove("1"); OnAppConfig.Instance.appUnlockPasswrod = ""; OnAppConfig.Instance.SaveUserConfig(); UserInfo.Current.appUnlockType =new System.Collections.Generic.List<string>();//.Remove("1"); UserInfo.Current.appUnlockPasswrod = ""; UserInfo.Current.SaveUserInfo(); this.RemoveFromParent(); backAction(); } @@ -253,22 +253,22 @@ { if (optionType == "5") { if (OnAppConfig.Instance.appUnlockType.Contains("3")) OnAppConfig.Instance.appUnlockType.Remove("3"); if (UserInfo.Current.appUnlockType.Contains("3")) UserInfo.Current.appUnlockType.Remove("3"); else OnAppConfig.Instance.appUnlockType.Add("3"); UserInfo.Current.appUnlockType.Add("3"); OnAppConfig.Instance.SaveUserConfig(); UserInfo.Current.SaveUserInfo(); this.RemoveFromParent(); } if (optionType == "6") { if (OnAppConfig.Instance.appUnlockType.Contains("4")) OnAppConfig.Instance.appUnlockType.Remove("4"); if (UserInfo.Current.appUnlockType.Contains("4")) UserInfo.Current.appUnlockType.Remove("4"); else OnAppConfig.Instance.appUnlockType.Add("4"); UserInfo.Current.appUnlockType.Add("4"); OnAppConfig.Instance.SaveUserConfig(); UserInfo.Current.SaveUserInfo(); this.RemoveFromParent(); } backAction(); @@ -298,29 +298,29 @@ { if (result) { if (!OnAppConfig.Instance.appUnlockType.Contains(unlockType)) if (!UserInfo.Current.appUnlockType.Contains(unlockType)) { OnAppConfig.Instance.appUnlockType.Add(unlockType); UserInfo.Current.appUnlockType.Add(unlockType); } } else { if (OnAppConfig.Instance.appUnlockType.Contains(unlockType)) if (UserInfo.Current.appUnlockType.Contains(unlockType)) { OnAppConfig.Instance.appUnlockType.Remove(unlockType); UserInfo.Current.appUnlockType.Remove(unlockType); } } backAction(); OnAppConfig.Instance.SaveUserConfig(); UserInfo.Current.SaveUserInfo(); }; page.AdditionalOperations(tipMsg, action); } if (!OnAppConfig.Instance.appUnlockType.Contains("1")) if (!UserInfo.Current.appUnlockType.Contains("1")) { OnAppConfig.Instance.appUnlockType.Add("1"); UserInfo.Current.appUnlockType.Add("1"); } OnAppConfig.Instance.appUnlockPasswrod = passwrod; OnAppConfig.Instance.SaveUserConfig(); UserInfo.Current.appUnlockPasswrod = passwrod; UserInfo.Current.SaveUserInfo(); backAction(); } else @@ -371,9 +371,9 @@ var resultObj = new HttpServerRequest().LoginByPassword( UserInfo.Current.AccountString, pw); if (resultObj.Code.ToUpper() == StateCode.SUCCESS) { OnAppConfig.Instance.appUnlockPasswrod = ""; OnAppConfig.Instance.appUnlockType = new System.Collections.Generic.List<string>(); OnAppConfig.Instance.SaveUserConfig(); UserInfo.Current.appUnlockPasswrod = ""; UserInfo.Current.appUnlockType = new System.Collections.Generic.List<string>(); UserInfo.Current.SaveUserInfo(); this.RemoveFromParent(); backAction(); } HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPage.cs
@@ -147,10 +147,10 @@ bodyView.BackgroundColor = CSS_Color.BackgroundColor; //如果用户配置了需要解锁的界面但是没有设置密码,则在返回时清空需要解锁的界面 Action action = () => { if(OnAppConfig.Instance.appUnlockPage.Count > 0&& OnAppConfig.Instance.appUnlockPasswrod == "") if(UserInfo.Current.appUnlockPage.Count > 0&& UserInfo.Current.appUnlockPasswrod == "") { OnAppConfig.Instance.appUnlockPage = new System.Collections.Generic.List<string>(); OnAppConfig.Instance.SaveUserConfig(); UserInfo.Current.appUnlockPage = new System.Collections.Generic.List<string>(); UserInfo.Current.SaveUserInfo(); } }; new TopViewDiv(bodyView, Language.StringByID(StringId.InterpretationSettings)).LoadTopView(action); @@ -418,7 +418,7 @@ Height = Application.GetRealHeight(260), BackgroundColor = CSS_Color.MainBackgroundColor, ScrollEnabled = false, Visible = OnAppConfig.Instance.appUnlockPage.Count > 0 Visible = UserInfo.Current.appUnlockPage.Count > 0 }; bodyView.AddChidren(unlockOptionView); @@ -470,7 +470,7 @@ { Height = Application.GetRealHeight(50), }; if ( !OnAppConfig.Instance.appUnlockType.Contains("2")) if ( !UserInfo.Current.appUnlockType.Contains("2")) { unlockOptionView.AddChidren(passwordUnlockDiv); } @@ -504,7 +504,7 @@ Height = Application.GetMinRealAverage(38), UnSelectedImagePath = "Public/Switch_2.png", SelectedImagePath = "Public/SwitchOn_2.png", IsSelected = OnAppConfig.Instance.appUnlockType.Contains("1") IsSelected = UserInfo.Current.appUnlockType.Contains("1") }; passwordUnlockDiv.AddChidren(btnPasswordUnlockkSwtichIcon); @@ -532,7 +532,7 @@ { Height = Application.GetRealHeight(50), }; if (OnAppConfig.Instance.appUnlockPasswrod != "" && OnAppConfig.Instance.appUnlockType.Contains("1")) if (UserInfo.Current.appUnlockPasswrod != "" && UserInfo.Current.appUnlockType.Contains("1")) { unlockOptionView.AddChidren(resetPasswordDiv); } @@ -557,7 +557,7 @@ }; resetPasswordDiv.AddChidren(btnResetPasswordTitle); if (OnAppConfig.Instance.appUnlockPasswrod != "" && OnAppConfig.Instance.appUnlockType.Contains("1")) if (UserInfo.Current.appUnlockPasswrod != "" && UserInfo.Current.appUnlockType.Contains("1")) { unlockOptionView.AddChidren(new Button() { @@ -574,7 +574,7 @@ { Height = Application.GetRealHeight(50), }; if (!OnAppConfig.Instance.appUnlockType.Contains("1")) if (!UserInfo.Current.appUnlockType.Contains("1")) { unlockOptionView.AddChidren(gestureUnlockDiv); } @@ -606,7 +606,7 @@ Height = Application.GetMinRealAverage(38), UnSelectedImagePath = "Public/Switch_2.png", SelectedImagePath = "Public/SwitchOn_2.png", IsSelected = OnAppConfig.Instance.appUnlockType.Contains("2") IsSelected = UserInfo.Current.appUnlockType.Contains("2") }; gestureUnlockDiv.AddChidren(btnGestureUnlockkSwtichIcon); @@ -621,7 +621,7 @@ }; gestureUnlockDiv.AddChidren(btnGestureUnlockTitle); if (!OnAppConfig.Instance.appUnlockType.Contains("1")) if (!UserInfo.Current.appUnlockType.Contains("1")) { unlockOptionView.AddChidren(new Button() { @@ -639,7 +639,7 @@ { Height = Application.GetRealHeight(50), }; if (OnAppConfig.Instance.appUnlockPasswrod != "" && OnAppConfig.Instance.appUnlockType.Contains("2")) if (UserInfo.Current.appUnlockPasswrod != "" && UserInfo.Current.appUnlockType.Contains("2")) { unlockOptionView.AddChidren(resetGestureDiv); } @@ -664,7 +664,7 @@ }; resetGestureDiv.AddChidren(btnResetGestureTitle); if (OnAppConfig.Instance.appUnlockPasswrod != "" && OnAppConfig.Instance.appUnlockType.Contains("2")) if (UserInfo.Current.appUnlockPasswrod != "" && UserInfo.Current.appUnlockType.Contains("2")) { unlockOptionView.AddChidren(new Button() { @@ -696,7 +696,7 @@ { Height = Application.GetRealHeight(51), }; if (sTouchID && OnAppConfig.Instance.appUnlockPasswrod != ""&&!OnAppConfig.Instance.appUnlockType.Contains("4")) if (sTouchID && UserInfo.Current.appUnlockPasswrod != ""&&!UserInfo.Current.appUnlockType.Contains("4")) { unlockOptionView.AddChidren(fingerprintUnlockDiv); } @@ -729,7 +729,7 @@ Height = Application.GetMinRealAverage(38), UnSelectedImagePath = "Public/Switch_2.png", SelectedImagePath = "Public/SwitchOn_2.png", IsSelected = OnAppConfig.Instance.appUnlockType.Contains("3") IsSelected = UserInfo.Current.appUnlockType.Contains("3") }; fingerprintUnlockDiv.AddChidren(btnFingerprintUnlockSwtichIcon); @@ -750,7 +750,7 @@ { Height = Application.GetRealHeight(50), }; if (sFaceID && OnAppConfig.Instance.appUnlockPasswrod != "" && !OnAppConfig.Instance.appUnlockType.Contains("4")) if (sFaceID && UserInfo.Current.appUnlockPasswrod != "" && !UserInfo.Current.appUnlockType.Contains("4")) { unlockOptionView.AddChidren(faceIdUnlockDiv); } @@ -782,7 +782,7 @@ Height = Application.GetMinRealAverage(38), UnSelectedImagePath = "Public/Switch_2.png", SelectedImagePath = "Public/SwitchOn_2.png", IsSelected = OnAppConfig.Instance.appUnlockType.Contains("4") IsSelected = UserInfo.Current.appUnlockType.Contains("4") }; faceIdUnlockDiv.AddChidren(btnFaceIdUnlockSwtichIcon); HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPageBLL.cs
@@ -14,10 +14,10 @@ refreshAction = () => { LoadView_UnlockView(); //fingerprintUnlockDiv.Visible = sTouchID && (OnAppConfig.Instance.appUnlockType.Contains("1") || OnAppConfig.Instance.appUnlockType.Contains("2")); //faceIdUnlockDiv.Visible = sFaceID && (OnAppConfig.Instance.appUnlockType.Contains("1") || OnAppConfig.Instance.appUnlockType.Contains("2")); //btnFingerprintUnlockSwtichIcon.IsSelected = OnAppConfig.Instance.appUnlockType.Contains("3"); //btnFaceIdUnlockSwtichIcon.IsSelected = OnAppConfig.Instance.appUnlockType.Contains("4"); //fingerprintUnlockDiv.Visible = sTouchID && (UserInfo.Current.appUnlockType.Contains("1") || UserInfo.Current.appUnlockType.Contains("2")); //faceIdUnlockDiv.Visible = sFaceID && (UserInfo.Current.appUnlockType.Contains("1") || UserInfo.Current.appUnlockType.Contains("2")); //btnFingerprintUnlockSwtichIcon.IsSelected = UserInfo.Current.appUnlockType.Contains("3"); //btnFaceIdUnlockSwtichIcon.IsSelected = UserInfo.Current.appUnlockType.Contains("4"); }; } @@ -37,10 +37,10 @@ btnTipMsg.TextID = StringId.UnprotectedTipMsg; OnAppConfig.Instance.appUnlockPage = new System.Collections.Generic.List<string>(); OnAppConfig.Instance.appUnlockType = new System.Collections.Generic.List<string>(); OnAppConfig.Instance.appUnlockPasswrod = ""; OnAppConfig.Instance.SaveUserConfig(); UserInfo.Current.appUnlockPage = new System.Collections.Generic.List<string>(); UserInfo.Current.appUnlockType = new System.Collections.Generic.List<string>(); UserInfo.Current.appUnlockPasswrod = ""; UserInfo.Current.SaveUserInfo(); unlockOptionView.Visible = false; refreshAction(); }; @@ -48,7 +48,7 @@ if (!btnUnprotectedBg.IsSelected) { //1:验证指纹 if (OnAppConfig.Instance.appUnlockType.Contains("3")) if (UserInfo.Current.appUnlockType.Contains("3")) { TouchIDUtils.Instance.showTouchIDWithDescribe(null, Language.StringByID(StringId.PleaseVerifyTheFingerprint)); TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = (sender1, e) => @@ -65,16 +65,16 @@ else if (e == TouchIDUtils.TouchIDState.InputPassword || e == TouchIDUtils.TouchIDState.TouchIDLockout) { MainPage.Log("KK:用户选择手动输入密码"); if (OnAppConfig.Instance.appUnlockType.Contains("1")) if (UserInfo.Current.appUnlockType.Contains("1")) { var page = new AppUnlockPasswordPage(OnAppConfig.Instance.appUnlockPasswrod, action); var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, action); MainPage.BasePageView.AddChidren(page); page.LoadPage("4"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } else if (OnAppConfig.Instance.appUnlockType.Contains("1")) else if (UserInfo.Current.appUnlockType.Contains("1")) { var page = new AppUnlockGesturePage(OnAppConfig.Instance.appUnlockPasswrod, action); var page = new AppUnlockGesturePage(UserInfo.Current.appUnlockPasswrod, action); MainPage.BasePageView.AddChidren(page); page.LoadPage("4"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; @@ -82,21 +82,21 @@ } }; } else if (OnAppConfig.Instance.appUnlockType.Contains("4")) else if (UserInfo.Current.appUnlockType.Contains("4")) { //Face ID验证 // } else if (OnAppConfig.Instance.appUnlockType.Contains("1")) else if (UserInfo.Current.appUnlockType.Contains("1")) { var page = new AppUnlockPasswordPage(OnAppConfig.Instance.appUnlockPasswrod, action); var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, action); MainPage.BasePageView.AddChidren(page); page.LoadPage("4"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } else if (OnAppConfig.Instance.appUnlockType.Contains("2")) else if (UserInfo.Current.appUnlockType.Contains("2")) { var page = new AppUnlockGesturePage(OnAppConfig.Instance.appUnlockPasswrod, action); var page = new AppUnlockGesturePage(UserInfo.Current.appUnlockPasswrod, action); MainPage.BasePageView.AddChidren(page); page.LoadPage("4"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; @@ -104,7 +104,7 @@ } }; if (OnAppConfig.Instance.appUnlockPasswrod != "") if (UserInfo.Current.appUnlockPasswrod != "") { new PublicAssmebly().TipMsg(StringId.Tip, StringId.TipTurnOffUnlockingSetting, action1); } @@ -126,29 +126,29 @@ if (result) { btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = false; if (!OnAppConfig.Instance.appUnlockPage.Contains("1")) if (!UserInfo.Current.appUnlockPage.Contains("1")) { OnAppConfig.Instance.appUnlockPage.Add("1"); if (OnAppConfig.Instance.appUnlockPasswrod != "") OnAppConfig.Instance.SaveUserConfig(); UserInfo.Current.appUnlockPage.Add("1"); if (UserInfo.Current.appUnlockPasswrod != "") UserInfo.Current.SaveUserInfo(); } unlockOptionView.Visible = true; } else { if (OnAppConfig.Instance.appUnlockPage.Contains("1")) if (UserInfo.Current.appUnlockPage.Contains("1")) { OnAppConfig.Instance.appUnlockPage.Remove("1"); UserInfo.Current.appUnlockPage.Remove("1"); } if (OnAppConfig.Instance.appUnlockPage.Count == 0) if (UserInfo.Current.appUnlockPage.Count == 0) { btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = true; btnTipMsg.TextID = StringId.UnprotectedTipMsg; OnAppConfig.Instance.appUnlockPasswrod = ""; UserInfo.Current.appUnlockPasswrod = ""; unlockOptionView.Visible = false; refreshAction(); } OnAppConfig.Instance.SaveUserConfig(); UserInfo.Current.SaveUserInfo(); } }; btnStartupBg.MouseUpEventHandler = eventHandler2; @@ -165,29 +165,29 @@ if (result) { btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = false; if (!OnAppConfig.Instance.appUnlockPage.Contains("2")) if (!UserInfo.Current.appUnlockPage.Contains("2")) { OnAppConfig.Instance.appUnlockPage.Add("2"); if (OnAppConfig.Instance.appUnlockPasswrod != "") OnAppConfig.Instance.SaveUserConfig(); UserInfo.Current.appUnlockPage.Add("2"); if (UserInfo.Current.appUnlockPasswrod != "") UserInfo.Current.SaveUserInfo(); } unlockOptionView.Visible = true; } else { if (OnAppConfig.Instance.appUnlockPage.Contains("2")) if (UserInfo.Current.appUnlockPage.Contains("2")) { OnAppConfig.Instance.appUnlockPage.Remove("2"); UserInfo.Current.appUnlockPage.Remove("2"); } if (OnAppConfig.Instance.appUnlockPage.Count == 0) if (UserInfo.Current.appUnlockPage.Count == 0) { btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = result; btnTipMsg.TextID = StringId.UnprotectedTipMsg; OnAppConfig.Instance.appUnlockPasswrod = ""; UserInfo.Current.appUnlockPasswrod = ""; unlockOptionView.Visible = false; refreshAction(); } OnAppConfig.Instance.SaveUserConfig(); UserInfo.Current.SaveUserInfo(); } }; btnSecurityBg.MouseUpEventHandler = eventHandler3; @@ -203,29 +203,29 @@ if (result) { btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = false; if (!OnAppConfig.Instance.appUnlockPage.Contains("3")) if (!UserInfo.Current.appUnlockPage.Contains("3")) { OnAppConfig.Instance.appUnlockPage.Add("3"); if (OnAppConfig.Instance.appUnlockPasswrod != "") OnAppConfig.Instance.SaveUserConfig(); UserInfo.Current.appUnlockPage.Add("3"); if (UserInfo.Current.appUnlockPasswrod != "") UserInfo.Current.SaveUserInfo(); } unlockOptionView.Visible = true; } else { if (OnAppConfig.Instance.appUnlockPage.Contains("3")) if (UserInfo.Current.appUnlockPage.Contains("3")) { OnAppConfig.Instance.appUnlockPage.Remove("3"); UserInfo.Current.appUnlockPage.Remove("3"); } if (OnAppConfig.Instance.appUnlockPage.Count == 0) if (UserInfo.Current.appUnlockPage.Count == 0) { btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = true; btnTipMsg.TextID = StringId.UnprotectedTipMsg; OnAppConfig.Instance.appUnlockPasswrod = ""; UserInfo.Current.appUnlockPasswrod = ""; unlockOptionView.Visible = false; refreshAction(); } OnAppConfig.Instance.SaveUserConfig(); UserInfo.Current.SaveUserInfo(); } }; btnDoorlockBg.MouseUpEventHandler = eventHandler4; @@ -238,23 +238,23 @@ /// </summary> void LoadEvent_InitOptionState() { if (OnAppConfig.Instance.appUnlockPage.Count == 0) if (UserInfo.Current.appUnlockPage.Count == 0) { btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = true; } else { if (OnAppConfig.Instance.appUnlockPage.Contains("1")) if (UserInfo.Current.appUnlockPage.Contains("1")) { btnStartupBg.IsSelected = btnStartupSelectionIcon.IsSelected = btnStartupSelectionTip.IsSelected = true; btnTipMsg.Text = Language.StringByID(StringId.AtStartupTipMsg); } if (OnAppConfig.Instance.appUnlockPage.Contains("2")) if (UserInfo.Current.appUnlockPage.Contains("2")) { btnSecurityBg.IsSelected = btnSecuritySelectionIcon.IsSelected = btnSecuritySelectionTip.IsSelected = true; btnTipMsg.Text = Language.StringByID(StringId.DefenseAndUndefenseTipMsg); } if (OnAppConfig.Instance.appUnlockPage.Contains("3")) if (UserInfo.Current.appUnlockPage.Contains("3")) { btnDoorlockBg.IsSelected = btnDoorlockSelectionIcon.IsSelected = btnDoorlockSelectionTip.IsSelected = true; btnTipMsg.Text = Language.StringByID(StringId.RemoteUnlockingTipMsg); @@ -269,15 +269,15 @@ { btnPasswordUnlockTitle.MouseUpEventHandler = (sender, e) => { var page = new AppUnlockPasswordPage(OnAppConfig.Instance.appUnlockPasswrod, refreshAction); var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, refreshAction); MainPage.BasePageView.AddChidren(page); page.LoadPage(OnAppConfig.Instance.appUnlockType.Contains("1") ? "3" : "1"); page.LoadPage(UserInfo.Current.appUnlockType.Contains("1") ? "3" : "1"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; btnResetPasswordTitle.MouseUpEventHandler = (sender, e) => { var page = new AppUnlockPasswordPage(OnAppConfig.Instance.appUnlockPasswrod, refreshAction); var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, refreshAction); MainPage.BasePageView.AddChidren(page); page.LoadPage("2"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; @@ -285,14 +285,14 @@ btnGestureUnlockTitle.MouseUpEventHandler = (sender, e) => { var page = new AppUnlockGesturePage(OnAppConfig.Instance.appUnlockPasswrod, refreshAction); var page = new AppUnlockGesturePage(UserInfo.Current.appUnlockPasswrod, refreshAction); MainPage.BasePageView.AddChidren(page); page.LoadPage(OnAppConfig.Instance.appUnlockType.Contains("2") ? "3" : "1"); page.LoadPage(UserInfo.Current.appUnlockType.Contains("2") ? "3" : "1"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; btnResetGestureTitle.MouseUpEventHandler = (sender, e) => { var page = new AppUnlockGesturePage(OnAppConfig.Instance.appUnlockPasswrod, refreshAction); var page = new AppUnlockGesturePage(UserInfo.Current.appUnlockPasswrod, refreshAction); MainPage.BasePageView.AddChidren(page); page.LoadPage("3"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; @@ -316,18 +316,18 @@ var result = btnFingerprintUnlockSwtichIcon.IsSelected = !btnFingerprintUnlockSwtichIcon.IsSelected; if (result) { if (!OnAppConfig.Instance.appUnlockType.Contains("3")) if (!UserInfo.Current.appUnlockType.Contains("3")) { OnAppConfig.Instance.appUnlockType.Add("3"); OnAppConfig.Instance.SaveUserConfig(); UserInfo.Current.appUnlockType.Add("3"); UserInfo.Current.SaveUserInfo(); } } else { if (OnAppConfig.Instance.appUnlockType.Contains("3")) if (UserInfo.Current.appUnlockType.Contains("3")) { OnAppConfig.Instance.appUnlockType.Remove("3"); OnAppConfig.Instance.SaveUserConfig(); UserInfo.Current.appUnlockType.Remove("3"); UserInfo.Current.SaveUserInfo(); } } //MainPage.BasePageView.RemoveAt(MainPage.BasePageView.ChildrenCount - 1); @@ -335,16 +335,16 @@ } else// if (e == TouchIDUtils.TouchIDState.InputPassword || e == TouchIDUtils.TouchIDState.TouchIDLockout) { if (OnAppConfig.Instance.appUnlockType.Contains("1")) if (UserInfo.Current.appUnlockType.Contains("1")) { var page = new AppUnlockPasswordPage(OnAppConfig.Instance.appUnlockPasswrod, refreshAction); var page = new AppUnlockPasswordPage(UserInfo.Current.appUnlockPasswrod, refreshAction); MainPage.BasePageView.AddChidren(page); page.LoadPage("5"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; } else if (OnAppConfig.Instance.appUnlockType.Contains("2")) else if (UserInfo.Current.appUnlockType.Contains("2")) { var page = new AppUnlockGesturePage(OnAppConfig.Instance.appUnlockPasswrod, refreshAction); var page = new AppUnlockGesturePage(UserInfo.Current.appUnlockPasswrod, refreshAction); MainPage.BasePageView.AddChidren(page); page.LoadPage("5"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs
@@ -94,12 +94,12 @@ /// </summary> public static void Save() { FileUtils.WriteFileByBytes(a31MusiceModeListFilePath, System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(A31MusicModelList))); Common.FileUtlis.Files.WriteFileByBytes(a31MusiceModeListFilePath, System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(A31MusicModelList))); } public static void Refresh() { if (null == Newtonsoft.Json.JsonConvert.DeserializeObject<System.Collections.Generic.List<A31MusicModel>>(System.Text.Encoding.UTF8.GetString(FileUtils.ReadFile(a31MusiceModeListFilePath)))) if (null == Newtonsoft.Json.JsonConvert.DeserializeObject<System.Collections.Generic.List<A31MusicModel>>(System.Text.Encoding.UTF8.GetString(Common.FileUtlis.Files.ReadFile(a31MusiceModeListFilePath)))) { A31MusicModelList = new List<A31MusicModel> { }; //初始化房间列表 @@ -107,7 +107,7 @@ } else { A31MusicModelList = Newtonsoft.Json.JsonConvert.DeserializeObject<System.Collections.Generic.List<A31MusicModel>>(System.Text.Encoding.UTF8.GetString(FileUtils.ReadFile(a31MusiceModeListFilePath))); A31MusicModelList = Newtonsoft.Json.JsonConvert.DeserializeObject<System.Collections.Generic.List<A31MusicModel>>(System.Text.Encoding.UTF8.GetString(Common.FileUtlis.Files.ReadFile(a31MusiceModeListFilePath))); } if (A31MusicModelList == null) {