Skip to content

Commit

Permalink
Added support for .NET Core 2.0 + .NET 4.7.1.
Browse files Browse the repository at this point in the history
Updated new msbuild configurations.

Cleaned up validation and NPE hotpoints.

Added signed key signature for GAC (.NET Core/Std 2.0/Net471).
  • Loading branch information
Latency committed Jan 8, 2018
1 parent 4461dc6 commit 2b806a4
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 144 deletions.
3 changes: 1 addition & 2 deletions HearthDb/Card.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#region

using System;
using System.Linq;
using HearthDb.CardDefs;
using HearthDb.Enums;
Expand Down Expand Up @@ -69,7 +68,7 @@ public string[] Mechanics

public Locale DefaultLanguage { get; set; } = Locale.enUS;

public bool Collectible => Convert.ToBoolean(Entity.GetTag(COLLECTIBLE));
public bool Collectible => Entity.GetTag(COLLECTIBLE) != 0;

public string GetLocName(Locale lang) => Entity.GetLocString(CARDNAME, lang);

Expand Down
3 changes: 2 additions & 1 deletion HearthDb/CardIds.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ReSharper disable InconsistentNaming
namespace HearthDb
{
/* THIS CLASS WAS GENERATED BY HearthDb.CardIdGenerator. DO NOT EDIT. */
Expand Down Expand Up @@ -4184,4 +4185,4 @@ public class DreamCards
}
}
}
}
}
9 changes: 4 additions & 5 deletions HearthDb/Cards.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#region

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand All @@ -18,11 +17,11 @@ public static class Cards

public static readonly Dictionary<string, Card> Collectible = new Dictionary<string, Card>();

static Cards()
{
static Cards() {
var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("HearthDb.CardDefs.xml");
if(stream == null)
return;

using(TextReader tr = new StreamReader(stream))
{
var xml = new XmlSerializer(typeof(CardDefs.CardDefs));
Expand All @@ -38,9 +37,9 @@ static Cards()
}

public static Card GetFromName(string name, Locale lang, bool collectible = true)
=> (collectible ? Collectible : All).Values.FirstOrDefault(x => x.GetLocName(lang)?.Equals(name, StringComparison.InvariantCultureIgnoreCase) ?? false);
=> (collectible ? Collectible : All).Values.FirstOrDefault(x => x.GetLocName(lang)?.Equals(name) ?? false);

public static Card GetFromDbfId(int dbfId, bool collectibe = true)
=> (collectibe ? Collectible : All).Values.FirstOrDefault(x => x.DbfId == dbfId);
}
}
}
3 changes: 2 additions & 1 deletion HearthDb/Enums/Enums.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ReSharper disable InconsistentNaming
namespace HearthDb.Enums
{
/* THIS FILE WAS GENERATED BY HearthDb.EnumsGenerator. DO NOT EDIT. */
Expand Down Expand Up @@ -912,4 +913,4 @@ public enum Zone
SETASIDE = 6,
SECRET = 7,
}
}
}
112 changes: 14 additions & 98 deletions HearthDb/HearthDb.csproj
Original file line number Diff line number Diff line change
@@ -1,105 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{7ED14243-E02B-4B94-AF00-A67A62C282F0}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>HearthDb</RootNamespace>
<AssemblyName>HearthDb</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<TargetFrameworks>net471;netcoreapp2.0</TargetFrameworks>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>snKey.snk</AssemblyOriginatorKeyFile>
<AssemblyVersion>10.0.1.0</AssemblyVersion>
<FileVersion>10.0.1.0</FileVersion>
<DelaySign>false</DelaySign>
<Version>10.0.1</Version>
</PropertyGroup>

<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Card.cs" />
<Compile Include="CardDefs\CardDefs.cs" />
<Compile Include="CardDefs\Entity.cs" />
<Compile Include="CardDefs\EntourageCard.cs" />
<Compile Include="CardDefs\PlayRequirement.cs" />
<Compile Include="CardDefs\Power.cs" />
<Compile Include="CardDefs\Tag.cs" />
<Compile Include="CardDefs\TriggeredPowerHistoryInfo.cs" />
<Compile Include="CardIds.cs" />
<Compile Include="Cards.cs" />
<Compile Include="Deckstrings\Deck.cs" />
<Compile Include="Deckstrings\DeckSerializer.cs" />
<Compile Include="Deckstrings\InvalidDeckException.cs" />
<Compile Include="Deckstrings\VarInt.cs" />
<Compile Include="Enums\Converters.cs" />
<Compile Include="Enums\Dictionaries.cs" />
<Compile Include="Enums\Enums.cs" />
<Compile Include="Info.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Remove="Convert.cs" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="CardDefs.xml" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>if exist $(ProjectDir)hsdata (
git -C "$(ProjectDir)hsdata" fetch
git -C "$(ProjectDir)hsdata" reset --hard origin/master
) else (
git clone --depth=1 https://github.com/HearthSim/hsdata.git "$(ProjectDir)hsdata"
)
if "$(ConfigurationName)" == "Release" (
powershell -ExecutionPolicy Unrestricted -file "$(ProjectDir)verify.ps1" "$(ProjectDir)\"
)
xcopy /Y "$(ProjectDir)hsdata\CardDefs.xml" "$(ProjectDir)CardDefs.xml*"</PreBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

</Project>
2 changes: 1 addition & 1 deletion HearthDb/Info.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ public static class Info
{
public static Version HearthDbVersion => Assembly.GetExecutingAssembly().GetName().Version;
}
}
}
36 changes: 0 additions & 36 deletions HearthDb/Properties/AssemblyInfo.cs

This file was deleted.

Binary file added HearthDb/snKey.snk
Binary file not shown.

0 comments on commit 2b806a4

Please sign in to comment.