From 01c46e7bfe9aa8fb20b29f70c83c03a307af548a Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期二, 22 十二月 2020 16:35:16 +0800
Subject: [PATCH] 2020-12-22 1.更新。

---
 HDL_ON/Common/FileUtlis.cs |  110 ++++--------------------------------------------------
 1 files changed, 9 insertions(+), 101 deletions(-)

diff --git a/HDL_ON/Common/FileUtlis.cs b/HDL_ON/Common/FileUtlis.cs
old mode 100644
new mode 100755
index 60198fe..62136bd
--- a/HDL_ON/Common/FileUtlis.cs
+++ b/HDL_ON/Common/FileUtlis.cs
@@ -30,7 +30,7 @@
             {
                 if (string.IsNullOrEmpty(accountPath) || !accountPath.Contains(UserInfo.Current.ID))
                 {
-                    accountPath = Path.Combine(RootPath, UserInfo.Current.CurReginID);
+                    accountPath = Path.Combine(RootPath, UserInfo.Current.ID);
                     if (!Directory.Exists(accountPath))
                     {
                         Directory.CreateDirectory(accountPath);
@@ -47,9 +47,9 @@
         {
             get
             {
-                if (string.IsNullOrEmpty(regionPath) || !regionPath.Contains(UserInfo.Current.CurReginID ))
+                if (string.IsNullOrEmpty(regionPath) || !regionPath.Contains(DB_ResidenceData.Instance.CurrentRegion.RegionID ))
                 {
-                    regionPath = Path.Combine(AccountPath, UserInfo.Current.CurReginID);
+                    regionPath = Path.Combine(AccountPath, DB_ResidenceData.Instance.CurrentRegion.RegionID);
                     if (!Directory.Exists(regionPath))
                     {
                         Directory.CreateDirectory(regionPath);
@@ -58,16 +58,9 @@
                 return regionPath + "/";
             }
         }
-   
 
-        /// <summary>
-        /// 鏂囦欢鏄惁瀛樺湪
-        /// </summary>
-        /// <param name="filePath">File path.</param>
-        public bool Exists(string filePath)
-        {
-            return File.Exists(Path.Combine(Files.RootPath, filePath));
-        }
+        //public List<>
+
 
         /// <summary>
         /// 閬嶅巻鏂囦欢
@@ -126,7 +119,7 @@
                 fs = new FileStream(Path.Combine(RegionPath, fileName), FileMode.Create, FileAccess.Write);
                 fs.Write(bytes, 0, bytes.Length);
                 fs.Flush();
-                MainPage.Log("SaveFile:" + fileName);
+                MainPage.Log($"SaveFile:{fileName}");//Path:{RegionPath}
                 return true;
             }
             catch (Exception ex)
@@ -149,91 +142,6 @@
                 }
             }
         }
-        /// <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>
@@ -244,9 +152,9 @@
             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))
                 {
@@ -292,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