forked from BeyondDimension/SteamTools
-
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.
Fix System.TypeLoadException: Could not resolve type with token 01000026 from typeref (expected class 'Microsoft.Extensions.Primitives.InplaceStringBuilder' in assembly 'Microsoft.Extensions.Primitives, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60')
- Loading branch information
Showing
35 changed files
with
7,092 additions
and
152 deletions.
There are no files selected for viewing
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
Submodule ArchiSteamFarm
updated
from 9e884f to cd8861
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,72 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.Extensions.Primitives; | ||
|
||
namespace Microsoft.Net.Http.Headers | ||
{ | ||
internal abstract class BaseHeaderParser<T> : HttpHeaderParser<T> | ||
{ | ||
protected BaseHeaderParser(bool supportsMultipleValues) | ||
: base(supportsMultipleValues) | ||
{ | ||
} | ||
|
||
protected abstract int GetParsedValueLength(StringSegment value, int startIndex, out T parsedValue); | ||
|
||
public sealed override bool TryParseValue(StringSegment value, ref int index, out T parsedValue) | ||
{ | ||
parsedValue = default(T); | ||
|
||
// If multiple values are supported (i.e. list of values), then accept an empty string: The header may | ||
// be added multiple times to the request/response message. E.g. | ||
// Accept: text/xml; q=1 | ||
// Accept: | ||
// Accept: text/plain; q=0.2 | ||
if (StringSegment.IsNullOrEmpty(value) || (index == value.Length)) | ||
{ | ||
return SupportsMultipleValues; | ||
} | ||
|
||
var separatorFound = false; | ||
var current = HeaderUtilities.GetNextNonEmptyOrWhitespaceIndex(value, index, SupportsMultipleValues, | ||
out separatorFound); | ||
|
||
if (separatorFound && !SupportsMultipleValues) | ||
{ | ||
return false; // leading separators not allowed if we don't support multiple values. | ||
} | ||
|
||
if (current == value.Length) | ||
{ | ||
if (SupportsMultipleValues) | ||
{ | ||
index = current; | ||
} | ||
return SupportsMultipleValues; | ||
} | ||
|
||
T result; | ||
var length = GetParsedValueLength(value, current, out result); | ||
|
||
if (length == 0) | ||
{ | ||
return false; | ||
} | ||
|
||
current = current + length; | ||
current = HeaderUtilities.GetNextNonEmptyOrWhitespaceIndex(value, current, SupportsMultipleValues, | ||
out separatorFound); | ||
|
||
// If we support multiple values and we've not reached the end of the string, then we must have a separator. | ||
if ((separatorFound && !SupportsMultipleValues) || (!separatorFound && (current < value.Length))) | ||
{ | ||
return false; | ||
} | ||
|
||
index = current; | ||
parsedValue = result; | ||
return true; | ||
} | ||
} | ||
} |
Oops, something went wrong.