远程图标功能 完成
This commit is contained in:
@@ -11,7 +11,7 @@ namespace GeekDesk.Util
|
||||
public class HttpUtil
|
||||
{
|
||||
#region Get请求
|
||||
public string Get(string url)
|
||||
public static string Get(string url)
|
||||
{
|
||||
//创建Web访问对 象
|
||||
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);
|
||||
|
||||
22
Util/StringUtil.cs
Normal file
22
Util/StringUtil.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GeekDesk.Util
|
||||
{
|
||||
public class StringUtil
|
||||
{
|
||||
|
||||
|
||||
public static bool IsEmpty(string str)
|
||||
{
|
||||
if (str == null || str.Length == 0 || str.Trim().Length == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,18 @@ namespace GeekDesk.Util
|
||||
|
||||
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)
|
||||
{
|
||||
return GetIconfonts(svgJsStr, JObject.Parse(jsonStr));
|
||||
}
|
||||
|
||||
public static List<IconfontInfo> GetIconfonts(string svgJsStr, JObject json)
|
||||
{
|
||||
|
||||
svgJsStr = svgJsStr.Substring(svgJsStr.IndexOf("<svg>"),
|
||||
svgJsStr.Length - (svgJsStr.Length - (svgJsStr.IndexOf("</svg>") + "</svg>".Length)) - svgJsStr.IndexOf("<svg>"));
|
||||
@@ -34,8 +46,7 @@ namespace GeekDesk.Util
|
||||
xmlDoc.LoadXml(svgJsStr);
|
||||
XmlNodeList nodeList = xmlDoc.SelectNodes("/svg/symbol");
|
||||
|
||||
JObject jo = ReadJson(jsonStream);
|
||||
JArray ja = JArray.Parse(jo["glyphs"].ToString());
|
||||
JArray ja = JArray.Parse(json["glyphs"].ToString());
|
||||
|
||||
List<IconfontInfo> listInfo = new List<IconfontInfo>();
|
||||
for (int i = 0; i < nodeList.Count; i++)
|
||||
|
||||
Reference in New Issue
Block a user