From 7cfcdb7a90f59bf9001c948e166fd9af09752fe1 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期二, 24 五月 2022 17:15:18 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/release0123' into wjc
---
HDL_ON/Common/ImageUtlis.cs | 41 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/HDL_ON/Common/ImageUtlis.cs b/HDL_ON/Common/ImageUtlis.cs
index 918483d..fe739d5 100644
--- a/HDL_ON/Common/ImageUtlis.cs
+++ b/HDL_ON/Common/ImageUtlis.cs
@@ -466,6 +466,47 @@
}
}
+
+
+ /// <summary>
+ /// 涓嬭浇鐢ㄦ埛澶村儚
+ /// </summary>
+ /// <param name="imageUrl"></param>
+ /// <param name="ignoreCache">蹇界暐缂撳瓨</param>
+ /// <param name="regionUrl">鎸囧畾鏈嶅姟鍣ㄥ煙鍚�,浼犵┖涓轰娇鐢ㄥ綋鍓嶇敤鎴峰湴鍧�</param>
+ /// <returns></returns>
+ public byte[] DownImageByImageUrl(string imageUrl, bool ignoreCache = false)
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(imageUrl)) return null;
+
+ byte[] imageBytes;
+ if (!ignoreCache && Exists(imageUrl))
+ {
+ //鏈湴鏈夌紦瀛�
+ imageBytes = ReadFile(imageUrl);
+ }
+ else
+ {
+ //涓嬭浇
+ imageBytes = HttpUtil.HttpsDownload(imageUrl);
+ if (imageBytes != null)
+ {
+ //淇濆瓨鍒版湰鍦�
+ WriteFileByBytes(imageUrl, imageBytes);
+ }
+
+ }
+ return imageBytes;
+ }
+ catch
+ {
+ return null;
+ }
+ }
+
+
#endregion
}
}
--
Gitblit v1.8.0