Skip to content
Snippets Groups Projects
Commit 783ed583 authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Use C# 6.0 style for setting defaults on auto-properties.

This way the value is directly visible in the code where the property is
created, improving readability. Setting defaults in the constructor is
therefore not necessary any more.

Refers to #29
parent d13bee87
Branches
Tags
No related merge requests found
...@@ -79,9 +79,9 @@ namespace ATxCommon.Serializables ...@@ -79,9 +79,9 @@ namespace ATxCommon.Serializables
#region optional configuration parameters #region optional configuration parameters
/// <summary> /// <summary>
/// Switch on debug log messages. /// Switch on debug log messages. Default: false.
/// </summary> /// </summary>
public bool Debug { get; set; } public bool Debug { get; set; } = false;
/// <summary> /// <summary>
/// The name of a marker file to be placed in all **sub**directories /// The name of a marker file to be placed in all **sub**directories
...@@ -95,9 +95,9 @@ namespace ATxCommon.Serializables ...@@ -95,9 +95,9 @@ namespace ATxCommon.Serializables
public string SmtpHost { get; set; } public string SmtpHost { get; set; }
/// <summary> /// <summary>
/// SMTP port for sending emails (default: 25). /// SMTP port for sending emails. Default: 25.
/// </summary> /// </summary>
public int SmtpPort { get; set; } public int SmtpPort { get; set; } = 25;
/// <summary> /// <summary>
/// SMTP username to authenticate when sending emails (if required). /// SMTP username to authenticate when sending emails (if required).
...@@ -115,9 +115,9 @@ namespace ATxCommon.Serializables ...@@ -115,9 +115,9 @@ namespace ATxCommon.Serializables
public string EmailFrom { get; set; } public string EmailFrom { get; set; }
/// <summary> /// <summary>
/// A string to be added as a prefix to the subject when sending emails. /// A prefix to be added to any email subject. Default: "[AutoTx Service] ".
/// </summary> /// </summary>
public string EmailPrefix { get; set; } public string EmailPrefix { get; set; } = "[AutoTx Service] ";
/// <summary> /// <summary>
/// The mail recipient address for admin notifications (including "Fatal" log messages). /// The mail recipient address for admin notifications (including "Fatal" log messages).
...@@ -130,36 +130,34 @@ namespace ATxCommon.Serializables ...@@ -130,36 +130,34 @@ namespace ATxCommon.Serializables
public string AdminDebugEmailAdress { get; set; } public string AdminDebugEmailAdress { get; set; }
/// <summary> /// <summary>
/// Flag whether to send a mail notification to the user upon completed transfers. /// Send an email to the user upon completed transfers. Default: true.
/// </summary> /// </summary>
public bool SendTransferNotification { get; set; } public bool SendTransferNotification { get; set; } = true;
/// <summary> /// <summary>
/// Flag whether to send explicit mail notifications to the admin on selected events. /// Send email notifications to the admin on selected events. Default: true.
/// </summary> /// </summary>
public bool SendAdminNotification { get; set; } public bool SendAdminNotification { get; set; } = true;
/// <summary> /// <summary>
/// Minimum time in minutes between two notifications to the admin, default: 60. /// Minimum time in minutes between two notifications to the admin. Default: 60.
/// </summary> /// </summary>
public int AdminNotificationDelta { get; set; } public int AdminNotificationDelta { get; set; } = 60;
/// <summary> /// <summary>
/// Minimum time in minutes between two mails about expired folders in the grace location, /// Minimum time in minutes between two mails about expired folders. Default: 720 (12h).
/// default: 720 (12h).
/// </summary> /// </summary>
public int GraceNotificationDelta { get; set; } public int GraceNotificationDelta { get; set; } = 720;
/// <summary> /// <summary>
/// Minimum time in minutes between two low-space notifications, default: 720 (12h). /// Minimum time in minutes between two low-space notifications. Default: 720 (12h).
/// </summary> /// </summary>
public int StorageNotificationDelta { get; set; } public int StorageNotificationDelta { get; set; } = 720;
/// <summary> /// <summary>
/// GracePeriod: number of days after data in the "DONE" location expires, /// Number of days after data in the "DONE" location expires. Default: 30.
/// which will trigger a summary email to the admin address, default: 30.
/// </summary> /// </summary>
public int GracePeriod { get; set; } public int GracePeriod { get; set; } = 30;
/// <summary> /// <summary>
/// A list of process names causing transfers to be suspended if running. /// A list of process names causing transfers to be suspended if running.
...@@ -169,10 +167,10 @@ namespace ATxCommon.Serializables ...@@ -169,10 +167,10 @@ namespace ATxCommon.Serializables
public List<string> BlacklistedProcesses { get; set; } public List<string> BlacklistedProcesses { get; set; }
/// <summary> /// <summary>
/// EnforceInheritedACLs: whether to enforce ACL inheritance when moving files and /// Whether to enforce ACL inheritance when moving files and directories, see
/// directories, see https://support.microsoft.com/en-us/help/320246 for more details. /// https://support.microsoft.com/en-us/help/320246 for more details. Default: false.
/// </summary> /// </summary>
public bool EnforceInheritedACLs { get; set; } public bool EnforceInheritedACLs { get; set; } = false;
/// <summary> /// <summary>
/// A list of drives and thresholds to monitor free space. /// A list of drives and thresholds to monitor free space.
...@@ -182,10 +180,10 @@ namespace ATxCommon.Serializables ...@@ -182,10 +180,10 @@ namespace ATxCommon.Serializables
public List<DriveToCheck> SpaceMonitoring { get; set; } public List<DriveToCheck> SpaceMonitoring { get; set; }
/// <summary> /// <summary>
/// RoboCopy parameter for limiting the bandwidth (mostly for testing purposes). /// Limit RoboCopy transfer bandwidth (mostly for testing purposes). Default: 0.
/// </summary> /// </summary>
/// See the RoboCopy documentation for more details. /// See the RoboCopy documentation for more details.
public int InterPacketGap { get; set; } public int InterPacketGap { get; set; } = 0;
#endregion #endregion
...@@ -226,34 +224,10 @@ namespace ATxCommon.Serializables ...@@ -226,34 +224,10 @@ namespace ATxCommon.Serializables
/// <summary> /// <summary>
/// Constructor setting default values for optional parameters.
/// </summary>
public ServiceConfig() { public ServiceConfig() {
Log.Trace("ServiceConfig() constructor, setting defaults."); /// ServiceConfig constructor, currently empty.
// set values for the optional XML elements (NOTE: parameters / variables that do not /// </summary>
// strictly REQUIRE a value are listed here as comments to denote they have not just Log.Trace("ServiceConfig() constructor.");
// been forgotten but an empty value is fine instead:
Debug = false;
// MarkerFile may be empty
// SmtpHost may be empty
SmtpPort = 25;
// SmtpUserCredential may be empty
// SmtpPasswortCredential may be empty
// EmailFrom may be empty
EmailPrefix = "[AutoTx Service] ";
// AdminEmailAdress may be empty
// AdminDebugEmailAdress may be empty
SendTransferNotification = true;
SendAdminNotification = true;
AdminNotificationDelta = 60;
GraceNotificationDelta = 720;
StorageNotificationDelta = 720;
GracePeriod = 30;
// BlacklistedProcesses may be empty
EnforceInheritedACLs = true;
// SpaceMonitoring may be empty
InterPacketGap = 0;
} }
/// <summary> /// <summary>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment