Files
Dec2017-Script-Dump/System/Diagnostics/Switch.cs
T
2026-06-04 11:42:34 +02:00

177 lines
6.0 KiB
C#

using System;
using System.Collections;
using System.Collections.Specialized;
namespace System.Diagnostics
{
/// <summary>Provides an abstract base class to create new debugging and tracing switches.</summary>
/// <filterpriority>2</filterpriority>
// Token: 0x020000F5 RID: 245
public abstract class Switch
{
/// <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Switch" /> class.</summary>
/// <param name="displayName">The name of the switch. </param>
/// <param name="description">The description for the switch. </param>
// Token: 0x060008A4 RID: 2212 RVA: 0x00016E64 File Offset: 0x00015064
protected Switch(string displayName, string description)
{
this.name = displayName;
this.description = description;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Diagnostics.Switch" /> class, specifying the display name, description, and default value for the switch. </summary>
/// <param name="displayName">The name of the switch. </param>
/// <param name="description">The description of the switch. </param>
/// <param name="defaultSwitchValue">The default value for the switch.</param>
// Token: 0x060008A5 RID: 2213 RVA: 0x00016E88 File Offset: 0x00015088
protected Switch(string displayName, string description, string defaultSwitchValue)
: this(displayName, description)
{
this.defaultSwitchValue = defaultSwitchValue;
}
/// <summary>Gets a description of the switch.</summary>
/// <returns>The description of the switch. The default value is an empty string ("").</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x17000249 RID: 585
// (get) Token: 0x060008A6 RID: 2214 RVA: 0x00016E9C File Offset: 0x0001509C
public string Description
{
get
{
return this.description;
}
}
/// <summary>Gets a name used to identify the switch.</summary>
/// <returns>The name used to identify the switch. The default value is an empty string ("").</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x1700024A RID: 586
// (get) Token: 0x060008A7 RID: 2215 RVA: 0x00016EA4 File Offset: 0x000150A4
public string DisplayName
{
get
{
return this.name;
}
}
/// <summary>Gets or sets the current setting for this switch.</summary>
/// <returns>The current setting for this switch. The default is zero.</returns>
// Token: 0x1700024B RID: 587
// (get) Token: 0x060008A8 RID: 2216 RVA: 0x00016EAC File Offset: 0x000150AC
// (set) Token: 0x060008A9 RID: 2217 RVA: 0x00016EE0 File Offset: 0x000150E0
protected int SwitchSetting
{
get
{
if (!this.initialized)
{
this.initialized = true;
this.GetConfigFileSetting();
this.OnSwitchSettingChanged();
}
return this.switchSetting;
}
set
{
if (this.switchSetting != value)
{
this.switchSetting = value;
this.OnSwitchSettingChanged();
}
this.initialized = true;
}
}
/// <summary>Gets the custom switch attributes defined in the application configuration file.</summary>
/// <returns>A <see cref="T:System.Collections.Specialized.StringDictionary" /> containing the case-insensitive custom attributes for the trace switch.</returns>
/// <filterpriority>1</filterpriority>
// Token: 0x1700024C RID: 588
// (get) Token: 0x060008AA RID: 2218 RVA: 0x00016F10 File Offset: 0x00015110
public global::System.Collections.Specialized.StringDictionary Attributes
{
get
{
return this.attributes;
}
}
/// <summary>Gets or sets the value of the switch.</summary>
/// <returns>A string representing the value of the switch.</returns>
/// <exception cref="T:System.Configuration.ConfigurationErrorsException">The value is null.-or-The value does not consist solely of an optional negative sign followed by a sequence of digits ranging from 0 to 9.-or-The value represents a number less than <see cref="F:System.Int32.MinValue" /> or greater than <see cref="F:System.Int32.MaxValue" />.</exception>
// Token: 0x1700024D RID: 589
// (get) Token: 0x060008AB RID: 2219 RVA: 0x00016F18 File Offset: 0x00015118
// (set) Token: 0x060008AC RID: 2220 RVA: 0x00016F20 File Offset: 0x00015120
protected string Value
{
get
{
return this.value;
}
set
{
this.value = value;
this.OnValueChanged();
}
}
/// <summary>Gets the custom attributes supported by the switch.</summary>
/// <returns>A string array that contains the names of the custom attributes supported by the switch, or null if there no custom attributes are supported.</returns>
// Token: 0x060008AD RID: 2221 RVA: 0x00016F30 File Offset: 0x00015130
protected internal virtual string[] GetSupportedAttributes()
{
return null;
}
/// <summary>Invoked when the <see cref="P:System.Diagnostics.Switch.Value" /> property is changed.</summary>
// Token: 0x060008AE RID: 2222 RVA: 0x00016F34 File Offset: 0x00015134
protected virtual void OnValueChanged()
{
}
// Token: 0x060008AF RID: 2223 RVA: 0x00016F38 File Offset: 0x00015138
private void GetConfigFileSetting()
{
IDictionary dictionary = null;
if (dictionary != null && dictionary.Contains(this.name))
{
this.switchSetting = (int)dictionary[this.name];
return;
}
if (this.defaultSwitchValue != null)
{
this.value = this.defaultSwitchValue;
this.OnValueChanged();
}
}
/// <summary>Invoked when the <see cref="P:System.Diagnostics.Switch.SwitchSetting" /> property is changed.</summary>
// Token: 0x060008B0 RID: 2224 RVA: 0x00016F94 File Offset: 0x00015194
protected virtual void OnSwitchSettingChanged()
{
}
// Token: 0x040002BB RID: 699
private string name;
// Token: 0x040002BC RID: 700
private string description;
// Token: 0x040002BD RID: 701
private int switchSetting;
// Token: 0x040002BE RID: 702
private string value;
// Token: 0x040002BF RID: 703
private string defaultSwitchValue;
// Token: 0x040002C0 RID: 704
private bool initialized;
// Token: 0x040002C1 RID: 705
private global::System.Collections.Specialized.StringDictionary attributes = new global::System.Collections.Specialized.StringDictionary();
}
}