DiagnosticConfiguration
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Relativity.Transfer
{
[Serializable]
public sealed class DiagnosticConfiguration : Dictionary<string, object>
{
public const bool DefaultDeleteUploadTestFiles = false;
public const bool DefaultDirectFileExistCheck = false;
public const bool DefaultUploadValidation = true;
public bool DeleteUploadTestFiles {
get {
return this.GetBooleanValue("delete-upload-test-files", false);
}
set {
base["delete-upload-test-files"] = value;
}
}
public bool DirectFileExistCheck {
get {
return this.GetBooleanValue("direct-file-exist-check", false);
}
set {
base["direct-file-exist-check"] = value;
}
}
public bool UploadValidation {
get {
return this.GetBooleanValue("upload-validation", true);
}
set {
base["upload-validation"] = value;
}
}
public DiagnosticConfiguration()
{
Initialize(true);
}
public DiagnosticConfiguration(IDictionary<string, object> dictionary)
: base(dictionary)
{
Initialize(false);
}
private DiagnosticConfiguration(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
public void Copy(IDictionary<string, object> properties)
{
Copy(properties, true);
}
public void Copy(IDictionary<string, object> properties, bool overwrite)
{
if (properties == null)
throw new ArgumentNullException("properties");
foreach (KeyValuePair<string, object> property in properties) {
if (overwrite || !ContainsKey(property.Key))
base[property.Key] = property.Value;
}
}
private void Initialize(bool overwrite)
{
Dictionary<string, object> properties = new Dictionary<string, object> {
{
"delete-upload-test-files",
false
},
{
"upload-validation",
true
},
{
"direct-file-exist-check",
false
}
};
Copy(properties, overwrite);
}
}
}