Skip to content

Commit 1745a83

Browse files
committed
adding the portable version
1 parent f3aff1a commit 1745a83

File tree

9 files changed

+104
-18
lines changed

9 files changed

+104
-18
lines changed

Src/Era.Facts/Era.Facts.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@
6363
<None Include="packages.config" />
6464
</ItemGroup>
6565
<ItemGroup>
66-
<ProjectReference Include="..\Era\Era.csproj">
66+
<ProjectReference Include="..\Era\Era.Net45.csproj">
6767
<Project>{3949F194-D1BF-41A7-8130-CD2A0F018055}</Project>
68-
<Name>NaturalDate</Name>
68+
<Name>Era.Net45</Name>
6969
</ProjectReference>
7070
</ItemGroup>
7171
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

Src/Era.sln

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 14
44
VisualStudioVersion = 14.0.25123.0
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Era", "Era\Era.csproj", "{3949F194-D1BF-41A7-8130-CD2A0F018055}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Era.Net45", "Era\Era.Net45.csproj", "{3949F194-D1BF-41A7-8130-CD2A0F018055}"
77
EndProject
88
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Era.Facts", "Era.Facts\Era.Facts.csproj", "{58E904DD-7A87-4F9E-911D-875D074D2734}"
99
EndProject
1010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp", "TestApp\TestApp.csproj", "{C129836D-60C3-4023-BB67-D280A2F23C79}"
1111
EndProject
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Era.Portable-Net45+WinRT45+WP8+WPA81", "Era\Era.Portable-Net45+WinRT45+WP8+WPA81.csproj", "{6373128A-1E69-4B4F-A5F5-B848ABD6C441}"
13+
EndProject
1214
Global
1315
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1416
Debug|Any CPU = Debug|Any CPU
@@ -27,6 +29,10 @@ Global
2729
{C129836D-60C3-4023-BB67-D280A2F23C79}.Debug|Any CPU.Build.0 = Debug|Any CPU
2830
{C129836D-60C3-4023-BB67-D280A2F23C79}.Release|Any CPU.ActiveCfg = Release|Any CPU
2931
{C129836D-60C3-4023-BB67-D280A2F23C79}.Release|Any CPU.Build.0 = Release|Any CPU
32+
{6373128A-1E69-4B4F-A5F5-B848ABD6C441}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33+
{6373128A-1E69-4B4F-A5F5-B848ABD6C441}.Debug|Any CPU.Build.0 = Debug|Any CPU
34+
{6373128A-1E69-4B4F-A5F5-B848ABD6C441}.Release|Any CPU.ActiveCfg = Release|Any CPU
35+
{6373128A-1E69-4B4F-A5F5-B848ABD6C441}.Release|Any CPU.Build.0 = Release|Any CPU
3036
EndGlobalSection
3137
GlobalSection(SolutionProperties) = preSolution
3238
HideSolutionNode = FALSE

Src/Era/Era.csproj renamed to Src/Era/Era.Net45.csproj

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<DebugSymbols>true</DebugSymbols>
1919
<DebugType>full</DebugType>
2020
<Optimize>false</Optimize>
21-
<OutputPath>bin\Debug\</OutputPath>
21+
<OutputPath>bin\Debug\Net45\</OutputPath>
2222
<DefineConstants>DEBUG;TRACE</DefineConstants>
2323
<ErrorReport>prompt</ErrorReport>
2424
<WarningLevel>4</WarningLevel>
@@ -27,7 +27,7 @@
2727
<PlatformTarget>AnyCPU</PlatformTarget>
2828
<DebugType>pdbonly</DebugType>
2929
<Optimize>true</Optimize>
30-
<OutputPath>bin\Release\</OutputPath>
30+
<OutputPath>bin\Release\Net45\</OutputPath>
3131
<DefineConstants>TRACE</DefineConstants>
3232
<ErrorReport>prompt</ErrorReport>
3333
<WarningLevel>4</WarningLevel>
@@ -63,6 +63,9 @@
6363
<None Include="App.config" />
6464
</ItemGroup>
6565
<ItemGroup>
66+
<None Include="Era.nuspec">
67+
<SubType>Designer</SubType>
68+
</None>
6669
<None Include="grammar.bnf" />
6770
</ItemGroup>
6871
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
6+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8+
<ProjectGuid>{6373128A-1E69-4B4F-A5F5-B848ABD6C441}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>Era</RootNamespace>
12+
<AssemblyName>Era</AssemblyName>
13+
<DefaultLanguage>en-US</DefaultLanguage>
14+
<FileAlignment>512</FileAlignment>
15+
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
16+
<TargetFrameworkProfile>Profile111</TargetFrameworkProfile>
17+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
18+
</PropertyGroup>
19+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
20+
<DebugSymbols>true</DebugSymbols>
21+
<DebugType>full</DebugType>
22+
<Optimize>false</Optimize>
23+
<OutputPath>bin\Debug\Portable-Net45+WinRT45+WP8+WPA81\</OutputPath>
24+
<DefineConstants>DEBUG;TRACE</DefineConstants>
25+
<ErrorReport>prompt</ErrorReport>
26+
<WarningLevel>4</WarningLevel>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
29+
<DebugType>pdbonly</DebugType>
30+
<Optimize>true</Optimize>
31+
<OutputPath>bin\Release\Portable-Net45+WinRT45+WP8+WPA81\</OutputPath>
32+
<DefineConstants>TRACE</DefineConstants>
33+
<ErrorReport>prompt</ErrorReport>
34+
<WarningLevel>4</WarningLevel>
35+
</PropertyGroup>
36+
<ItemGroup>
37+
<!-- A reference to the entire .NET Framework is automatically included -->
38+
<None Include="Era.nuspec" />
39+
<None Include="grammar.bnf" />
40+
</ItemGroup>
41+
<ItemGroup>
42+
<Compile Include="DateTimeBuilder.cs" />
43+
<Compile Include="IDateTimeBuilder.cs" />
44+
<Compile Include="ParseContext.cs" />
45+
<Compile Include="Parser.cs" />
46+
<Compile Include="Properties\AssemblyInfo.cs" />
47+
<Compile Include="Text\StringTokenReader.cs" />
48+
<Compile Include="Text\Token.cs" />
49+
<Compile Include="Text\TokenEnumerator.cs" />
50+
<Compile Include="Text\TokenKind.cs" />
51+
<Compile Include="Text\TokenReader.cs" />
52+
<Compile Include="TokenExtensions.cs" />
53+
<Compile Include="TokenParser.cs" />
54+
</ItemGroup>
55+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
56+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
57+
Other similar extension points exist, see Microsoft.Common.targets.
58+
<Target Name="BeforeBuild">
59+
</Target>
60+
<Target Name="AfterBuild">
61+
</Target>
62+
-->
63+
</Project>

