Skip to content

Commit

Permalink
Port to .Net Core
Browse files Browse the repository at this point in the history
  • Loading branch information
axunonb committed Feb 14, 2017
1 parent 979b116 commit 7f5b302
Show file tree
Hide file tree
Showing 42 changed files with 1,027 additions and 320 deletions.
17 changes: 10 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
*.suo
*.user
*.pdb
*.cache
*.vshost.exe
*.vshost.exe.manifest
*.ncrunchproject
*.ncrunchsolution
obj/
*.lock.json
*.tmp
*.xlsx
_ReSharper*/
DemoApplication/bin/
YAXLibTests/bin/
TestResults/
Bin/*.dll
Bin/*.xml
Bin/*.dll.mdb
**/[Bb]in/**
**/[Dd]ebug/**
**/[Oo]bj/**
**/[Ll]og/**
.vs/
/packages/*
!/packages/repositories.config
YAXLibTests.VisualState.xml
TestResult.xml
Bin/Signed

Binary file modified .nuget/NuGet.exe
Binary file not shown.
4 changes: 3 additions & 1 deletion DemoApplication/DemoApplication.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DemoApplication</RootNamespace>
<AssemblyName>DemoApplication</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
Expand All @@ -32,6 +32,7 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -99,6 +100,7 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
Expand Down
2 changes: 1 addition & 1 deletion DemoApplication/Properties/Resources.Designer.cs

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

4 changes: 2 additions & 2 deletions DemoApplication/Properties/Settings.Designer.cs

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

3 changes: 3 additions & 0 deletions DemoApplication/app.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
Binary file added Logo/YAXLib.psd
Binary file not shown.
Binary file added Logo/YAXLib_256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Logo/YAXLib_64x64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 0 additions & 41 deletions YAXLib.2013.sln

This file was deleted.

28 changes: 28 additions & 0 deletions YAXLib.2015.Core.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "YAXLib.NetCore", "YAXLib\YAXLib.NetCore.xproj", "{68FB7103-CACE-4038-A10B-3BED4213C8C2}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "YAXLibTests.NetCore", "YAXLibTests\YAXLibTests.NetCore.xproj", "{68FB7103-CACE-4038-A10B-3BED4213C8C3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{68FB7103-CACE-4038-A10B-3BED4213C8C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{68FB7103-CACE-4038-A10B-3BED4213C8C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{68FB7103-CACE-4038-A10B-3BED4213C8C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{68FB7103-CACE-4038-A10B-3BED4213C8C2}.Release|Any CPU.Build.0 = Release|Any CPU
{68FB7103-CACE-4038-A10B-3BED4213C8C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{68FB7103-CACE-4038-A10B-3BED4213C8C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{68FB7103-CACE-4038-A10B-3BED4213C8C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{68FB7103-CACE-4038-A10B-3BED4213C8C3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
82 changes: 41 additions & 41 deletions YAXLib.2015.sln
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YAXLibTests", "YAXLibTests\YAXLibTests.csproj", "{4F012F71-C259-481B-A112-EC24D3AF24AC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YAXLib", "YAXLib\YAXLib.csproj", "{F1C4D174-C948-4D18-A125-F6855EF55683}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DemoApplication", "DemoApplication\DemoApplication.csproj", "{40A6C570-2CC0-44BF-8A2A-FD41CE598C41}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{5E379F4E-63A0-49D7-B60E-22B4EC98E92A}"
ProjectSection(SolutionItems) = preProject
.nuget\NuGet.Config = .nuget\NuGet.Config
.nuget\NuGet.exe = .nuget\NuGet.exe
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4F012F71-C259-481B-A112-EC24D3AF24AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4F012F71-C259-481B-A112-EC24D3AF24AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4F012F71-C259-481B-A112-EC24D3AF24AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4F012F71-C259-481B-A112-EC24D3AF24AC}.Release|Any CPU.Build.0 = Release|Any CPU
{F1C4D174-C948-4D18-A125-F6855EF55683}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F1C4D174-C948-4D18-A125-F6855EF55683}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F1C4D174-C948-4D18-A125-F6855EF55683}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F1C4D174-C948-4D18-A125-F6855EF55683}.Release|Any CPU.Build.0 = Release|Any CPU
{40A6C570-2CC0-44BF-8A2A-FD41CE598C41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{40A6C570-2CC0-44BF-8A2A-FD41CE598C41}.Debug|Any CPU.Build.0 = Debug|Any CPU
{40A6C570-2CC0-44BF-8A2A-FD41CE598C41}.Release|Any CPU.ActiveCfg = Release|Any CPU
{40A6C570-2CC0-44BF-8A2A-FD41CE598C41}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YAXLibTests", "YAXLibTests\YAXLibTests.csproj", "{4F012F71-C259-481B-A112-EC24D3AF24AC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YAXLib", "YAXLib\YAXLib.csproj", "{F1C4D174-C948-4D18-A125-F6855EF55683}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DemoApplication", "DemoApplication\DemoApplication.csproj", "{40A6C570-2CC0-44BF-8A2A-FD41CE598C41}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{5E379F4E-63A0-49D7-B60E-22B4EC98E92A}"
ProjectSection(SolutionItems) = preProject
.nuget\NuGet.Config = .nuget\NuGet.Config
.nuget\NuGet.exe = .nuget\NuGet.exe
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4F012F71-C259-481B-A112-EC24D3AF24AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4F012F71-C259-481B-A112-EC24D3AF24AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4F012F71-C259-481B-A112-EC24D3AF24AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4F012F71-C259-481B-A112-EC24D3AF24AC}.Release|Any CPU.Build.0 = Release|Any CPU
{F1C4D174-C948-4D18-A125-F6855EF55683}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F1C4D174-C948-4D18-A125-F6855EF55683}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F1C4D174-C948-4D18-A125-F6855EF55683}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F1C4D174-C948-4D18-A125-F6855EF55683}.Release|Any CPU.Build.0 = Release|Any CPU
{40A6C570-2CC0-44BF-8A2A-FD41CE598C41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{40A6C570-2CC0-44BF-8A2A-FD41CE598C41}.Debug|Any CPU.Build.0 = Debug|Any CPU
{40A6C570-2CC0-44BF-8A2A-FD41CE598C41}.Release|Any CPU.ActiveCfg = Release|Any CPU
{40A6C570-2CC0-44BF-8A2A-FD41CE598C41}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion YAXLib/EnumWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ internal class EnumWrapper
/// <param name="t">The enum type.</param>
public EnumWrapper(Type t)
{
if (!t.IsEnum)
if (!t.IsEnum())
throw new ArithmeticException();

m_enumType = t;
Expand Down
33 changes: 21 additions & 12 deletions YAXLib/MemberWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,24 @@ public MemberWrapper(MemberInfo memberInfo, YAXSerializer callerSerializer)
var attrsToProcessEarlier = new HashSet<Type> {typeof (YAXCustomSerializerAttribute), typeof (YAXCollectionAttribute)};
foreach (var attrType in attrsToProcessEarlier)
{
var customSerAttrs = Attribute.GetCustomAttributes(m_memberInfo, attrType, true);
foreach (var attr in customSerAttrs)
#if FXCORE
var customSerAttrs = m_memberInfo.GetCustomAttributes(attrType, true);
#else
var customSerAttrs = Attribute.GetCustomAttributes(m_memberInfo, attrType, true);
#endif
foreach (var attr in customSerAttrs)
{
ProcessYaxAttribute(attr);
}
}

foreach (var attr in Attribute.GetCustomAttributes(m_memberInfo, true))
{
// no need to preces, it has been proccessed earlier
if (attrsToProcessEarlier.Contains(attr.GetType()))
#if FXCORE
foreach (var attr in m_memberInfo.GetCustomAttributes(true))
#else
foreach (var attr in Attribute.GetCustomAttributes(m_memberInfo, true))
#endif
{
// no need to preces, it has been proccessed earlier
if (attrsToProcessEarlier.Contains(attr.GetType()))
continue;

if (attr is YAXBaseAttribute)
Expand All @@ -151,8 +158,9 @@ public MemberWrapper(MemberInfo memberInfo, YAXSerializer callerSerializer)
// then use those of the member-type
if (m_collectionAttributeInstance == null && m_memberTypeWrapper.CollectionAttributeInstance != null)
m_collectionAttributeInstance = m_memberTypeWrapper.CollectionAttributeInstance;
m_memberInfo.GetCustomAttributes(true);

if (m_dictionaryAttributeInstance == null && m_memberTypeWrapper.DictionaryAttributeInstance != null)
if (m_dictionaryAttributeInstance == null && m_memberTypeWrapper.DictionaryAttributeInstance != null)
m_dictionaryAttributeInstance = m_memberTypeWrapper.DictionaryAttributeInstance;
}

Expand Down Expand Up @@ -697,10 +705,11 @@ private void InitInstance()
/// </summary>
private void InitDefaultValue()
{
if(MemberType.IsValueType)
DefaultValue = MemberType.InvokeMember(string.Empty, BindingFlags.CreateInstance, null, null, new object[0]);
else
DefaultValue = null;
if (MemberType.IsValueType())
DefaultValue = Activator.CreateInstance(MemberType, new object[0]);
//DefaultValue = MemberType.InvokeMember(string.Empty, BindingFlags.CreateInstance, null, null, new object[0]);
else
DefaultValue = null;
}

/// <summary>
Expand Down
10 changes: 5 additions & 5 deletions YAXLib/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("YAXLib")]
[assembly: AssemblyDescription("Yet Another XML Serialization Library for the .NET Framework")]
[assembly: AssemblyDescription("Yet Another XML Serialization Library for the .NET Framework and .Net Core")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCompany("Authors: Sina Iravanian, axuno gGmbH, Asbjørn Ulsberg, Benjamin Pannell, Julian Verdurmen")]
[assembly: AssemblyProduct("YAXLib")]
[assembly: AssemblyCopyright("Copyright © 2009-2014 - Sina Iravanian")]
[assembly: AssemblyCopyright("Copyright © 2009-2017 - Sina Iravanian")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -32,8 +32,8 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.14")]
[assembly: AssemblyFileVersion("2.14")]
[assembly: AssemblyVersion("2.15.0.0")]
[assembly: AssemblyFileVersion("2.15.0.0")]

[assembly: InternalsVisibleTo("YAXLibTests, PublicKey=" +
"0024000004800000940000000602000000240000525341310004000001000100d7f87eefee568e" +
Expand Down
Loading

0 comments on commit 7f5b302

Please sign in to comment.