Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #599 from WideSpectrumComputing/master
Fixing VS build warnings and intelli-sense suggestions
- Loading branch information
Showing
36 changed files
with
226 additions
and
513 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
This file was deleted.
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
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
18 changes: 12 additions & 6 deletions
18
Rollbar.OfflinePersistence/Migrations/20210908194226_InitialWithScaffold.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
2 changes: 1 addition & 1 deletion
2
Rollbar.PlugIns.MSEnterpriseLibrary/Rollbar.PlugIns.MSEnterpriseLibrary.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
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
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,44 +1,84 @@ | ||
namespace Rollbar.Common | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.Specialized; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
/// <summary> | ||
/// Class NameValueCollectionExtension. | ||
/// </summary> | ||
public static class NameValueCollectionExtension | ||
{ | ||
/// <summary> | ||
/// Converts to string dictionary (where keys are strings and values are strings). | ||
/// Converts to a string dictionary (where keys are strings and values are strings). | ||
/// </summary> | ||
/// <param name="nvc">The NVC.</param> | ||
/// <returns>IDictionary<System.String, System.String>.</returns> | ||
public static IDictionary<string, string> ToStringDictionary(this NameValueCollection nvc) | ||
public static IDictionary<string, string?> ToStringDictionary(this NameValueCollection nvc) | ||
{ | ||
if (nvc == null || nvc.Count == 0) | ||
{ | ||
return new Dictionary<string, string>(); | ||
return new Dictionary<string, string?>(0); | ||
} | ||
|
||
return nvc.AllKeys.Where(n => n != null).ToDictionary(k => k, k => nvc[k]); | ||
return nvc.AllKeys.Where(n => n != null).Cast<string>().ToDictionary(k => k, k => nvc[k] as string ?? null); | ||
} | ||
|
||
/// <summary> | ||
/// Converts to object dictionary (where keys are strings and values are objects). | ||
/// Converts to a compact (excluding null-values) string dictionary (where keys are strings and values are strings). | ||
/// </summary> | ||
/// <param name="nvc">The NVC.</param> | ||
/// <returns>IDictionary<System.String, System.String>.</returns> | ||
public static IDictionary<string, string> ToCompactStringDictionary(this NameValueCollection nvc) | ||
{ | ||
var headers = NameValueCollectionExtension.ToStringDictionary(nvc); | ||
|
||
var compactedHeaders = new Dictionary<string, string>(headers.Count); | ||
foreach (var kvp in headers) | ||
{ | ||
if (kvp.Value != null) | ||
{ | ||
compactedHeaders[kvp.Key] = kvp.Value; | ||
} | ||
} | ||
|
||
return compactedHeaders; | ||
} | ||
|
||
/// <summary> | ||
/// Converts to an object dictionary (where keys are strings and values are objects). | ||
/// </summary> | ||
/// <param name="nvc">The NVC.</param> | ||
/// <returns>IDictionary<System.String, System.Object>.</returns> | ||
public static IDictionary<string, object> ToObjectDictionary(this NameValueCollection nvc) | ||
public static IDictionary<string, object?> ToObjectDictionary(this NameValueCollection nvc) | ||
{ | ||
if (nvc == null || nvc.Count == 0) | ||
{ | ||
return new Dictionary<string, object>(); | ||
return new Dictionary<string, object?>(0); | ||
} | ||
|
||
return nvc.AllKeys.Where(n => n != null).Cast<string>().ToDictionary(k => k, k => nvc[k] as object ?? null); | ||
} | ||
|
||
/// <summary> | ||
/// Converts to a compact (excluding null-values) object dictionary (where keys are strings and values are objects). | ||
/// </summary> | ||
/// <param name="nvc">The NVC.</param> | ||
/// <returns>IDictionary<System.String, System.Object>.</returns> | ||
public static IDictionary<string, object> ToCompactObjectDictionary(this NameValueCollection nvc) | ||
{ | ||
var headers = NameValueCollectionExtension.ToObjectDictionary(nvc); | ||
|
||
var compactedHeaders = new Dictionary<string, object>(headers.Count); | ||
foreach (var kvp in headers) | ||
{ | ||
if (kvp.Value != null) | ||
{ | ||
compactedHeaders[kvp.Key] = kvp.Value; | ||
} | ||
} | ||
|
||
return nvc.AllKeys.Where(n => n != null).ToDictionary(k => k, k => nvc[k] as object); | ||
return compactedHeaders; | ||
} | ||
} | ||
} |
Oops, something went wrong.