释放文件流

This commit is contained in:
liufei
2022-01-05 11:56:56 +08:00
parent e3a85e42fa
commit 19c8ff9d8d

View File

@@ -21,14 +21,17 @@ namespace GeekDesk.Util
string svgPath = "/GeekDesk;component/Resource/Iconfont/iconfont.js"; string svgPath = "/GeekDesk;component/Resource/Iconfont/iconfont.js";
string jsonPath = "/GeekDesk;component/Resource/Iconfont/iconfont.json"; 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); using (Stream svgStream = Application.GetResourceStream(new Uri(svgPath, UriKind.Relative)).Stream,
string svgJsStr = streamReader.ReadToEnd(); jsonStream = Application.GetResourceStream(new Uri(jsonPath, UriKind.Relative)).Stream)
JObject jo = ReadJson(jsonStream); {
using (StreamReader streamReader = new StreamReader(svgStream))
return GetIconfonts(svgJsStr, jo); {
string svgJsStr = streamReader.ReadToEnd();
JObject jo = ReadJson(jsonStream);
return GetIconfonts(svgJsStr, jo);
}
}
} }
public static List<IconfontInfo> GetIconfonts(string svgJsStr, string jsonStr) public static List<IconfontInfo> GetIconfonts(string svgJsStr, string jsonStr)