释放文件流

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

View File

@@ -21,15 +21,18 @@ 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);
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<IconfontInfo> GetIconfonts(string svgJsStr, string jsonStr)
{