summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Messaging
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2011-08-07 06:56:28 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2011-08-07 06:56:28 -0700
commite2a578bc77b81b1aa896edd6fa4ab2c7b8f2ceb8 (patch)
treecefb480e0278a2b8ad0160fe11f3d72a61e13286 /src/DotNetOpenAuth.Messaging
parent602235cb155d108e5f22627e1f4a07041ae3693e (diff)
downloadDotNetOpenAuth-e2a578bc77b81b1aa896edd6fa4ab2c7b8f2ceb8.zip
DotNetOpenAuth-e2a578bc77b81b1aa896edd6fa4ab2c7b8f2ceb8.tar.gz
DotNetOpenAuth-e2a578bc77b81b1aa896edd6fa4ab2c7b8f2ceb8.tar.bz2
StyleCop work.
Diffstat (limited to 'src/DotNetOpenAuth.Messaging')
-rw-r--r--src/DotNetOpenAuth.Messaging/Configuration/DotNetOpenAuthSection.cs22
-rw-r--r--src/DotNetOpenAuth.Messaging/Configuration/ReportingElement.cs2
-rw-r--r--src/DotNetOpenAuth.Messaging/Configuration/UntrustedWebRequestElement.cs2
-rw-r--r--src/DotNetOpenAuth.Messaging/Messaging/Reflection/MessagePart.cs44
-rw-r--r--src/DotNetOpenAuth.Messaging/Reporting.cs31
5 files changed, 58 insertions, 43 deletions
diff --git a/src/DotNetOpenAuth.Messaging/Configuration/DotNetOpenAuthSection.cs b/src/DotNetOpenAuth.Messaging/Configuration/DotNetOpenAuthSection.cs
index 5e2a494..b4dfc15 100644
--- a/src/DotNetOpenAuth.Messaging/Configuration/DotNetOpenAuthSection.cs
+++ b/src/DotNetOpenAuth.Messaging/Configuration/DotNetOpenAuthSection.cs
@@ -45,17 +45,29 @@ namespace DotNetOpenAuth.Configuration {
}
}
+ /// <summary>
+ /// Gets the messaging configuration element.
+ /// </summary>
public static MessagingElement Messaging {
get { return MessagingElement.Configuration; }
}
- internal TypeConfigurationElement<IEmbeddedResourceRetrieval> EmbeddedResourceRetrievalProvider {
- get { return /*(TypeConfigurationElement<IEmbeddedResourceRetrieval>)this[WebResourceUrlProviderName] ??*/ new TypeConfigurationElement<IEmbeddedResourceRetrieval>(); }
- set { /*this[WebResourceUrlProviderName] = value;*/ }
- }
-
+ /// <summary>
+ /// Gets the reporting configuration element.
+ /// </summary>
internal static ReportingElement Reporting {
get { return ReportingElement.Configuration; }
}
+
+ /// <summary>
+ /// Gets or sets the embedded resource retrieval provider.
+ /// </summary>
+ /// <value>
+ /// The embedded resource retrieval provider.
+ /// </value>
+ internal TypeConfigurationElement<IEmbeddedResourceRetrieval> EmbeddedResourceRetrievalProvider {
+ get { return /*TODO: (TypeConfigurationElement<IEmbeddedResourceRetrieval>)this[WebResourceUrlProviderName] ??*/ new TypeConfigurationElement<IEmbeddedResourceRetrieval>(); }
+ set { /*this[WebResourceUrlProviderName] = value;*/ }
+ }
}
}
diff --git a/src/DotNetOpenAuth.Messaging/Configuration/ReportingElement.cs b/src/DotNetOpenAuth.Messaging/Configuration/ReportingElement.cs
index 3cd0af1..a8eb7d3 100644
--- a/src/DotNetOpenAuth.Messaging/Configuration/ReportingElement.cs
+++ b/src/DotNetOpenAuth.Messaging/Configuration/ReportingElement.cs
@@ -8,9 +8,9 @@ namespace DotNetOpenAuth.Configuration {
using System;
using System.Collections.Generic;
using System.Configuration;
+ using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
- using System.Diagnostics.Contracts;
/// <summary>
/// Represents the &lt;reporting&gt; element in the host's .config file.
diff --git a/src/DotNetOpenAuth.Messaging/Configuration/UntrustedWebRequestElement.cs b/src/DotNetOpenAuth.Messaging/Configuration/UntrustedWebRequestElement.cs
index 40a3d0c..f5a142a 100644
--- a/src/DotNetOpenAuth.Messaging/Configuration/UntrustedWebRequestElement.cs
+++ b/src/DotNetOpenAuth.Messaging/Configuration/UntrustedWebRequestElement.cs
@@ -72,7 +72,7 @@ namespace DotNetOpenAuth.Configuration {
return (UntrustedWebRequestElement)ConfigurationManager.GetSection(WebResourceUrlProviderName) ?? new UntrustedWebRequestElement();
}
}
-
+
/// <summary>
/// Gets or sets the read/write timeout after which an HTTP request will fail.
/// </summary>
diff --git a/src/DotNetOpenAuth.Messaging/Messaging/Reflection/MessagePart.cs b/src/DotNetOpenAuth.Messaging/Messaging/Reflection/MessagePart.cs
index 80ceefd..83f489a 100644
--- a/src/DotNetOpenAuth.Messaging/Messaging/Reflection/MessagePart.cs
+++ b/src/DotNetOpenAuth.Messaging/Messaging/Reflection/MessagePart.cs
@@ -212,6 +212,28 @@ namespace DotNetOpenAuth.Messaging.Reflection {
}
/// <summary>
+ /// Adds a pair of type conversion functions to the static conversion map.
+ /// </summary>
+ /// <typeparam name="T">The custom type to convert to and from strings.</typeparam>
+ /// <param name="toString">The function to convert the custom type to a string.</param>
+ /// <param name="toOriginalString">The mapping function that converts some custom value to its original (non-normalized) string. May be null if the same as the <paramref name="toString"/> function.</param>
+ /// <param name="toValue">The function to convert a string to the custom type.</param>
+ [SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "System.Diagnostics.Contracts.__ContractsRuntime.Requires<System.ArgumentNullException>(System.Boolean,System.String,System.String)", Justification = "Code contracts"), SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "toString", Justification = "Code contracts"), SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "toValue", Justification = "Code contracts")]
+ internal static void Map<T>(Func<T, string> toString, Func<T, string> toOriginalString, Func<string, T> toValue) {
+ Contract.Requires<ArgumentNullException>(toString != null);
+ Contract.Requires<ArgumentNullException>(toValue != null);
+
+ if (toOriginalString == null) {
+ toOriginalString = toString;
+ }
+
+ Func<object, string> safeToString = obj => obj != null ? toString((T)obj) : null;
+ Func<object, string> safeToOriginalString = obj => obj != null ? toOriginalString((T)obj) : null;
+ Func<string, object> safeToT = str => str != null ? toValue(str) : default(T);
+ converters.Add(typeof(T), new ValueMapping(safeToString, safeToOriginalString, safeToT));
+ }
+
+ /// <summary>
/// Sets the member of a given message to some given value.
/// Used in deserialization.
/// </summary>
@@ -299,28 +321,6 @@ namespace DotNetOpenAuth.Messaging.Reflection {
}
/// <summary>
- /// Adds a pair of type conversion functions to the static conversion map.
- /// </summary>
- /// <typeparam name="T">The custom type to convert to and from strings.</typeparam>
- /// <param name="toString">The function to convert the custom type to a string.</param>
- /// <param name="toOriginalString">The mapping function that converts some custom value to its original (non-normalized) string. May be null if the same as the <paramref name="toString"/> function.</param>
- /// <param name="toValue">The function to convert a string to the custom type.</param>
- [SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "System.Diagnostics.Contracts.__ContractsRuntime.Requires<System.ArgumentNullException>(System.Boolean,System.String,System.String)", Justification = "Code contracts"), SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "toString", Justification = "Code contracts"), SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "toValue", Justification = "Code contracts")]
- internal static void Map<T>(Func<T, string> toString, Func<T, string> toOriginalString, Func<string, T> toValue) {
- Contract.Requires<ArgumentNullException>(toString != null);
- Contract.Requires<ArgumentNullException>(toValue != null);
-
- if (toOriginalString == null) {
- toOriginalString = toString;
- }
-
- Func<object, string> safeToString = obj => obj != null ? toString((T)obj) : null;
- Func<object, string> safeToOriginalString = obj => obj != null ? toOriginalString((T)obj) : null;
- Func<string, object> safeToT = str => str != null ? toValue(str) : default(T);
- converters.Add(typeof(T), new ValueMapping(safeToString, safeToOriginalString, safeToT));
- }
-
- /// <summary>
/// Checks whether a type is a nullable value type (i.e. int?)
/// </summary>
/// <param name="type">The type in question.</param>
diff --git a/src/DotNetOpenAuth.Messaging/Reporting.cs b/src/DotNetOpenAuth.Messaging/Reporting.cs
index c528972..f197e81 100644
--- a/src/DotNetOpenAuth.Messaging/Reporting.cs
+++ b/src/DotNetOpenAuth.Messaging/Reporting.cs
@@ -142,6 +142,9 @@ namespace DotNetOpenAuth {
}
}
+ /// <summary>
+ /// Gets the observed features.
+ /// </summary>
internal static PersistentHashSet ObservedFeatures {
get { return observedFeatures; }
}
@@ -312,6 +315,20 @@ namespace DotNetOpenAuth {
}
/// <summary>
+ /// Called by every internal/public method on this class to give
+ /// periodic operations a chance to run.
+ /// </summary>
+ protected static void Touch() {
+ // Publish stats if it's time to do so.
+ lock (publishingConsiderationLock) {
+ if (DateTime.Now - lastPublished > Configuration.MinimumReportingInterval) {
+ lastPublished = DateTime.Now;
+ SendStatsAsync();
+ }
+ }
+ }
+
+ /// <summary>
/// Initializes Reporting if it has not been initialized yet.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "This method must never throw.")]
@@ -483,20 +500,6 @@ namespace DotNetOpenAuth {
}
/// <summary>
- /// Called by every internal/public method on this class to give
- /// periodic operations a chance to run.
- /// </summary>
- protected static void Touch() {
- // Publish stats if it's time to do so.
- lock (publishingConsiderationLock) {
- if (DateTime.Now - lastPublished > Configuration.MinimumReportingInterval) {
- lastPublished = DateTime.Now;
- SendStatsAsync();
- }
- }
- }
-
- /// <summary>
/// Sends the stats report asynchronously, and careful to not throw any unhandled exceptions.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Unhandled exceptions MUST NOT be thrown from here.")]