| | |
| | | string RootPath = Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + "/"; |
| | | |
| | | string accountPath; |
| | | string AccountPath { |
| | | string AccountPath |
| | | { |
| | | get |
| | | { |
| | | if (string.IsNullOrEmpty(accountPath) || !accountPath.Contains(UserInfo.Current.ID)) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public byte[] ReadFile(string fileName) |
| | | { |
| | | FileStream fs = null; |
| | |
| | | } |
| | | } |
| | | |
| | | // 读取指定路径文件内容 |
| | | public byte[] ReadFileForPath(string path) |
| | | { |
| | | FileStream fs = null; |
| | | try |
| | | { |
| | | if (File.Exists(path)) |
| | | { |
| | | fs = new FileStream(path, 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> |
| | | /// 下载网络图片 |
| | |
| | | { |
| | | if (!File.Exists(fileName)) |
| | | { |
| | | System.Threading.Tasks.Task.Run(() => { |
| | | System.Threading.Tasks.Task.Run(() => |
| | | { |
| | | FileStream fs = null; |
| | | try |
| | | { |
| | |
| | | fs.Write(recevieBytes, 0, recevieBytes.Length); |
| | | fs.Flush(); |
| | | } |
| | | catch (Exception ex) { |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"down image : {ex.Message}"); |
| | | } |
| | | finally |
| | |
| | | } |
| | | } |
| | | }); |
| | | }else |
| | | } |
| | | else |
| | | { |
| | | action?.Invoke(); |
| | | } |