<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <TargetFramework>netstandard2.0</TargetFramework>
+ <TargetFrameworks>netstandard2.0</TargetFrameworks>
<AssemblyVersion>$(CrowVersion)</AssemblyVersion>
<ReleaseVersion>$(CrowVersion)</ReleaseVersion>
<PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.6.0" />
<!--<PackageReference Include="glfw-sharp" Version="0.2.0" />-->
<!-- <PackageReference Include="glfw-sharp" Version="0.2.5" />-->
+ <PackageReference Include="FastEnum" Version="1.5.3" />
</ItemGroup>
<PropertyGroup Condition=" '$(CrowStbSharp)' == 'true'">
<DefineConstants>$(DefineConstants);STB_SHARP</DefineConstants>
using System;
using System.Collections.Generic;
using System.Linq;
+using FastEnumUtility;
namespace Crow
{
=> value.GetHashCode ();
public override string ToString()
- => Enum.IsDefined (typeof (Colors), value) ? ((Colors)value).ToString () : HtmlCode;
+ => FastEnum.IsDefined<Colors> (value) ? FastEnum.GetName((Colors)value) : HtmlCode;
public static Color FromIml (string iml)
{
=> (string.IsNullOrEmpty (s)) ? new Color (Colors.White) :
(s.StartsWith ("#", StringComparison.Ordinal)) ? new Color (UInt32.Parse (s.Substring (1), System.Globalization.NumberStyles.HexNumber)) :
(char.IsDigit(s[0])) ? FromIml (s) :
- (Enum.TryParse<Colors> (s, out Colors cc)) ? new Color(cc) :
+ (FastEnum.TryParse<Colors> (s, out Colors cc)) ? new Color(cc) :
throw new Exception ("Unknown color name: " + s);
using System;
using Crow.Cairo;
+using FastEnumUtility;
namespace Crow
{
f.Name = n [0];
if (n.Length > 1)
- f.Style = (FontStyle)Enum.Parse (typeof(FontStyle), n[n.Length-1], true);
+ f.Style = FastEnum.Parse<FontStyle> (n[n.Length-1], true);
}
return f;
using System.Xml;
using Crow.IML;
using System.Text;
+using FastEnumUtility;
namespace Crow.IML
{
using System.Linq;
using System.Text;
using System.IO;
+using FastEnumUtility;
namespace Crow
{
ClearChildren ();
stretchedChild = null;
int i = 0;
- Orientation = (Orientation)Enum.Parse (typeof(Orientation), getConfAttrib (conf, ref i));
+ Orientation = FastEnum.Parse<Orientation> (getConfAttrib (conf, ref i));
importConfig (conf, ref i, dataSource);
}
}
dw.Name = wName;
dw.Width = Measure.Parse (getConfAttrib (conf, ref i));
dw.Height = Measure.Parse (getConfAttrib (conf, ref i));
- dw.DockingPosition = (Alignment)Enum.Parse (typeof(Alignment), getConfAttrib (conf, ref i));
+ dw.DockingPosition = FastEnum.Parse<Alignment> (getConfAttrib (conf, ref i));
dw.savedSlot = Rectangle.Parse (getConfAttrib (conf, ref i));
dw.wasResizable = Boolean.Parse (getConfAttrib (conf, ref i));
DockStack ds = new DockStack (IFace);
ds.Width = Measure.Parse (getConfAttrib (conf, ref i));
ds.Height = Measure.Parse (getConfAttrib (conf, ref i));
- ds.Orientation = (Orientation)Enum.Parse (typeof(Orientation), getConfAttrib (conf, ref i));
+ ds.Orientation = FastEnum.Parse<Orientation> (getConfAttrib (conf, ref i));
this.AddChild (ds);
void testDir (string dirPath, int level = 0)
{
- Console.WriteLine ($"{new string (' ', level * 4)}-{dirPath}");
+ Console.WriteLine ($"{new string (' ', level * 4)}- {dirPath}");
level++;
foreach (string d in Directory.GetDirectories (dirPath))
foreach (string f in Directory.GetFiles (dirPath)) {
try {
long mean = Test (f, out long min, out long max);
- Console.WriteLine ($"{new string (' ', level * 4)}{ Path.GetFileName (f),-30}: {min,5} |{mean,5} |{max,5}");
+ Console.WriteLine ($"{new string (' ', level * 4)}{ Path.GetFileName (f),-30}|{min,5}|{mean,5}|{max,5}");
} catch (Exception ex) {
Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine ($"{ex.Message}");
+ Console.WriteLine ($"- {ex.Message}");
Console.ResetColor ();
}
}