Skip to content

Commit

Permalink
Portable jehugaleahsa#16
Browse files Browse the repository at this point in the history
- Converted project to a Portable Class Library project.
- StringComparer reverts to OrdinalIgnoreCase if InvariantCultureIgnoreCase not found.
- RegexOptions only uses "Compiled" if "Compiled" is available on the platform.
  • Loading branch information
dazinator committed Sep 27, 2015
1 parent feb6ca6 commit 0a6a22b
Show file tree
Hide file tree
Showing 11 changed files with 186 additions and 132 deletions.
2 changes: 1 addition & 1 deletion SQLGeneration.Tests/SQLGeneration.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SQLGeneration\SQLGeneration.csproj">
<Project>{A57BC336-3100-415B-91A5-B779CC64EF91}</Project>
<Project>{a83b3df1-c48e-4c61-ba0e-dbf31ae139cd}</Project>
<Name>SQLGeneration</Name>
</ProjectReference>
</ItemGroup>
Expand Down
22 changes: 12 additions & 10 deletions SQLGeneration.sln
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLGeneration", "SQLGeneration\SQLGeneration.csproj", "{A57BC336-3100-415B-91A5-B779CC64EF91}"
EndProject
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLGeneration.Tests", "SQLGeneration.Tests\SQLGeneration.Tests.csproj", "{0B721A48-59F1-4D97-A321-5C1A56BC68A1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLGeneration", "SQLGeneration\SQLGeneration.csproj", "{A83B3DF1-C48E-4C61-BA0E-DBF31AE139CD}"
EndProject
Global
GlobalSection(TestCaseManagementSettings) = postSolution
CategoryFile = SQLGeneration.vsmdi
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A57BC336-3100-415B-91A5-B779CC64EF91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A57BC336-3100-415B-91A5-B779CC64EF91}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A57BC336-3100-415B-91A5-B779CC64EF91}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A57BC336-3100-415B-91A5-B779CC64EF91}.Release|Any CPU.Build.0 = Release|Any CPU
{0B721A48-59F1-4D97-A321-5C1A56BC68A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0B721A48-59F1-4D97-A321-5C1A56BC68A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0B721A48-59F1-4D97-A321-5C1A56BC68A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0B721A48-59F1-4D97-A321-5C1A56BC68A1}.Release|Any CPU.Build.0 = Release|Any CPU
{A83B3DF1-C48E-4C61-BA0E-DBF31AE139CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A83B3DF1-C48E-4C61-BA0E-DBF31AE139CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A83B3DF1-C48E-4C61-BA0E-DBF31AE139CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A83B3DF1-C48E-4C61-BA0E-DBF31AE139CD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(TestCaseManagementSettings) = postSolution
CategoryFile = SQLGeneration.vsmdi
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion SQLGeneration/Builders/FilterGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public FilterGroup(Conjunction conjunction = Conjunction.And, params IFilter[] f
{
if (!Enum.IsDefined(typeof(Conjunction), conjunction))
{
throw new InvalidEnumArgumentException("conjunction", (int)conjunction, typeof(Conjunction));
throw new ArgumentException("Invalid enum","conjunction");
}
if (filters == null)
{
Expand Down
4 changes: 2 additions & 2 deletions SQLGeneration/Builders/SourceCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class SourceCollection
/// </summary>
internal SourceCollection()
{
sourceLookup = new Dictionary<string, AliasedSource>(StringComparer.InvariantCultureIgnoreCase);
sourceLookup = new Dictionary<string, AliasedSource>(StringComparerHelper.DefaultStringComparer);
}

/// <summary>
Expand All @@ -27,7 +27,7 @@ internal SourceCollection()
/// <param name="other">The source collection to copy the value from.</param>
internal SourceCollection(SourceCollection other)
{
sourceLookup = new Dictionary<string, AliasedSource>(other.sourceLookup, StringComparer.InvariantCultureIgnoreCase);
sourceLookup = new Dictionary<string, AliasedSource>(other.sourceLookup, StringComparerHelper.DefaultStringComparer);
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions SQLGeneration/Parsing/TokenRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ private Dictionary<string, Regex> getRegex()
checks = new Dictionary<string, Regex>();
foreach (string tokenName in definitionLookup.Keys)
{
string pattern = getTokenRegex(definitionLookup[tokenName]);
Regex regex = new Regex(pattern, RegexOptions.Compiled | RegexOptions.ExplicitCapture);
string pattern = getTokenRegex(definitionLookup[tokenName]);
Regex regex = new Regex(pattern, RegexOptionsHelper.DefaultOptions | RegexOptions.ExplicitCapture);
checks.Add(tokenName, regex);
}
}
Expand Down
10 changes: 5 additions & 5 deletions SQLGeneration/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
[assembly: AssemblyCulture("")]
[assembly: CLSCompliant(true)]

[assembly: AssemblyVersion("2.5.1.0")]
[assembly: AssemblyFileVersion("2.5.1.0")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1e69a85b-72b7-4440-b39b-3388c75a2474")]

[assembly: AssemblyVersion("2.5.1.0")]
[assembly: AssemblyFileVersion("2.5.1.0")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
[assembly: Guid("1e69a85b-72b7-4440-b39b-3388c75a2474")]
2 changes: 1 addition & 1 deletion SQLGeneration/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions SQLGeneration/RegexOptionsHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Text.RegularExpressions;

namespace SQLGeneration
{

internal static class RegexOptionsHelper
{
private static readonly RegexOptions CompiledOption;

static RegexOptionsHelper()
{
// Not all platforms support compiled regex's but those that do will be supported!
if (!Enum.TryParse("Compiled", out CompiledOption))
CompiledOption = RegexOptions.None;
}

public static RegexOptions DefaultOptions
{
get
{
return CompiledOption;
}
}
}
}


Loading

0 comments on commit 0a6a22b

Please sign in to comment.