diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/DotNetOpenAuth/Configuration/ReportingElement.cs | 2 | ||||
-rw-r--r-- | src/DotNetOpenAuth/Reporting.cs | 47 |
2 files changed, 35 insertions, 14 deletions
diff --git a/src/DotNetOpenAuth/Configuration/ReportingElement.cs b/src/DotNetOpenAuth/Configuration/ReportingElement.cs index 68bee74..85eee55 100644 --- a/src/DotNetOpenAuth/Configuration/ReportingElement.cs +++ b/src/DotNetOpenAuth/Configuration/ReportingElement.cs @@ -7,9 +7,9 @@ namespace DotNetOpenAuth.Configuration { using System; using System.Collections.Generic; + using System.Configuration; using System.Linq; using System.Text; - using System.Configuration; /// <summary> /// Represents the <reporting> element in the host's .config file. diff --git a/src/DotNetOpenAuth/Reporting.cs b/src/DotNetOpenAuth/Reporting.cs index f0c0015..209a128 100644 --- a/src/DotNetOpenAuth/Reporting.cs +++ b/src/DotNetOpenAuth/Reporting.cs @@ -7,17 +7,27 @@ namespace DotNetOpenAuth { using System; using System.Collections.Generic; + using System.Diagnostics; + using System.IO; + using System.IO.IsolatedStorage; using System.Linq; + using System.Reflection; using System.Text; using DotNetOpenAuth.Configuration; - using System.IO; - using System.Reflection; - using System.Diagnostics; - using System.IO.IsolatedStorage; + /// <summary> + /// The statistical reporting mechanism used so this library's project authors + /// know what versions and features are in use. + /// </summary> internal static class Reporting { + /// <summary> + /// The writer to use to log statistics. + /// </summary> private static StreamWriter writer; + /// <summary> + /// Initializes static members of the <see cref="Reporting"/> class. + /// </summary> static Reporting() { Enabled = DotNetOpenAuthSection.Configuration.Reporting.Enabled; if (Enabled) { @@ -32,17 +42,15 @@ namespace DotNetOpenAuth { } } - private static StreamWriter OpenReport() { - IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForDomain(); - var assemblyName = new AssemblyName(Assembly.GetExecutingAssembly().FullName); - var fileStream = new IsolatedStorageFileStream("reporting.txt", FileMode.Append, FileAccess.Write, FileShare.Read); - var writer = new StreamWriter(fileStream, Encoding.UTF8); - writer.AutoFlush = true; - return writer; - } - + /// <summary> + /// Gets or sets a value indicating whether this reporting is enabled. + /// </summary> + /// <value><c>true</c> if enabled; otherwise, <c>false</c>.</value> private static bool Enabled { get; set; } + /// <summary> + /// Called when an OpenID RP successfully authenticates someone. + /// </summary> internal static void OnAuthenticated() { if (!Enabled) { return; @@ -50,5 +58,18 @@ namespace DotNetOpenAuth { writer.Write("L"); } + + /// <summary> + /// Opens the report file for append. + /// </summary> + /// <returns>The writer to use.</returns> + private static StreamWriter OpenReport() { + IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForDomain(); + var assemblyName = new AssemblyName(Assembly.GetExecutingAssembly().FullName); + var fileStream = new IsolatedStorageFileStream("reporting.txt", FileMode.Append, FileAccess.Write, FileShare.Read); + var writer = new StreamWriter(fileStream, Encoding.UTF8); + writer.AutoFlush = true; + return writer; + } } } |