Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Commit

Permalink
code generation made easy
Browse files Browse the repository at this point in the history
  • Loading branch information
thudugala committed Aug 4, 2019
1 parent 65cd892 commit 8d2e9c0
Show file tree
Hide file tree
Showing 17 changed files with 165 additions and 120 deletions.
9 changes: 5 additions & 4 deletions Source/Plugin.Glypher.FontAwesome5Free/GlyphListBrand.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace Plugin.Glypher.FontAwesome5Free
namespace Plugin.Glypher.FontAwesome5Free
{
/// <summary>
/// Font Awesome Pro 5.10.0
/// Font Awesome Free 5.10.0
/// </summary>
public static class GlyphListBrand
{
Expand Down Expand Up @@ -436,7 +436,8 @@ public static class GlyphListBrand
public static readonly GlyphInfo Fab_Youtube = new GlyphInfo { Name = "fab-youtube", Glyph = "\uf167", FontFamily = GlyphFont.Current.Brand };
public static readonly GlyphInfo Fab_Youtube_Square = new GlyphInfo { Name = "fab-youtube-square", Glyph = "\uf431", FontFamily = GlyphFont.Current.Brand };
public static readonly GlyphInfo Fab_Zhihu = new GlyphInfo { Name = "fab-zhihu", Glyph = "\uf63f", FontFamily = GlyphFont.Current.Brand };
#pragma warning restore 1591

#pragma warning restore CA1707
#pragma warning restore 1591
}
}
}
9 changes: 5 additions & 4 deletions Source/Plugin.Glypher.FontAwesome5Free/GlyphListRegular.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace Plugin.Glypher.FontAwesome5Free
namespace Plugin.Glypher.FontAwesome5Free
{
/// <summary>
/// Font Awesome Pro 5.10.0
/// Font Awesome Free 5.10.0
/// </summary>
public static class GlyphListRegular
{
Expand Down Expand Up @@ -159,7 +159,8 @@ public static class GlyphListRegular
public static readonly GlyphInfo Far_Window_Maximize = new GlyphInfo { Name = "far-window-maximize", Glyph = "\uf2d0", FontFamily = GlyphFont.Current.Regular };
public static readonly GlyphInfo Far_Window_Minimize = new GlyphInfo { Name = "far-window-minimize", Glyph = "\uf2d1", FontFamily = GlyphFont.Current.Regular };
public static readonly GlyphInfo Far_Window_Restore = new GlyphInfo { Name = "far-window-restore", Glyph = "\uf2d2", FontFamily = GlyphFont.Current.Regular };
#pragma warning restore 1591

#pragma warning restore CA1707
#pragma warning restore 1591
}
}
}
9 changes: 5 additions & 4 deletions Source/Plugin.Glypher.FontAwesome5Free/GlyphListSolid.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace Plugin.Glypher.FontAwesome5Free
namespace Plugin.Glypher.FontAwesome5Free
{
/// <summary>
/// Font Awesome Pro 5.10.0
/// Font Awesome Free 5.10.0
/// </summary>
public static class GlyphListSolid
{
Expand Down Expand Up @@ -964,7 +964,8 @@ public static class GlyphListSolid
public static readonly GlyphInfo Fas_X_Ray = new GlyphInfo { Name = "fas-x-ray", Glyph = "\uf497", FontFamily = GlyphFont.Current.Solid };
public static readonly GlyphInfo Fas_Yen_Sign = new GlyphInfo { Name = "fas-yen-sign", Glyph = "\uf157", FontFamily = GlyphFont.Current.Solid };
public static readonly GlyphInfo Fas_Yin_Yang = new GlyphInfo { Name = "fas-yin-yang", Glyph = "\uf6ad", FontFamily = GlyphFont.Current.Solid };
#pragma warning restore 1591

#pragma warning restore CA1707
#pragma warning restore 1591
}
}
}
7 changes: 5 additions & 2 deletions Source/Plugin.Glypher.FontAwesome5Pro/GlyphListBrand.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
namespace Plugin.Glypher.FontAwesome5Pro
namespace Plugin.Glypher.FontAwesome5Pro
{
/// <summary>
/// Font Awesome Pro 5.10.0
/// </summary>
public static class GlyphListBrand
{
#pragma warning disable 1591
#pragma warning disable CA1707
public static readonly GlyphInfo Fab_500Px = new GlyphInfo { Name = "fab-500px", Glyph = "\uf26e", FontFamily = GlyphFont.Current.Brand };
public static readonly GlyphInfo Fab_Accessible_Icon = new GlyphInfo { Name = "fab-accessible-icon", Glyph = "\uf368", FontFamily = GlyphFont.Current.Brand };
public static readonly GlyphInfo Fab_Accusoft = new GlyphInfo { Name = "fab-accusoft", Glyph = "\uf369", FontFamily = GlyphFont.Current.Brand };
Expand Down Expand Up @@ -435,6 +436,8 @@ public static class GlyphListBrand
public static readonly GlyphInfo Fab_Youtube = new GlyphInfo { Name = "fab-youtube", Glyph = "\uf167", FontFamily = GlyphFont.Current.Brand };
public static readonly GlyphInfo Fab_Youtube_Square = new GlyphInfo { Name = "fab-youtube-square", Glyph = "\uf431", FontFamily = GlyphFont.Current.Brand };
public static readonly GlyphInfo Fab_Zhihu = new GlyphInfo { Name = "fab-zhihu", Glyph = "\uf63f", FontFamily = GlyphFont.Current.Brand };

#pragma warning restore CA1707
#pragma warning restore 1591
}
}
}
13 changes: 6 additions & 7 deletions Source/Plugin.Glypher.FontAwesome5Pro/GlyphListDuotone.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
namespace Plugin.Glypher.FontAwesome5Pro
namespace Plugin.Glypher.FontAwesome5Pro
{
/// <summary>
/// Font Awesome Pro 5.10.0
/// </summary>

public class GlyphListDuotone
public static class GlyphListDuotone
{
#pragma warning disable 1591

// Duotone
#pragma warning disable CA1707
public static readonly GlyphInfo Fad_Abacus = new GlyphInfo { Name = "fad-abacus", Glyph = "\uf640", FontFamily = GlyphFont.Current.Duotone };

public static readonly GlyphInfo Fad_Acorn = new GlyphInfo { Name = "fad-acorn", Glyph = "\uf6ae", FontFamily = GlyphFont.Current.Duotone };
public static readonly GlyphInfo Fad_Ad = new GlyphInfo { Name = "fad-ad", Glyph = "\uf641", FontFamily = GlyphFont.Current.Duotone };
public static readonly GlyphInfo Fad_Address_Book = new GlyphInfo { Name = "fad-address-book", Glyph = "\uf2b9", FontFamily = GlyphFont.Current.Duotone };
Expand Down Expand Up @@ -1655,6 +1652,8 @@ public class GlyphListDuotone
public static readonly GlyphInfo Fad_X_Ray = new GlyphInfo { Name = "fad-x-ray", Glyph = "\uf497", FontFamily = GlyphFont.Current.Duotone };
public static readonly GlyphInfo Fad_Yen_Sign = new GlyphInfo { Name = "fad-yen-sign", Glyph = "\uf157", FontFamily = GlyphFont.Current.Duotone };
public static readonly GlyphInfo Fad_Yin_Yang = new GlyphInfo { Name = "fad-yin-yang", Glyph = "\uf6ad", FontFamily = GlyphFont.Current.Duotone };

#pragma warning restore CA1707
#pragma warning restore 1591
}
}
}
7 changes: 5 additions & 2 deletions Source/Plugin.Glypher.FontAwesome5Pro/GlyphListLight.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
namespace Plugin.Glypher.FontAwesome5Pro
namespace Plugin.Glypher.FontAwesome5Pro
{
/// <summary>
/// Font Awesome Pro 5.10.0
/// </summary>
public static class GlyphListLight
{
#pragma warning disable 1591
#pragma warning disable CA1707
public static readonly GlyphInfo Fal_Abacus = new GlyphInfo { Name = "fal-abacus", Glyph = "\uf640", FontFamily = GlyphFont.Current.Light };
public static readonly GlyphInfo Fal_Acorn = new GlyphInfo { Name = "fal-acorn", Glyph = "\uf6ae", FontFamily = GlyphFont.Current.Light };
public static readonly GlyphInfo Fal_Ad = new GlyphInfo { Name = "fal-ad", Glyph = "\uf641", FontFamily = GlyphFont.Current.Light };
Expand Down Expand Up @@ -1655,6 +1656,8 @@ public static class GlyphListLight
public static readonly GlyphInfo Fal_X_Ray = new GlyphInfo { Name = "fal-x-ray", Glyph = "\uf497", FontFamily = GlyphFont.Current.Light };
public static readonly GlyphInfo Fal_Yen_Sign = new GlyphInfo { Name = "fal-yen-sign", Glyph = "\uf157", FontFamily = GlyphFont.Current.Light };
public static readonly GlyphInfo Fal_Yin_Yang = new GlyphInfo { Name = "fal-yin-yang", Glyph = "\uf6ad", FontFamily = GlyphFont.Current.Light };

#pragma warning restore CA1707
#pragma warning restore 1591
}
}
}
7 changes: 5 additions & 2 deletions Source/Plugin.Glypher.FontAwesome5Pro/GlyphListRegular.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
namespace Plugin.Glypher.FontAwesome5Pro
namespace Plugin.Glypher.FontAwesome5Pro
{
/// <summary>
/// Font Awesome Pro 5.10.0
/// </summary>
public static class GlyphListRegular
{
#pragma warning disable 1591
#pragma warning disable CA1707
public static readonly GlyphInfo Far_Abacus = new GlyphInfo { Name = "far-abacus", Glyph = "\uf640", FontFamily = GlyphFont.Current.Regular };
public static readonly GlyphInfo Far_Acorn = new GlyphInfo { Name = "far-acorn", Glyph = "\uf6ae", FontFamily = GlyphFont.Current.Regular };
public static readonly GlyphInfo Far_Ad = new GlyphInfo { Name = "far-ad", Glyph = "\uf641", FontFamily = GlyphFont.Current.Regular };
Expand Down Expand Up @@ -1655,6 +1656,8 @@ public static class GlyphListRegular
public static readonly GlyphInfo Far_X_Ray = new GlyphInfo { Name = "far-x-ray", Glyph = "\uf497", FontFamily = GlyphFont.Current.Regular };
public static readonly GlyphInfo Far_Yen_Sign = new GlyphInfo { Name = "far-yen-sign", Glyph = "\uf157", FontFamily = GlyphFont.Current.Regular };
public static readonly GlyphInfo Far_Yin_Yang = new GlyphInfo { Name = "far-yin-yang", Glyph = "\uf6ad", FontFamily = GlyphFont.Current.Regular };

#pragma warning restore CA1707
#pragma warning restore 1591
}
}
}
7 changes: 5 additions & 2 deletions Source/Plugin.Glypher.FontAwesome5Pro/GlyphListSolid.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
namespace Plugin.Glypher.FontAwesome5Pro
namespace Plugin.Glypher.FontAwesome5Pro
{
/// <summary>
/// Font Awesome Pro 5.10.0
/// </summary>
public static class GlyphListSolid
{
#pragma warning disable 1591
#pragma warning disable CA1707
public static readonly GlyphInfo Fas_Abacus = new GlyphInfo { Name = "fas-abacus", Glyph = "\uf640", FontFamily = GlyphFont.Current.Solid };
public static readonly GlyphInfo Fas_Acorn = new GlyphInfo { Name = "fas-acorn", Glyph = "\uf6ae", FontFamily = GlyphFont.Current.Solid };
public static readonly GlyphInfo Fas_Ad = new GlyphInfo { Name = "fas-ad", Glyph = "\uf641", FontFamily = GlyphFont.Current.Solid };
Expand Down Expand Up @@ -1655,6 +1656,8 @@ public static class GlyphListSolid
public static readonly GlyphInfo Fas_X_Ray = new GlyphInfo { Name = "fas-x-ray", Glyph = "\uf497", FontFamily = GlyphFont.Current.Solid };
public static readonly GlyphInfo Fas_Yen_Sign = new GlyphInfo { Name = "fas-yen-sign", Glyph = "\uf157", FontFamily = GlyphFont.Current.Solid };
public static readonly GlyphInfo Fas_Yin_Yang = new GlyphInfo { Name = "fas-yin-yang", Glyph = "\uf6ad", FontFamily = GlyphFont.Current.Solid };

#pragma warning restore CA1707
#pragma warning restore 1591
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.4" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-19367-01" PrivateAssets="All" />
<PackageReference Include="Plugin.Glypher" Version="1.0.1" />
</ItemGroup>
Expand Down
4 changes: 3 additions & 1 deletion Source/Plugin.Glypher.WeatherIcons/GlyphList.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
namespace Plugin.Glypher.WeatherIcons
namespace Plugin.Glypher.WeatherIcons
{
/// <summary>
/// Weather Icons 2.0.10
/// </summary>
public static class GlyphList
{
#pragma warning disable 1591
#pragma warning disable CA1707
public static readonly GlyphInfo Wi_Day_Sunny = new GlyphInfo { Name = "wi-day-sunny", Glyph = "\uf00d", FontFamily = GlyphFont.Current.WI };
public static readonly GlyphInfo Wi_Day_Cloudy = new GlyphInfo { Name = "wi-day-cloudy", Glyph = "\uf002", FontFamily = GlyphFont.Current.WI };
public static readonly GlyphInfo Wi_Day_Cloudy_Gusts = new GlyphInfo { Name = "wi-day-cloudy-gusts", Glyph = "\uf000", FontFamily = GlyphFont.Current.WI };
Expand Down Expand Up @@ -603,6 +604,7 @@ public static class GlyphList
public static readonly GlyphInfo Wi_Wu_Tstorms = new GlyphInfo { Name = "wi-wu-tstorms", Glyph = "\uf01e", FontFamily = GlyphFont.Current.WI };
public static readonly GlyphInfo Wi_Wu_Unknown = new GlyphInfo { Name = "wi-wu-unknown", Glyph = "\uf00d", FontFamily = GlyphFont.Current.WI };

#pragma warning restore CA1707
#pragma warning restore 1591
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.4" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-19367-01" PrivateAssets="All" />
<PackageReference Include="Plugin.Glypher" Version="1.0.1" />
</ItemGroup>

</Project>
</Project>
45 changes: 27 additions & 18 deletions tools/GlyphFieldsGenerator/GlyphFieldsFontAwesome5Free/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,39 @@ internal class Program
{
private static void Main(string[] args)
{
var reader = new StreamReader(@"icons.json");

var iconJson = IconJson.FromJson(reader.ReadToEnd());
var iconList = new List<Icon>();
foreach (var icon in iconJson)
using (var reader = new StreamReader(@"icons.json"))
{
iconList.AddRange(icon.Value.Styles.Select(styles => new Icon { IconType = styles, Label = icon.Key, Unicode = icon.Value.Unicode }));
}
var iconJson = IconJson.FromJson(reader.ReadToEnd());
var iconList = new List<Icon>();
foreach (var icon in iconJson)
{
iconList.AddRange(icon.Value.Styles.Select(styles =>
new Icon { IconType = styles, Label = icon.Key, Unicode = icon.Value.Unicode }));
}

using (var file = new StreamWriter(@"iconsBrands.text"))
{
FieldGenerator.Current.WriteLine(file, "Brands",
const string folderPath = @"..\..\..\..\..\..\Source\Plugin.Glypher.FontAwesome5Free";
const string libName = @"Font Awesome Free 5.10.0";
const string libNamespace = @"FontAwesome5Free";

FieldGenerator.Write(
folderPath,
"Brand",
libName,
libNamespace,
iconList.Where(i => i.IconType == Free.Brands).Cast<GlyphField>().ToList());
}

using (var file = new StreamWriter(@"iconsRegular.text"))
{
FieldGenerator.Current.WriteLine(file, "Regular",
FieldGenerator.Write(
folderPath,
"Regular",
libName,
libNamespace,
iconList.Where(i => i.IconType == Free.Regular).Cast<GlyphField>().ToList());
}

using (var file = new StreamWriter(@"iconsSolid.text"))
{
FieldGenerator.Current.WriteLine(file, "Solid",
FieldGenerator.Write(
folderPath,
"Solid",
libName,
libNamespace,
iconList.Where(i => i.IconType == Free.Solid).Cast<GlyphField>().ToList());
}
}
Expand Down
68 changes: 39 additions & 29 deletions tools/GlyphFieldsGenerator/GlyphFieldsFontAwesome5Pro/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,45 +9,55 @@ internal class Program
{
private static void Main(string[] args)
{
var reader = new StreamReader(@"icons.json");

var iconJson = IconJson.FromJson(reader.ReadToEnd());
var iconList = new List<Icon>();
foreach (var icon in iconJson)
using (var reader = new StreamReader(@"icons.json"))
{
iconList.AddRange(icon.Value.Styles.Select(styles =>
new Icon { IconType = styles, Label = icon.Key, Unicode = icon.Value.Unicode }));
}
var iconJson = IconJson.FromJson(reader.ReadToEnd());
var iconList = new List<Icon>();
foreach (var icon in iconJson)
{
iconList.AddRange(icon.Value.Styles.Select(styles =>
new Icon { IconType = styles, Label = icon.Key, Unicode = icon.Value.Unicode }));
}

using (var file = new StreamWriter(@"iconsBrands.text"))
{
FieldGenerator.Current.WriteLine(file, "Brands",
const string folderPath = @"..\..\..\..\..\..\Source\Plugin.Glypher.FontAwesome5Pro";
const string libName = @"Font Awesome Pro 5.10.0";
const string libNamespace = @"FontAwesome5Pro";

FieldGenerator.Write(
folderPath,
"Brand",
libName,
libNamespace,
iconList.Where(i => i.IconType == Free.Brands).Cast<GlyphField>().ToList());
}

using (var file = new StreamWriter(@"iconsLight.text"))
{
FieldGenerator.Current.WriteLine(file, "Light",
FieldGenerator.Write(
folderPath,
"Duotone",
libName,
libNamespace,
iconList.Where(i => i.IconType == Free.Duotone).Cast<GlyphField>().ToList());

FieldGenerator.Write(
folderPath,
"Light",
libName,
libNamespace,
iconList.Where(i => i.IconType == Free.Light).Cast<GlyphField>().ToList());
}

using (var file = new StreamWriter(@"iconsRegular.text"))
{
FieldGenerator.Current.WriteLine(file, "Regular",
FieldGenerator.Write(
folderPath,
"Regular",
libName,
libNamespace,
iconList.Where(i => i.IconType == Free.Regular).Cast<GlyphField>().ToList());
}

using (var file = new StreamWriter(@"iconsSolid.text"))
{
FieldGenerator.Current.WriteLine(file, "Solid",
FieldGenerator.Write(
folderPath,
"Solid",
libName,
libNamespace,
iconList.Where(i => i.IconType == Free.Solid).Cast<GlyphField>().ToList());
}

using (var file = new StreamWriter(@"iconsDuotone.text"))
{
FieldGenerator.Current.WriteLine(file, "Duotone",
iconList.Where(i => i.IconType == Free.Duotone).Cast<GlyphField>().ToList());
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=Duotone/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Glypher/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
Loading

0 comments on commit 8d2e9c0

Please sign in to comment.