Main页面
This commit is contained in:
1 parent
a003d90b0e
commit
f03e2b08f4
33 files changed
+54543
-34
No files matched your search
@@ -0,0 +1,65 @@
|
||||
<#@ template debug="false" hostspecific="true" language="C#" #>
|
||||
<#@ assembly name="System.Core" #>
|
||||
<#@ import namespace="System.Linq" #>
|
||||
<#@ import namespace="System.IO" #>
|
||||
<#@ import namespace="System.Text" #>
|
||||
<#@ import namespace="System.Collections.Generic" #>
|
||||
<#@ import namespace="System.Text.RegularExpressions" #>
|
||||
<#@ output extension=".xaml" encoding="utf-8" #>
|
||||
|
||||
<#
|
||||
|
||||
StringBuilder FontString = new StringBuilder();
|
||||
FontString.AppendLine("<ResourceDictionary");
|
||||
FontString.AppendLine("\txmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"");
|
||||
FontString.AppendLine("\txmlns:PresentationOptions=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation/options\"");
|
||||
FontString.AppendLine("\txmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"");
|
||||
FontString.AppendLine("\txmlns:sys=\"clr-namespace:System;assembly=mscorlib\"");
|
||||
FontString.AppendLine("\t>");
|
||||
FontString.AppendLine("");
|
||||
FontString.AppendLine("");
|
||||
|
||||
string cssPath = this.Host.ResolvePath("iconfont.css");
|
||||
string svgPath = this.Host.ResolvePath("iconfont.js");
|
||||
|
||||
if (File.Exists(cssPath))
|
||||
{
|
||||
string cssContent = File.ReadAllText(cssPath, Encoding.UTF8);
|
||||
MatchCollection matchs = Regex.Matches(cssContent, "\\.icon-(?<name>.+?):before.+?\\{.+?content:.+?\"\\\\(?<value>e.+?)\";.+?\\}", RegexOptions.Singleline);
|
||||
foreach (Match match in matchs)
|
||||
{
|
||||
string name = match.Groups["name"].Value;
|
||||
//name = Regex.Replace(name,"(a-(\\d{4,}(.*)?_fluent_|SegoeFluentIconsRegular-))|(_regular_icon|$)","",RegexOptions.Singleline);
|
||||
string value = match.Groups["value"].Value;
|
||||
FontString.AppendLine(string.Format("\t<sys:String x:Key=\"txt-{0}\">&#x{1};</sys:String>", name, value));
|
||||
}
|
||||
}
|
||||
if (File.Exists(svgPath))
|
||||
{
|
||||
FontString.AppendLine("");
|
||||
FontString.AppendLine("");
|
||||
|
||||
string svgContent = File.ReadAllText(svgPath, Encoding.UTF8);
|
||||
MatchCollection matchs = Regex.Matches(svgContent, "<symbol.+?id=\"(?<name>.+?)\".+?>(?<value>.+?)</symbol>");
|
||||
foreach (Match match in matchs)
|
||||
{
|
||||
string name = match.Groups["name"].Value;
|
||||
string symbol = match.Groups["value"].Value;
|
||||
StringBuilder value =new StringBuilder();
|
||||
MatchCollection pathMatchs = Regex.Matches(symbol,"<path.+?d=\"(?<value>.+?)\"");
|
||||
foreach(Match pathMatch in pathMatchs)
|
||||
{
|
||||
value.AppendLine("\t\t"+pathMatch.Groups["value"].Value);
|
||||
}
|
||||
FontString.AppendLine(string.Format("\t<Geometry x:Key=\"{0}\" PresentationOptions:Freeze=\"True\">\n{1}\t</Geometry>", name, value));
|
||||
}
|
||||
}
|
||||
FontString.AppendLine("");
|
||||
FontString.AppendLine("");
|
||||
FontString.AppendLine("</ResourceDictionary>");
|
||||
string content = FontString.ToString();
|
||||
string savePath =Path.Combine(this.Host.ResolvePath(""),@"..\Themes\FontGeometry.xaml");
|
||||
//File.WriteAllText(savePath,content,Encoding.UTF8);
|
||||
#>
|
||||
<#=content#>
|
||||
|
||||
Reference in new issue
Block a user