DOCUMENTATION: Added XML documentation to DiscImageChef.Settings.

This commit is contained in:
2017-12-23 02:41:37 +00:00
parent 27da8f2227
commit c3a3caf4e2

View File

@@ -40,42 +40,109 @@ using PlatformID = DiscImageChef.Interop.PlatformID;
namespace DiscImageChef.Settings
{
/// <summary>
/// Settings
/// </summary>
public class DicSettings
{
/// <summary>
/// Statistics
/// </summary>
public StatsSettings Stats;
/// <summary>
/// If set to <c>true</c>, reports will be saved locally
/// </summary>
public bool SaveReportsGlobally;
/// <summary>
/// If set to <c>true</c>, reports will be sent to DiscImageChef.Server
/// </summary>
public bool ShareReports;
}
// TODO: Use this
/// <summary>
/// User settings, for media dumps, completely unused
/// </summary>
public class UserSettings
{
public string Name;
public string Email;
}
/// <summary>
/// Statistics settings
/// </summary>
public class StatsSettings
{
/// <summary>
/// If set to <c>true</c>, statistics will be sent to DiscImageChef.Server
/// </summary>
public bool ShareStats;
/// <summary>
/// If set to <c>true</c>, benchmark statistics will be stored
/// </summary>
public bool BenchmarkStats;
/// <summary>
/// If set to <c>true</c>, command usage statistics will be stored
/// </summary>
public bool CommandStats;
/// <summary>
/// If set to <c>true</c>, device statistics will be stored
/// </summary>
public bool DeviceStats;
/// <summary>
/// If set to <c>true</c>, filesystem statistics will be stored
/// </summary>
public bool FilesystemStats;
/// <summary>
/// If set to <c>true</c>, filters statistics will be stored
/// </summary>
public bool FilterStats;
/// <summary>
/// If set to <c>true</c>, dump media images statistics will be stored
/// </summary>
public bool MediaImageStats;
/// <summary>
/// If set to <c>true</c>, media scan statistics will be stored
/// </summary>
public bool MediaScanStats;
/// <summary>
/// If set to <c>true</c>, partition schemes statistics will be stored
/// </summary>
public bool PartitionStats;
/// <summary>
/// If set to <c>true</c>, media types statistics will be stored
/// </summary>
public bool MediaStats;
/// <summary>
/// If set to <c>true</c>, dump media verification statistics will be stored
/// </summary>
public bool VerifyStats;
}
/// <summary>
/// Manages statistics
/// </summary>
public static class Settings
{
/// <summary>
/// Current statistcs
/// </summary>
public static DicSettings Current;
/// <summary>
/// Global path to save reports
/// </summary>
static string ReportsPath { get; set; }
/// <summary>
/// Global path to save statistics
/// </summary>
public static string StatsPath { get; private set; }
/// <summary>
/// Loads settings
/// </summary>
public static void LoadSettings()
{
Current = new DicSettings();
@@ -85,6 +152,7 @@ namespace DiscImageChef.Settings
{
switch(ptId)
{
// In case of macOS or iOS statistics and reports will be saved in ~/Library/Application Support/Claunia.com/DiscImageChef
case PlatformID.MacOSX:
case PlatformID.iOS:
{
@@ -103,6 +171,7 @@ namespace DiscImageChef.Settings
if(!Directory.Exists(StatsPath)) Directory.CreateDirectory(StatsPath);
}
break;
// In case of Windows statistics and reports will be saved in %APPDATA%\Claunia.com\DiscImageChef
case PlatformID.Win32NT:
case PlatformID.Win32S:
case PlatformID.Win32Windows:
@@ -124,6 +193,7 @@ namespace DiscImageChef.Settings
if(!Directory.Exists(StatsPath)) Directory.CreateDirectory(StatsPath);
}
break;
// Otherwise, statistics and reports will be saved in ~/.claunia.com/DiscImageChef
default:
{
string appSupportPath =
@@ -152,6 +222,7 @@ namespace DiscImageChef.Settings
{
switch(ptId)
{
// In case of macOS or iOS settings will be saved in ~/Library/Preferences/com.claunia.discimagechef.plist
case PlatformID.MacOSX:
case PlatformID.iOS:
{
@@ -222,6 +293,7 @@ namespace DiscImageChef.Settings
}
}
break;
// In case of Windows settings will be saved in the registry: HKLM/SOFTWARE/Claunia.com/DiscImageChef
case PlatformID.Win32NT:
case PlatformID.Win32S:
case PlatformID.Win32Windows:
@@ -268,6 +340,7 @@ namespace DiscImageChef.Settings
}
break;
// Otherwise, settings will be saved in ~/.config/DiscImageChef.xml
default:
{
string configPath =
@@ -306,6 +379,7 @@ namespace DiscImageChef.Settings
switch(ptId)
{
// In case of macOS or iOS settings will be saved in ~/Library/Preferences/com.claunia.discimagechef.plist
case PlatformID.MacOSX:
case PlatformID.iOS:
{
@@ -343,6 +417,7 @@ namespace DiscImageChef.Settings
fs.Close();
}
break;
// In case of Windows settings will be saved in the registry: HKLM/SOFTWARE/Claunia.com/DiscImageChef
case PlatformID.Win32NT:
case PlatformID.Win32S:
case PlatformID.Win32Windows:
@@ -390,6 +465,7 @@ namespace DiscImageChef.Settings
}
}
break;
// Otherwise, settings will be saved in ~/.config/DiscImageChef.xml
default:
{
string configPath =
@@ -412,6 +488,9 @@ namespace DiscImageChef.Settings
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
}
/// <summary>
/// Sets default settings as all statistics, share everything
/// </summary>
static void SetDefaultSettings()
{
Current = new DicSettings