-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2933c63
commit d13fedd
Showing
16 changed files
with
335 additions
and
310 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,59 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<LangVersion>latest</LangVersion> | ||
|
||
<PropertyGroup Label="General Project Details"> | ||
<TargetFrameworks> | ||
net4.8; | ||
net6.0; | ||
net7.0; | ||
net8.0; | ||
</TargetFrameworks> | ||
<Nullable>enable</Nullable> | ||
<LangVersion>latest</LangVersion> | ||
<ImplicitUsings>true</ImplicitUsings> | ||
<TreatWarningsAsErrors>True</TreatWarningsAsErrors> | ||
|
||
<Title>$(AssemblyName)</Title> | ||
<Version>$(AssemblyVersion)</Version> | ||
<FileVersion>$(AssemblyVersion)</FileVersion> | ||
<PackageVersion>$(AssemblyVersion)</PackageVersion> | ||
</PropertyGroup> | ||
</Project> | ||
|
||
<PropertyGroup Label="Package Details"> | ||
<Description>A lightweight, provider agnostic, serialization proxy designed to simplify serialization definitions.</Description> | ||
<PackageTags>provider;agnostic;serialization;proxy;json;xml;yaml;binary;toml;cbor</PackageTags> | ||
|
||
<Authors>tacosontitan</Authors> | ||
<Copyright>Copyright © 2023 tacosontitan and contibutors</Copyright> | ||
<PackageProjectUrl>https://github.com/tacosontitan/Pasper</PackageProjectUrl> | ||
<PackageReadmeFile>README.md</PackageReadmeFile> | ||
<PackageLicenseFile>LICENSE</PackageLicenseFile> | ||
<PackageReleaseNotesFile>resources/docs/RELEASE_NOTES.md</PackageReleaseNotesFile> | ||
|
||
<IncludeSymbols>True</IncludeSymbols> | ||
<SymbolPackageFormat>snupkg</SymbolPackageFormat> | ||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild> | ||
<GenerateDocumentationFile>True</GenerateDocumentationFile> | ||
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance> | ||
|
||
<RepositoryType>git</RepositoryType> | ||
<RepositoryUrl>https://github.com/tacosontitan/Pasper</RepositoryUrl> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Include="..\..\LICENSE"> | ||
<Pack>True</Pack> | ||
<PackagePath>\</PackagePath> | ||
<Link>.resources\LICENSE</Link> | ||
</None> | ||
<None Include="..\..\README.md"> | ||
<Pack>True</Pack> | ||
<PackagePath>\</PackagePath> | ||
<Link>.resources\docs\README.md</Link> | ||
</None> | ||
<None Include="..\..\resources\docs\RELEASE_NOTES.md"> | ||
<Pack>False</Pack> | ||
<Link>.resources\docs\RELEASE_NOTES.md</Link> | ||
</None> | ||
</ItemGroup> | ||
|
||
</Project> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<AssemblyVersion>1.0.0.0</AssemblyVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Pasper\Pasper.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<AssemblyVersion>1.0.0.0</AssemblyVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Pasper\Pasper.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<AssemblyVersion>1.0.0.0</AssemblyVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Pasper\Pasper.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<AssemblyVersion>1.0.0.0</AssemblyVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Pasper\Pasper.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,7 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>true</ImplicitUsings> | ||
<Title>$(AssemblyName)</Title> | ||
<Version>2023.4.10</Version> | ||
<PackageVersion>$(AssemblyVersion)</PackageVersion> | ||
<Authors>tacosontitan</Authors> | ||
<Copyright>Copyright © 2023 tacosontitan and contibutors</Copyright> | ||
<PackageProjectUrl>https://github.com/tacosontitan/Pasper</PackageProjectUrl> | ||
<RepositoryUrl>https://github.com/tacosontitan/Pasper</RepositoryUrl> | ||
<RepositoryType>git</RepositoryType> | ||
<PackageTags>provider;agnostic;serialization;proxy;json;xml;yaml;binary;toml;cbor</PackageTags> | ||
<PackageReleaseNotes>Initial release.</PackageReleaseNotes> | ||
<PackageReadmeFile>README.md</PackageReadmeFile> | ||
<AssemblyVersion>$(PackageVersion)</AssemblyVersion> | ||
<FileVersion>$(PackageVersion)</FileVersion> | ||
<Description>A lightweight, provider agnostic, serialization proxy designed to simplify serialization definitions.</Description> | ||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild> | ||
<GenerateDocumentationFile>True</GenerateDocumentationFile> | ||
<PackageLicenseFile>LICENSE</PackageLicenseFile> | ||
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance> | ||
<IncludeSymbols>True</IncludeSymbols> | ||
<SymbolPackageFormat>snupkg</SymbolPackageFormat> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | ||
<TreatWarningsAsErrors>True</TreatWarningsAsErrors> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> | ||
<TreatWarningsAsErrors>True</TreatWarningsAsErrors> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Include="..\..\LICENSE"> | ||
<Pack>True</Pack> | ||
<PackagePath>\</PackagePath> | ||
</None> | ||
<None Include="..\..\README.md"> | ||
<Pack>True</Pack> | ||
<PackagePath>\</PackagePath> | ||
</None> | ||
</ItemGroup> | ||
|
||
|
||
<PropertyGroup> | ||
<AssemblyVersion>1.0.0.0</AssemblyVersion> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,68 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
|
||
namespace Pasper.Reflection; | ||
|
||
/// <summary> | ||
/// Defines extension methods for determining if a member should be serialized. | ||
/// </summary> | ||
public static class SerializedExtensions | ||
{ | ||
/// <summary> | ||
/// Determines if the specified field should be serialized. | ||
/// </summary> | ||
/// <param name="source">The field to check.</param> | ||
/// <param name="name">The name of the field to use when serializing.</param> | ||
/// <returns><see langword="true"/> if the field should be serialized; otherwise, <see langword="false"/>.</returns> | ||
public static bool IsSerialized(this FieldInfo source, out string name) | ||
{ | ||
if (source is null) | ||
throw new ArgumentNullException(nameof(source), "The field information cannot be null."); | ||
|
||
name = string.Empty; | ||
IEnumerable<object> attributes = source.GetCustomAttributes(); | ||
object? boxedSerializedAttribute = attributes?.SingleOrDefault(ImplementsSerializedInterface); | ||
if (boxedSerializedAttribute is null) | ||
return false; | ||
|
||
var serializedAttribute = (ISerializedAttribute)boxedSerializedAttribute; | ||
name = string.IsNullOrWhiteSpace(serializedAttribute.Name) | ||
? source.Name | ||
: serializedAttribute.Name; | ||
|
||
return true; | ||
} | ||
|
||
/// <summary> | ||
/// Determines if the specified property should be serialized. | ||
/// </summary> | ||
/// <param name="source">The property to check.</param> | ||
/// <param name="name">The name of the property to use when serializing.</param> | ||
/// <returns><see langword="true"/> if the property should be serialized; otherwise, <see langword="false"/>.</returns> | ||
public static bool IsSerialized(this PropertyInfo source, out string name) | ||
{ | ||
if (source is null) | ||
throw new ArgumentNullException(nameof(source), "The property information cannot be null."); | ||
|
||
name = string.Empty; | ||
IEnumerable<object> attributes = source.GetCustomAttributes(); | ||
object? boxedSerializedAttribute = attributes?.SingleOrDefault(ImplementsSerializedInterface); | ||
if (boxedSerializedAttribute is null) | ||
return false; | ||
|
||
var serializedAttribute = (ISerializedAttribute)boxedSerializedAttribute; | ||
name = string.IsNullOrWhiteSpace(serializedAttribute.Name) | ||
? source.Name | ||
: serializedAttribute.Name; | ||
|
||
return true; | ||
} | ||
|
||
private static bool ImplementsSerializedInterface(object attribute) | ||
{ | ||
Type attributeType = attribute.GetType(); | ||
return typeof(ISerializedAttribute).IsAssignableFrom(attributeType); | ||
} | ||
} | ||
// using System; | ||
// using System.Collections.Generic; | ||
// using System.Linq; | ||
// using System.Reflection; | ||
// | ||
// namespace Pasper.Reflection; | ||
// | ||
// /// <summary> | ||
// /// Defines extension methods for determining if a member should be serialized. | ||
// /// </summary> | ||
// public static class SerializedExtensions | ||
// { | ||
// /// <summary> | ||
// /// Determines if the specified field should be serialized. | ||
// /// </summary> | ||
// /// <param name="source">The field to check.</param> | ||
// /// <param name="name">The name of the field to use when serializing.</param> | ||
// /// <returns><see langword="true"/> if the field should be serialized; otherwise, <see langword="false"/>.</returns> | ||
// public static bool IsSerialized(this FieldInfo source, out string name) | ||
// { | ||
// if (source is null) | ||
// throw new ArgumentNullException(nameof(source), "The field information cannot be null."); | ||
// | ||
// name = string.Empty; | ||
// IEnumerable<object> attributes = source.GetCustomAttributes(); | ||
// object? boxedSerializedAttribute = attributes?.SingleOrDefault(ImplementsSerializedInterface); | ||
// if (boxedSerializedAttribute is null) | ||
// return false; | ||
// | ||
// var serializedAttribute = (ISerializedAttribute)boxedSerializedAttribute; | ||
// name = string.IsNullOrWhiteSpace(serializedAttribute.Name) | ||
// ? source.Name | ||
// : serializedAttribute.Name; | ||
// | ||
// return true; | ||
// } | ||
// | ||
// /// <summary> | ||
// /// Determines if the specified property should be serialized. | ||
// /// </summary> | ||
// /// <param name="source">The property to check.</param> | ||
// /// <param name="name">The name of the property to use when serializing.</param> | ||
// /// <returns><see langword="true"/> if the property should be serialized; otherwise, <see langword="false"/>.</returns> | ||
// public static bool IsSerialized(this PropertyInfo source, out string name) | ||
// { | ||
// if (source is null) | ||
// throw new ArgumentNullException(nameof(source), "The property information cannot be null."); | ||
// | ||
// name = string.Empty; | ||
// IEnumerable<object> attributes = source.GetCustomAttributes(); | ||
// object? boxedSerializedAttribute = attributes?.SingleOrDefault(ImplementsSerializedInterface); | ||
// if (boxedSerializedAttribute is null) | ||
// return false; | ||
// | ||
// var serializedAttribute = (ISerializedAttribute)boxedSerializedAttribute; | ||
// name = string.IsNullOrWhiteSpace(serializedAttribute.Name) | ||
// ? source.Name | ||
// : serializedAttribute.Name; | ||
// | ||
// return true; | ||
// } | ||
// | ||
// private static bool ImplementsSerializedInterface(object attribute) | ||
// { | ||
// Type attributeType = attribute.GetType(); | ||
// return typeof(ISerializedAttribute).IsAssignableFrom(attributeType); | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.