Src/Era/Era.nuspec

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
3+
<metadata>
4+
<id>Era</id>
5+
<title>Era</title>
6+
<version>1.0.0</version>
7+
<authors>Cain O'Sullivan</authors>
8+
<projectUrl>https://github.com/cosullivan/Era</projectUrl>
9+
<description>A natural language date &amp; time parsing library for .NET.</description>
10+
</metadata>
11+
<files>
12+
<file src="bin\Release\Net45\Era.dll" target="lib\Net45" />
13+
<file src="bin\Release\Portable-Net45+WinRT45+WP8+WPA81\Era.dll" target="lib\Portable-Net45+NetCore45+WP8+WPA81" />
14+
</files>
15+
</package>

Src/Era/Text/Token.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Diagnostics;
3-
using System.Globalization;
43

54
namespace Era.Text
65
{
@@ -39,7 +38,7 @@ public Token(TokenKind kind, string text) : this()
3938
/// <param name="ch">The character to create the token from.</param>
4039
public Token(TokenKind kind, char ch) : this()
4140
{
42-
Text = ch.ToString(CultureInfo.InvariantCulture);
41+
Text = ch.ToString();
4342
Kind = kind;
4443
}
4544

@@ -50,7 +49,7 @@ public Token(TokenKind kind, char ch) : this()
5049
/// <returns>true if <paramref name="other"/> and this instance are the same type and represent the same value; otherwise, false. </returns>
5150
public bool Equals(Token other)
5251
{
53-
return Kind == other.Kind && String.Equals(Text, other.Text, StringComparison.InvariantCultureIgnoreCase);
52+
return Kind == other.Kind && String.Equals(Text, other.Text, StringComparison.OrdinalIgnoreCase);
5453
}
5554

5655
/// <summary>
@@ -78,7 +77,7 @@ public override int GetHashCode()
7877
{
7978
unchecked
8079
{
81-
return ((Text != null ? Text.GetHashCode() : 0) * 397) ^ (int)Kind;
80+
return ((Text?.GetHashCode() ?? 0) * 397) ^ (int)Kind;
8281
}
8382
}
8483

@@ -110,17 +109,17 @@ public override int GetHashCode()
110109
/// <returns>The string representation of the token.</returns>
111110
public override string ToString()
112111
{
113-
return String.Format("[{0}] {1}", Kind, Text);
112+
return $"[{Kind}] {Text}";
114113
}
115114

116115
/// <summary>
117116
/// Gets the token text.
118117
/// </summary>
119-
public string Text { get; private set; }
118+
public string Text { get; }
120119

121120
/// <summary>
122121
/// Gets the token kind.
123122
/// </summary>
124-
public TokenKind Kind { get; private set; }
123+
public TokenKind Kind { get; }
125124
}
126-
}
125+
}

Src/TestApp/Program.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Diagnostics;
3-
using System.Text;
43
using Era;
54

65
namespace TestApp
@@ -20,7 +19,7 @@ static void Main(string[] args)
2019
static void RunBenchmarks()
2120
{
2221
RunBenchmark("System.DateTime", DateTimeParse);
23-
RunBenchmark("NaturalDate", ParserTryParse);
22+
RunBenchmark("Era", EraTryParse);
2423
RunBenchmark("Chronic", ChronicParse);
2524
}
2625

@@ -64,7 +63,7 @@ static void DateTimeParse(int iterations)
6463
}
6564
}
6665

67-
static void ParserTryParse(int iterations)
66+
static void EraTryParse(int iterations)
6867
{
6968
for (var i = 0; i < iterations; i++)
7069
{

Src/TestApp/TestApp.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@
5555
<None Include="packages.config" />
5656
</ItemGroup>
5757
<ItemGroup>
58-
<ProjectReference Include="..\Era\Era.csproj">
58+
<ProjectReference Include="..\Era\Era.Net45.csproj">
5959
<Project>{3949f194-d1bf-41a7-8130-cd2a0f018055}</Project>
60-
<Name>NaturalDate</Name>
60+
<Name>Era.Net45</Name>
6161
</ProjectReference>
6262
</ItemGroup>
6363
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

package.cmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tools\nuget.exe pack Src\Era\Era.nuspec -Prop Configuration=Release -BasePath Src\Era\ -OutputDirectory Build\Packages

0 commit comments

Comments
 (0)