From f4ff5cf0e24827cbcae6ee26620d0945086566c2 Mon Sep 17 00:00:00 2001 From: "David G. Moore, Jr" Date: Sat, 11 Nov 2023 20:41:52 -0500 Subject: [PATCH] Restore Dgmjr.Tuples --- Abstractions | 2 +- Enumerations | 2 +- Extensions | 2 +- InterfaceGenerator | 2 +- Microsoft.Net.Global.Json | 2 +- Primitives | 2 +- ...cs => CompilerFeatureRequiredAttribute.cs} | 0 Tuples/Dgmjr.Tuples.csproj | 10 +++ Tuples/Dgmjr.Tuples.sln | 42 ++++++++++ Tuples/README.md | 27 +++++++ Tuples/UriDescriptionTuple.cs | 74 ++++++++++++++++++ Tuples/UriStringTuple.cs | 78 +++++++++++++++++++ Tuples/uri.cs | 1 + 13 files changed, 238 insertions(+), 6 deletions(-) rename System.Private.CoreLib.Polyfills/System.Runtime.CompilerServices/{CompilerFeaturRequiedAttribute.cs => CompilerFeatureRequiredAttribute.cs} (100%) create mode 100644 Tuples/Dgmjr.Tuples.csproj create mode 100644 Tuples/Dgmjr.Tuples.sln create mode 100644 Tuples/README.md create mode 100644 Tuples/UriDescriptionTuple.cs create mode 100644 Tuples/UriStringTuple.cs create mode 100644 Tuples/uri.cs diff --git a/Abstractions b/Abstractions index 752b268..6e659c3 160000 --- a/Abstractions +++ b/Abstractions @@ -1 +1 @@ -Subproject commit 752b2684945eb607e787cb461eb15fbb0ca5c50f +Subproject commit 6e659c39949183eb6ba298e984b1a2d606405199 diff --git a/Enumerations b/Enumerations index 6b0a908..8ffb153 160000 --- a/Enumerations +++ b/Enumerations @@ -1 +1 @@ -Subproject commit 6b0a90802fb08aedc4823d6beacad557f7e1aeb5 +Subproject commit 8ffb1531f0f34008207f3cfbabe4d98e433b1cf4 diff --git a/Extensions b/Extensions index 8f2bf4f..26e9af0 160000 --- a/Extensions +++ b/Extensions @@ -1 +1 @@ -Subproject commit 8f2bf4fb0ff38a472465d9c8c136a2f11488190a +Subproject commit 26e9af0f4688af7a783410c58d957a33c1799a50 diff --git a/InterfaceGenerator b/InterfaceGenerator index 254d678..34b96b4 160000 --- a/InterfaceGenerator +++ b/InterfaceGenerator @@ -1 +1 @@ -Subproject commit 254d678495199263d55540c893efb36c8d7f8571 +Subproject commit 34b96b4d13bced3e8a43cf25b58ba2994c2b29d1 diff --git a/Microsoft.Net.Global.Json b/Microsoft.Net.Global.Json index 517cc6c..7f18023 160000 --- a/Microsoft.Net.Global.Json +++ b/Microsoft.Net.Global.Json @@ -1 +1 @@ -Subproject commit 517cc6c6e55502307d3659b3c89deb896dc017fb +Subproject commit 7f18023bcd2d82ce2744392e688b5033b60b1bd5 diff --git a/Primitives b/Primitives index b21d5be..7ff0631 160000 --- a/Primitives +++ b/Primitives @@ -1 +1 @@ -Subproject commit b21d5be17ecf9dfea89bb31af30fd77ecc6ddf53 +Subproject commit 7ff06316f3ac39e4f998b2670e96b3906dc8c0c9 diff --git a/System.Private.CoreLib.Polyfills/System.Runtime.CompilerServices/CompilerFeaturRequiedAttribute.cs b/System.Private.CoreLib.Polyfills/System.Runtime.CompilerServices/CompilerFeatureRequiredAttribute.cs similarity index 100% rename from System.Private.CoreLib.Polyfills/System.Runtime.CompilerServices/CompilerFeaturRequiedAttribute.cs rename to System.Private.CoreLib.Polyfills/System.Runtime.CompilerServices/CompilerFeatureRequiredAttribute.cs diff --git a/Tuples/Dgmjr.Tuples.csproj b/Tuples/Dgmjr.Tuples.csproj new file mode 100644 index 0000000..bbbc6e7 --- /dev/null +++ b/Tuples/Dgmjr.Tuples.csproj @@ -0,0 +1,10 @@ + + + netstandard2.1;net8.0 + + + + + + + diff --git a/Tuples/Dgmjr.Tuples.sln b/Tuples/Dgmjr.Tuples.sln new file mode 100644 index 0000000..5d2e460 --- /dev/null +++ b/Tuples/Dgmjr.Tuples.sln @@ -0,0 +1,42 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B283EBC2-E01F-412D-9339-FD56EF114549}" + ProjectSection(SolutionItems) = preProject + ..\..\..\Directory.Build.props = ..\..\..\Directory.Build.props + ..\..\..\Directory.Build.targets = ..\..\..\Directory.Build.targets + ..\..\..\global.json = ..\..\..\global.json + ..\..\..\Packages\Versions.Local.props = ..\..\..\Packages\Versions.Local.props + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Tuples", "Dgmjr.Tuples.csproj", "{444A4715-9085-4B94-9CEA-60F2125738D6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Local|Any CPU = Local|Any CPU + Debug|Any CPU = Debug|Any CPU + Testing|Any CPU = Testing|Any CPU + Staging|Any CPU = Staging|Any CPU + Production|Any CPU = Production|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {444A4715-9085-4B94-9CEA-60F2125738D6}.Local|Any CPU.ActiveCfg = Local|Any CPU + {444A4715-9085-4B94-9CEA-60F2125738D6}.Local|Any CPU.Build.0 = Local|Any CPU + {444A4715-9085-4B94-9CEA-60F2125738D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {444A4715-9085-4B94-9CEA-60F2125738D6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {444A4715-9085-4B94-9CEA-60F2125738D6}.Testing|Any CPU.ActiveCfg = Testing|Any CPU + {444A4715-9085-4B94-9CEA-60F2125738D6}.Testing|Any CPU.Build.0 = Testing|Any CPU + {444A4715-9085-4B94-9CEA-60F2125738D6}.Staging|Any CPU.ActiveCfg = Staging|Any CPU + {444A4715-9085-4B94-9CEA-60F2125738D6}.Staging|Any CPU.Build.0 = Staging|Any CPU + {444A4715-9085-4B94-9CEA-60F2125738D6}.Production|Any CPU.ActiveCfg = Local|Any CPU + {444A4715-9085-4B94-9CEA-60F2125738D6}.Production|Any CPU.Build.0 = Local|Any CPU + {444A4715-9085-4B94-9CEA-60F2125738D6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {444A4715-9085-4B94-9CEA-60F2125738D6}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E15BF735-2E1E-4DFF-8028-7732CC4D2DB9} + EndGlobalSection +EndGlobal diff --git a/Tuples/README.md b/Tuples/README.md new file mode 100644 index 0000000..f9fa484 --- /dev/null +++ b/Tuples/README.md @@ -0,0 +1,27 @@ +--- +title: +lastmod: 2023-40-04T12:40:28.5966-04:00Z +date: 2023-40-04T12:40:28.5968-04:00Z +license: MIT +slug: Dgmjr.Tuples-readme +version: +authors: + - dgmjr; +description: Dgmjr.Tuples Readme #TODO: write description for Dgmjr.Tuples Readme +keywords: +- Dgmjr.Tuples + - dgmjr + - dgmjr-io +type: readme +--- +# Dgmjr.Tuples Readme + +## Package Description +## Getting Started +## Prerequisites +## Installation +## Usage +## Contributing +## Versioning +Built from [commit on branch at ] +(/tree/) diff --git a/Tuples/UriDescriptionTuple.cs b/Tuples/UriDescriptionTuple.cs new file mode 100644 index 0000000..5067581 --- /dev/null +++ b/Tuples/UriDescriptionTuple.cs @@ -0,0 +1,74 @@ +using System.Security.AccessControl; +using System; +using System.Collections.Generic; + +namespace Dgmjr.Tuples; + +/// +/// The uri description tuple. +/// +public abstract class UriDescriptionTuple : UriStringTuple +{ + /// + /// Gets the description. + /// + public virtual string? Description => Item2; + + /// + /// Initializes a new instance of the + /// class. + /// + /// The uri. + /// The description. + protected UriDescriptionTuple(uri uri, string? description = null) + : base(uri, description) { } + + /// + /// Initializes a new instance of the + /// class. + /// + /// The uri. + /// The description. + protected UriDescriptionTuple(Uri? uri, string? description = null) + : base(System.uri.From(uri), description) { } + + // /// + // /// Initializes a new instance of the + // /// class. + // /// + // /// The uri. + // /// The description. + // protected UriDescriptionTuple(string uri, string? description = null) + // : this(TryCreateUriExtensions.ToUri(uri), description) { } + + protected UriDescriptionTuple((uri, string?)? tuple = null) + : base((uri)(tuple?.Item1), tuple?.Item2) { } + + protected UriDescriptionTuple((string?, string?)? tuple = null) + : base(tuple?.Item1, tuple?.Item2) { } + + public static implicit operator string?(UriDescriptionTuple tuple) + { + return tuple.Uri; + } + + public static implicit operator uri(UriDescriptionTuple tuple) + { + return tuple.Uri; + } + + public override bool Equals(object? obj) + { + return obj is UriDescriptionTuple uriDescriptionTuple + && base.Equals(obj) + && EqualityComparer.Default.Equals(base.Item1, uriDescriptionTuple.Item1) + && base.Item2 == uriDescriptionTuple.Item2 + && EqualityComparer.Default.Equals(base.Uri, uriDescriptionTuple.Uri) + && Description == uriDescriptionTuple.Description; + } + + public override int GetHashCode() + { + return System.HashCode.Combine(base.Uri, Description); + } +} diff --git a/Tuples/UriStringTuple.cs b/Tuples/UriStringTuple.cs new file mode 100644 index 0000000..b0be475 --- /dev/null +++ b/Tuples/UriStringTuple.cs @@ -0,0 +1,78 @@ +using System.Security.AccessControl; +using System; + +namespace Dgmjr.Tuples; + +/// +/// The uri string tuple. +/// +public abstract class UriStringTuple : Tuple +{ + /// + /// Gets the uri. + /// + public uri Uri => base.Item1; + + /// + /// Initializes a new instance of the class. + /// + /// The uri. + /// The value. + protected UriStringTuple(uri uri, string? value) + : base(uri, value) { } + + // /// + // /// Initializes a new instance of the class. + // /// + // /// The uri. + // /// The value. + // protected UriStringTuple(Uri uri, string? value = null) + // : this((System.uri.From(uri), value)) + // { + // uri item; + // if (uri is not null) + // { + // string text = uri.ToString(); + // item = ((text != null) ? TryCreateUriExtensions.CreateUri(text, false) : null); + // } + // } + + // /// + // /// Initializes a new instance of the class. + // /// + // /// The uri. + // /// The value. + // protected UriStringTuple(string? uri, string? value) + // : this((uri is not null) ? TryCreateUriExtensions.ToUri(uri) : null as uri?, value) { } + + /// + /// Initializes a new instance of the class. + /// + /// The tuple. + protected UriStringTuple(UriStringTuple? tuple = null) + : this((uri)(tuple?.Item1), tuple?.Item2) { } + + protected UriStringTuple((uri, string?)? tuple = null) + : this((uri)(tuple?.Item1), tuple?.Item2) { } + + protected UriStringTuple((string?, string?)? tuple = null) + : this(tuple?.Item1, tuple?.Item2) { } + + /// + /// Initializes a new instance of the class. + /// + protected UriStringTuple() + : this((uri)null, (string?)null) { } + + public override bool Equals(object? obj) + { + return obj is UriStringTuple uriStringTuple + && Uri == uriStringTuple.Uri + && base.Item2 == uriStringTuple.Item2; + } + + public override int GetHashCode() + { + return System.HashCode.Combine(Uri, base.Item2); + } +} diff --git a/Tuples/uri.cs b/Tuples/uri.cs new file mode 100644 index 0000000..2c5b787 --- /dev/null +++ b/Tuples/uri.cs @@ -0,0 +1 @@ +[assembly: TypeForwardedTo(typeof(System.uri))]