-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Base64Url netstandard support package
- Loading branch information
Showing
14 changed files
with
2,474 additions
and
13 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
src/libraries/Microsoft.Bcl.Memory/Microsoft.Bcl.Memory.sln
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.10.35004.147 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Bcl.Memory", "ref\Microsoft.Bcl.Memory.csproj", "{97D0AA68-5D2E-4E18-9651-19D0143EA98A}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Bcl.Memory", "src\Microsoft.Bcl.Memory.csproj", "{D4D9D9AC-E482-457A-8047-5267BDF2C2EE}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Bcl.Memory.Tests", "tests\Microsoft.Bcl.Memory.Tests.csproj", "{6916DB98-2958-498D-83E7-90080BEA9D39}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{76C22FE9-D65E-40C3-BE2D-98BD628779EC}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{76EDDEA8-0E0E-4A94-9D8F-F4DB250E8EB8}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{E78D7A3F-384B-4AA3-ABF1-C4464BE9237C}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{D4D9D9AC-E482-457A-8047-5267BDF2C2EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{D4D9D9AC-E482-457A-8047-5267BDF2C2EE}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{D4D9D9AC-E482-457A-8047-5267BDF2C2EE}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{D4D9D9AC-E482-457A-8047-5267BDF2C2EE}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{97D0AA68-5D2E-4E18-9651-19D0143EA98A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{97D0AA68-5D2E-4E18-9651-19D0143EA98A}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{97D0AA68-5D2E-4E18-9651-19D0143EA98A}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{97D0AA68-5D2E-4E18-9651-19D0143EA98A}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{6916DB98-2958-498D-83E7-90080BEA9D39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{6916DB98-2958-498D-83E7-90080BEA9D39}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{6916DB98-2958-498D-83E7-90080BEA9D39}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{6916DB98-2958-498D-83E7-90080BEA9D39}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(NestedProjects) = preSolution | ||
{D4D9D9AC-E482-457A-8047-5267BDF2C2EE} = {76C22FE9-D65E-40C3-BE2D-98BD628779EC} | ||
{97D0AA68-5D2E-4E18-9651-19D0143EA98A} = {76EDDEA8-0E0E-4A94-9D8F-F4DB250E8EB8} | ||
{6916DB98-2958-498D-83E7-90080BEA9D39} = {E78D7A3F-384B-4AA3-ABF1-C4464BE9237C} | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {CB4D3234-B365-4A38-B9C6-47B72CE8BC85} | ||
EndGlobalSection | ||
EndGlobal |
4 changes: 4 additions & 0 deletions
4
src/libraries/Microsoft.Bcl.Memory/ref/Microsoft.Bcl.Memory.Forwards.cs
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.Text.Base64Url))] |
35 changes: 35 additions & 0 deletions
35
src/libraries/Microsoft.Bcl.Memory/ref/Microsoft.Bcl.Memory.cs
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace System.Buffers.Text | ||
{ | ||
[System.CLSCompliant(false)] | ||
public static class Base64Url | ||
{ | ||
public static byte[] DecodeFromChars(System.ReadOnlySpan<char> source) { throw null; } | ||
public static int DecodeFromChars(System.ReadOnlySpan<char> source, System.Span<byte> destination) { throw null; } | ||
public static System.Buffers.OperationStatus DecodeFromChars(System.ReadOnlySpan<char> source, System.Span<byte> destination, out int charsConsumed, out int bytesWritten, bool isFinalBlock = true) { throw null; } | ||
public static byte[] DecodeFromUtf8(System.ReadOnlySpan<byte> source) { throw null; } | ||
public static int DecodeFromUtf8(System.ReadOnlySpan<byte> source, System.Span<byte> destination) { throw null; } | ||
public static System.Buffers.OperationStatus DecodeFromUtf8(System.ReadOnlySpan<byte> source, System.Span<byte> destination, out int bytesConsumed, out int bytesWritten, bool isFinalBlock = true) { throw null; } | ||
public static int DecodeFromUtf8InPlace(System.Span<byte> buffer) { throw null; } | ||
public static char[] EncodeToChars(System.ReadOnlySpan<byte> source) { throw null; } | ||
public static int EncodeToChars(System.ReadOnlySpan<byte> source, System.Span<char> destination) { throw null; } | ||
public static System.Buffers.OperationStatus EncodeToChars(System.ReadOnlySpan<byte> source, System.Span<char> destination, out int bytesConsumed, out int charsWritten, bool isFinalBlock = true) { throw null; } | ||
public static string EncodeToString(System.ReadOnlySpan<byte> source) { throw null; } | ||
public static byte[] EncodeToUtf8(System.ReadOnlySpan<byte> source) { throw null; } | ||
public static int EncodeToUtf8(System.ReadOnlySpan<byte> source, System.Span<byte> destination) { throw null; } | ||
public static System.Buffers.OperationStatus EncodeToUtf8(System.ReadOnlySpan<byte> source, System.Span<byte> destination, out int bytesConsumed, out int bytesWritten, bool isFinalBlock = true) { throw null; } | ||
public static int GetEncodedLength(int bytesLength) { throw null; } | ||
public static int GetMaxDecodedLength(int base64Length) { throw null; } | ||
public static bool IsValid(System.ReadOnlySpan<char> base64UrlText) { throw null; } | ||
public static bool IsValid(System.ReadOnlySpan<char> base64UrlText, out int decodedLength) { throw null; } | ||
public static bool IsValid(System.ReadOnlySpan<byte> utf8Base64UrlText) { throw null; } | ||
public static bool IsValid(System.ReadOnlySpan<byte> utf8Base64UrlText, out int decodedLength) { throw null; } | ||
public static bool TryDecodeFromChars(System.ReadOnlySpan<char> source, System.Span<byte> destination, out int bytesWritten) { throw null; } | ||
public static bool TryDecodeFromUtf8(System.ReadOnlySpan<byte> source, System.Span<byte> destination, out int bytesWritten) { throw null; } | ||
public static bool TryEncodeToChars(System.ReadOnlySpan<byte> source, System.Span<char> destination, out int charsWritten) { throw null; } | ||
public static bool TryEncodeToUtf8(System.ReadOnlySpan<byte> source, System.Span<byte> destination, out int bytesWritten) { throw null; } | ||
public static bool TryEncodeToUtf8InPlace(System.Span<byte> buffer, int dataLength, out int bytesWritten) { throw null; } | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/libraries/Microsoft.Bcl.Memory/ref/Microsoft.Bcl.Memory.csproj
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>netstandard2.0;$(NetFrameworkMinimum);$(NetCoreAppCurrent)</TargetFrameworks> | ||
</PropertyGroup> | ||
|
||
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'"> | ||
<Compile Include="Microsoft.Bcl.Memory.cs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'"> | ||
<Compile Include="Microsoft.Bcl.Memory.Forwards.cs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'"> | ||
<PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" /> | ||
</ItemGroup> | ||
|
||
</Project> |
36 changes: 36 additions & 0 deletions
36
src/libraries/Microsoft.Bcl.Memory/src/Microsoft.Bcl.Memory.csproj
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>netstandard2.0;$(NetFrameworkMinimum);$(NetCoreAppCurrent)</TargetFrameworks> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<UseCompilerGeneratedDocXmlFile>false</UseCompilerGeneratedDocXmlFile> | ||
<IsPackable>true</IsPackable> | ||
<!-- Disabling baseline validation since this is a brand new package. | ||
Once this package has shipped a stable version, the following line | ||
should be removed in order to re-enable validation. --> | ||
<DisablePackageBaselineValidation>true</DisablePackageBaselineValidation> | ||
<PackageDescription> | ||
Provides Base64Url encoding, decoding and validation APIs support for .NET Framework and .NET Standard. | ||
|
||
Commonly Used Types: | ||
System.Buffers.Text.Base64Url | ||
</PackageDescription> | ||
</PropertyGroup> | ||
|
||
<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. --> | ||
<PropertyGroup> | ||
<IsPartialFacadeAssembly Condition="$([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) == '.NETCoreApp'">true</IsPartialFacadeAssembly> | ||
<OmitResources Condition="'$(IsPartialFacadeAssembly)' == 'true'">true</OmitResources> | ||
</PropertyGroup> | ||
|
||
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' != 'true'"> | ||
<Compile Include="System\Buffers\Text\Base64UrlDecoder.cs" /> | ||
<Compile Include="System\Buffers\Text\Base64UrlEncoder.cs" /> | ||
<Compile Include="System\Buffers\Text\Base64UrlValidator.cs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' != 'true'"> | ||
<PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" /> | ||
</ItemGroup> | ||
|
||
</Project> |
126 changes: 126 additions & 0 deletions
126
src/libraries/Microsoft.Bcl.Memory/src/Resources/Strings.resx
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 |
---|---|---|
@@ -0,0 +1,126 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<root> | ||
<!-- | ||
Microsoft ResX Schema | ||
Version 2.0 | ||
The primary goals of this format is to allow a simple XML format | ||
that is mostly human readable. The generation and parsing of the | ||
various data types are done through the TypeConverter classes | ||
associated with the data types. | ||
Example: | ||
... ado.net/XML headers & schema ... | ||
<resheader name="resmimetype">text/microsoft-resx</resheader> | ||
<resheader name="version">2.0</resheader> | ||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | ||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | ||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | ||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | ||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | ||
<value>[base64 mime encoded serialized .NET Framework object]</value> | ||
</data> | ||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | ||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | ||
<comment>This is a comment</comment> | ||
</data> | ||
There are any number of "resheader" rows that contain simple | ||
name/value pairs. | ||
Each data row contains a name, and value. The row also contains a | ||
type or mimetype. Type corresponds to a .NET class that support | ||
text/value conversion through the TypeConverter architecture. | ||
Classes that don't support this are serialized and stored with the | ||
mimetype set. | ||
The mimetype is used for serialized objects, and tells the | ||
ResXResourceReader how to depersist the object. This is currently not | ||
extensible. For a given mimetype the value must be set accordingly: | ||
Note - application/x-microsoft.net.object.binary.base64 is the format | ||
that the ResXResourceWriter will generate, however the reader can | ||
read any of the formats listed below. | ||
mimetype: application/x-microsoft.net.object.binary.base64 | ||
value : The object must be serialized with | ||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | ||
: and then encoded with base64 encoding. | ||
mimetype: application/x-microsoft.net.object.soap.base64 | ||
value : The object must be serialized with | ||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter | ||
: and then encoded with base64 encoding. | ||
mimetype: application/x-microsoft.net.object.bytearray.base64 | ||
value : The object must be serialized into a byte array | ||
: using a System.ComponentModel.TypeConverter | ||
: and then encoded with base64 encoding. | ||
--> | ||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | ||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | ||
<xsd:element name="root" msdata:IsDataSet="true"> | ||
<xsd:complexType> | ||
<xsd:choice maxOccurs="unbounded"> | ||
<xsd:element name="metadata"> | ||
<xsd:complexType> | ||
<xsd:sequence> | ||
<xsd:element name="value" type="xsd:string" minOccurs="0" /> | ||
</xsd:sequence> | ||
<xsd:attribute name="name" use="required" type="xsd:string" /> | ||
<xsd:attribute name="type" type="xsd:string" /> | ||
<xsd:attribute name="mimetype" type="xsd:string" /> | ||
<xsd:attribute ref="xml:space" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
<xsd:element name="assembly"> | ||
<xsd:complexType> | ||
<xsd:attribute name="alias" type="xsd:string" /> | ||
<xsd:attribute name="name" type="xsd:string" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
<xsd:element name="data"> | ||
<xsd:complexType> | ||
<xsd:sequence> | ||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | ||
</xsd:sequence> | ||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | ||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | ||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | ||
<xsd:attribute ref="xml:space" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
<xsd:element name="resheader"> | ||
<xsd:complexType> | ||
<xsd:sequence> | ||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | ||
</xsd:sequence> | ||
<xsd:attribute name="name" type="xsd:string" use="required" /> | ||
</xsd:complexType> | ||
</xsd:element> | ||
</xsd:choice> | ||
</xsd:complexType> | ||
</xsd:element> | ||
</xsd:schema> | ||
<resheader name="resmimetype"> | ||
<value>text/microsoft-resx</value> | ||
</resheader> | ||
<resheader name="version"> | ||
<value>2.0</value> | ||
</resheader> | ||
<resheader name="reader"> | ||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
<resheader name="writer"> | ||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | ||
</resheader> | ||
<data name="Argument_DestinationTooShort" xml:space="preserve"> | ||
<value>Destination is too short.</value> | ||
</data> | ||
<data name="Format_BadBase64Char" xml:space="preserve"> | ||
<value>The input is not a valid Base64Url string as it contains a non Base64Url character, more than two padding characters, or an illegal character among the padding characters.</value> | ||
</data> | ||
</root> |
Oops, something went wrong.