Formatting fixes

This commit is contained in:
Pranav K 2015-09-18 15:17:41 -07:00
parent 58974a9def
commit ceded805f3
16 changed files with 63 additions and 30 deletions

View File

@ -36,7 +36,7 @@ namespace Microsoft.AspNet.Http.Authentication
/// <summary>
/// Contains metadata about the authentication provider.
/// </summary>
public IDictionary<string, object> Items { get; private set; }
public IDictionary<string, object> Items { get; }
/// <summary>
/// Gets or sets the name used to reference the authentication middleware instance.

View File

@ -40,7 +40,7 @@ namespace Microsoft.AspNet.Http.Authentication
/// <summary>
/// State values about the authentication session.
/// </summary>
public IDictionary<string, string> Items { get; private set; }
public IDictionary<string, string> Items { get; }
/// <summary>
/// Gets or sets whether the authentication session is persisted across multiple requests.

View File

@ -40,9 +40,10 @@ namespace Microsoft.AspNet.Http
/// </summary>
/// <param name="formFile">The <see cref="IFormFile"/>.</param>
/// <param name="filename">The name of the file to create.</param>
public async static Task SaveAsAsync(this IFormFile formFile,
string filename,
CancellationToken cancellationToken = default(CancellationToken))
public async static Task SaveAsAsync(
this IFormFile formFile,
string filename,
CancellationToken cancellationToken = default(CancellationToken))
{
if (formFile == null)
{

View File

@ -20,7 +20,7 @@ namespace Microsoft.AspNet.Http.Headers
Headers = headers;
}
public IHeaderDictionary Headers { get; private set; }
public IHeaderDictionary Headers { get; }
public IList<MediaTypeHeaderValue> Accept
{

View File

@ -21,7 +21,7 @@ namespace Microsoft.AspNet.Http.Headers
Headers = headers;
}
public IHeaderDictionary Headers { get; private set; }
public IHeaderDictionary Headers { get; }
public CacheControlHeaderValue CacheControl
{

View File

@ -18,7 +18,8 @@ namespace Microsoft.AspNet.Http.Extensions
/// <param name="query"></param>
/// <param name="fragment"></param>
/// <returns></returns>
public static string Encode(PathString pathBase = new PathString(),
public static string Encode(
PathString pathBase = new PathString(),
PathString path = new PathString(),
QueryString query = new QueryString(),
FragmentString fragment = new FragmentString())
@ -38,7 +39,8 @@ namespace Microsoft.AspNet.Http.Extensions
/// <param name="query"></param>
/// <param name="fragment"></param>
/// <returns></returns>
public static string Encode(string scheme,
public static string Encode(
string scheme,
HostString host,
PathString pathBase = new PathString(),
PathString path = new PathString(),

View File

@ -18,7 +18,7 @@ namespace Microsoft.AspNet.Http.Internal
Items = items;
}
public IDictionary<object, object> Items { get; private set; }
public IDictionary<object, object> Items { get; }
// Replace the indexer with one that returns null for missing values
object IDictionary<object, object>.this[object key]

View File

@ -390,7 +390,8 @@ namespace Microsoft.Net.Http.Headers
return input.Length - startIndex;
}
private static bool TrySetCacheControlValues(CacheControlHeaderValue cc,
private static bool TrySetCacheControlValues(
CacheControlHeaderValue cc,
List<NameValueHeaderValue> nameValueList)
{
foreach (NameValueHeaderValue nameValue in nameValueList)
@ -477,7 +478,9 @@ namespace Microsoft.Net.Http.Headers
return true;
}
private static bool TrySetOptionalTokenList(NameValueHeaderValue nameValue, ref bool boolField,
private static bool TrySetOptionalTokenList(
NameValueHeaderValue nameValue,
ref bool boolField,
ref ICollection<string> destination)
{
Contract.Requires(nameValue != null);

View File

@ -340,8 +340,16 @@ namespace Microsoft.Net.Http.Headers
return true;
}
private static bool TryCreateContentRange(string input, string unit, int fromStartIndex, int fromLength,
int toStartIndex, int toLength, int lengthStartIndex, int lengthLength, out ContentRangeHeaderValue parsedValue)
private static bool TryCreateContentRange(
string input,
string unit,
int fromStartIndex,
int fromLength,
int toStartIndex,
int toLength,
int lengthStartIndex,
int lengthLength,
out ContentRangeHeaderValue parsedValue)
{
parsedValue = null;

View File

@ -163,7 +163,10 @@ namespace Microsoft.Net.Http.Headers
return true;
}
internal static int GetNextNonEmptyOrWhitespaceIndex(string input, int startIndex, bool skipEmptyValues,
internal static int GetNextNonEmptyOrWhitespaceIndex(
string input,
int startIndex,
bool skipEmptyValues,
out bool separatorFound)
{
Contract.Requires(input != null);

View File

@ -35,8 +35,8 @@ namespace Microsoft.Net.Http.Headers
internal const char CR = '\r';
internal const char LF = '\n';
internal const char SP = ' ';
internal const char Tab = '\t';
internal const char SP = ' ';
internal const char Tab = '\t';
internal const int MaxInt64Digits = 19;
internal const int MaxInt32Digits = 10;
@ -263,8 +263,14 @@ namespace Microsoft.Net.Http.Headers
// "(((((comment)))))". If we wouldn't define a limit an attacker could send a comment with hundreds of nested
// comments, resulting in a stack overflow exception. In addition having more than 1 nested comment (if any)
// is unusual.
private static HttpParseResult GetExpressionLength(string input, int startIndex, char openChar,
char closeChar, bool supportsNesting, ref int nestedCount, out int length)
private static HttpParseResult GetExpressionLength(
string input,
int startIndex,
char openChar,
char closeChar,
bool supportsNesting,
ref int nestedCount,
out int length)
{
Contract.Requires(input != null);
Contract.Requires((startIndex >= 0) && (startIndex < input.Length));

View File

@ -79,8 +79,9 @@ namespace Microsoft.Net.Http.Headers
return returnValue;
}
private static int CompareBasedOnQualityFactor(MediaTypeHeaderValue mediaType1,
MediaTypeHeaderValue mediaType2)
private static int CompareBasedOnQualityFactor(
MediaTypeHeaderValue mediaType1,
MediaTypeHeaderValue mediaType2)
{
var mediaType1Quality = mediaType1.Quality ?? HeaderQuality.Match;
var mediaType2Quality = mediaType2.Quality ?? HeaderQuality.Match;

View File

@ -172,7 +172,10 @@ namespace Microsoft.Net.Http.Headers
return _name;
}
internal static void ToString(ICollection<NameValueHeaderValue> values, char separator, bool leadingSeparator,
internal static void ToString(
ICollection<NameValueHeaderValue> values,
char separator,
bool leadingSeparator,
StringBuilder destination)
{
Contract.Assert(destination != null);
@ -275,7 +278,10 @@ namespace Microsoft.Net.Http.Headers
// Returns the length of a name/value list, separated by 'delimiter'. E.g. "a=b, c=d, e=f" adds 3
// name/value pairs to 'nameValueCollection' if 'delimiter' equals ','.
internal static int GetNameValueListLength(string input, int startIndex, char delimiter,
internal static int GetNameValueListLength(
string input,
int startIndex,
char delimiter,
ICollection<NameValueHeaderValue> nameValueCollection)
{
Contract.Requires(nameValueCollection != null);

View File

@ -86,12 +86,14 @@ namespace Microsoft.Net.Http.Headers
// Returns the length of a range list. E.g. "1-2, 3-4, 5-6" adds 3 ranges to 'rangeCollection'. Note that empty
// list segments are allowed, e.g. ",1-2, , 3-4,,".
internal static int GetRangeItemListLength(string input, int startIndex,
internal static int GetRangeItemListLength(
string input,
int startIndex,
ICollection<RangeItemHeaderValue> rangeCollection)
{
Contract.Requires(rangeCollection != null);
Contract.Requires(startIndex >= 0);
Contract.Ensures((Contract.Result<int>() == 0) || (rangeCollection.Count > 0),
Contract.Ensures((Contract.Result<int>() == 0) || (rangeCollection.Count > 0),
"If we can parse the string, then we expect to have at least one range item.");
if ((string.IsNullOrEmpty(input)) || (startIndex >= input.Length))

View File

@ -38,8 +38,9 @@ namespace Microsoft.Net.Http.Headers
/// <param name="stringWithQuality1">The first value to compare.</param>
/// <param name="stringWithQuality2">The second value to compare</param>
/// <returns>The result of the comparison.</returns>
public int Compare(StringWithQualityHeaderValue stringWithQuality1,
StringWithQualityHeaderValue stringWithQuality2)
public int Compare(
StringWithQualityHeaderValue stringWithQuality1,
StringWithQualityHeaderValue stringWithQuality2)
{
if (stringWithQuality1 == null)
{

View File

@ -569,11 +569,11 @@ namespace Microsoft.Net.Http.Headers
Valid = valid;
}
public string Value { get; private set; }
public string Value { get; }
public string Description { get; private set; }
public string Description { get; }
public bool Valid { get; private set; }
public bool Valid { get; }
}
private void CheckValidParse(string input, ContentDispositionHeaderValue expectedResult)