| | |
| | | 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 加载自定义缓存图片成功"); |
| | | } |
| | | } |
| | |
| | | byte[] imageBytes = GetImageDownloadUrl(imageKey); |
| | | if (imageBytes != null) |
| | | { |
| | | FileUtils.WriteFileByBytes(imageKey, imageBytes); |
| | | Common.FileUtlis.Files.WriteFileByBytes(imageKey, imageBytes); |
| | | //2.3 下载成功,显示并缓存本地 |
| | | Application.RunOnMainThread(() => |
| | | { |
| | |
| | | else |
| | | { |
| | | //2.自定义图片,检测是否本地缓存过,没有则云端下载然后缓存 |
| | | if (!ignoreCache && FileUtils.Exists(imageKey)) |
| | | if (!ignoreCache && Common.FileUtlis.Files.Exists(imageKey)) |
| | | { |
| | | //2.1 本地有缓存并且不忽略缓存,直接本地读取 |
| | | if (frameLayout != null) |
| | |
| | | byte[] imageBytes = GetImageDownloadUrl(imageKey); |
| | | if (imageBytes != null) |
| | | { |
| | | FileUtils.WriteFileByBytes(imageKey, imageBytes); |
| | | Common.FileUtlis.Files.WriteFileByBytes(imageKey, imageBytes); |
| | | //2.3 下载成功,显示并缓存本地 |
| | | Application.RunOnMainThread(() => |
| | | { |
| | |
| | | { |
| | | 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 |
| | | { |
| | |
| | | if(imageBytes != null) |
| | | { |
| | | //保存到本地 |
| | | FileUtils.WriteFileByBytes(imageKey, imageBytes); |
| | | Common.FileUtlis.Files.WriteFileByBytes(imageKey, imageBytes); |
| | | } |
| | | |
| | | } |