From f2c1e5bf3a67478076fb5bbcf546824b3127db15 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期六, 12 十二月 2020 19:11:40 +0800 Subject: [PATCH] Merge branch 'NewFilePath' into CJL --- HDL_ON/Common/FileUtlis.cs | 91 +-------------------------------------------- 1 files changed, 3 insertions(+), 88 deletions(-) diff --git a/HDL_ON/Common/FileUtlis.cs b/HDL_ON/Common/FileUtlis.cs index aefc01f..b78016d 100644 --- a/HDL_ON/Common/FileUtlis.cs +++ b/HDL_ON/Common/FileUtlis.cs @@ -146,100 +146,15 @@ /// 璇诲彇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))) + if (File.Exists(Path.Combine(RootPath, fileName))) { - fs = new FileStream(Path.Combine(AccountPath, fileName), FileMode.Open, FileAccess.Read); + fs = new FileStream(Path.Combine(RootPath, fileName), FileMode.Open, FileAccess.Read); } else if (File.Exists(fileName)) { @@ -285,7 +200,7 @@ try { - fs = new FileStream(Path.Combine(AccountPath, fileName), FileMode.Create, FileAccess.Write); + fs = new FileStream(Path.Combine(RootPath, fileName), FileMode.Create, FileAccess.Write); fs.Write(bytes, 0, bytes.Length); fs.Flush(); MainPage.Log("SaveFile:" + fileName); -- Gitblit v1.8.0