From 19c8ff9d8d7b7df9dee4aa6b0c80bce63fef49f8 Mon Sep 17 00:00:00 2001 From: liufei Date: Wed, 5 Jan 2022 11:56:56 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8A=E6=94=BE=E6=96=87=E4=BB=B6=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Util/SvgToGeometry.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Util/SvgToGeometry.cs b/Util/SvgToGeometry.cs index 55f5d91..58803b5 100644 --- a/Util/SvgToGeometry.cs +++ b/Util/SvgToGeometry.cs @@ -21,14 +21,17 @@ namespace GeekDesk.Util string svgPath = "/GeekDesk;component/Resource/Iconfont/iconfont.js"; string jsonPath = "/GeekDesk;component/Resource/Iconfont/iconfont.json"; - Stream svgStream = Application.GetResourceStream(new Uri(svgPath, UriKind.Relative)).Stream; - Stream jsonStream = Application.GetResourceStream(new Uri(jsonPath, UriKind.Relative)).Stream; - StreamReader streamReader = new StreamReader(svgStream); - string svgJsStr = streamReader.ReadToEnd(); - JObject jo = ReadJson(jsonStream); - - return GetIconfonts(svgJsStr, jo); + using (Stream svgStream = Application.GetResourceStream(new Uri(svgPath, UriKind.Relative)).Stream, + jsonStream = Application.GetResourceStream(new Uri(jsonPath, UriKind.Relative)).Stream) + { + using (StreamReader streamReader = new StreamReader(svgStream)) + { + string svgJsStr = streamReader.ReadToEnd(); + JObject jo = ReadJson(jsonStream); + return GetIconfonts(svgJsStr, jo); + } + } } public static List GetIconfonts(string svgJsStr, string jsonStr)