3using System.Threading.Tasks;
15 #region Getting settings
36 public static async Task<string>
GetSettingAsync(
string Host,
string Key,
string DefaultValue)
38 Host = IsAlternativeDomain(Host);
40 if (!
string.IsNullOrEmpty(Host))
65 public static async Task<long>
GetSettingAsync(
string Host,
string Key,
long DefaultValue)
67 Host = IsAlternativeDomain(Host);
69 if (!
string.IsNullOrEmpty(Host))
94 public static async Task<double>
GetSettingAsync(
string Host,
string Key,
double DefaultValue)
96 Host = IsAlternativeDomain(Host);
98 if (!
string.IsNullOrEmpty(Host))
123 public static async Task<DateTime>
GetSettingAsync(
string Host,
string Key, DateTime DefaultValue)
125 Host = IsAlternativeDomain(Host);
127 if (!
string.IsNullOrEmpty(Host))
152 public static async Task<TimeSpan>
GetSettingAsync(
string Host,
string Key, TimeSpan DefaultValue)
154 Host = IsAlternativeDomain(Host);
156 if (!
string.IsNullOrEmpty(Host))
181 public static async Task<Enum>
GetSettingAsync(
string Host,
string Key, Enum DefaultValue)
183 Host = IsAlternativeDomain(Host);
185 if (!
string.IsNullOrEmpty(Host))
210 public static async Task<bool>
GetSettingAsync(
string Host,
string Key,
bool DefaultValue)
212 Host = IsAlternativeDomain(Host);
214 if (!
string.IsNullOrEmpty(Host))
239 public static async Task<object>
GetSettingAsync(
string Host,
string Key,
object DefaultValue)
241 Host = IsAlternativeDomain(Host);
243 if (!
string.IsNullOrEmpty(Host))
249 internal static string IsAlternativeDomain(
string Host)
251 if (
string.IsNullOrEmpty(Host))
254 int i = Host.LastIndexOf(
':');
256 Host = Host.Substring(0, i);
266 #region Setting settings
289 Host = IsAlternativeDomain(Host);
291 if (!
string.IsNullOrEmpty(Host))
318 Host = IsAlternativeDomain(Host);
320 if (!
string.IsNullOrEmpty(Host))
347 Host = IsAlternativeDomain(Host);
349 if (!
string.IsNullOrEmpty(Host))
374 public static async Task<bool>
SetSettingAsync(
string Host,
string Key, DateTime Value)
376 Host = IsAlternativeDomain(Host);
378 if (!
string.IsNullOrEmpty(Host))
403 public static async Task<bool>
SetSettingAsync(
string Host,
string Key, TimeSpan Value)
405 Host = IsAlternativeDomain(Host);
407 if (!
string.IsNullOrEmpty(Host))
434 Host = IsAlternativeDomain(Host);
436 if (!
string.IsNullOrEmpty(Host))
463 Host = IsAlternativeDomain(Host);
465 if (!
string.IsNullOrEmpty(Host))
492 Host = IsAlternativeDomain(Host);
494 if (!
string.IsNullOrEmpty(Host))
502 #region Getting file-based settings
523 Host = IsAlternativeDomain(Host);
527 if (!
string.IsNullOrEmpty(Host))
532 if (!
string.IsNullOrEmpty(Content))
557 Host = IsAlternativeDomain(Host);
561 if (!
string.IsNullOrEmpty(Host))
566 if (!
string.IsNullOrEmpty(Content))
570 return Convert.FromBase64String(Content);
600 Host = IsAlternativeDomain(Host);
604 if (!
string.IsNullOrEmpty(Host))
609 if (Timestamp == DateTime.MinValue)
610 return File.GetLastWriteTime(FileName);
Static class managing loading of resources stored as embedded resources or in content files.
static async Task< byte[]> ReadAllBytesAsync(string FileName)
Reads a binary file asynchronously.
static async Task< string > ReadAllTextAsync(string FileName)
Reads a text file asynchronously.
Static class managing the application event log. Applications and services log events on this static ...
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
static async Task< long > GetSettingAsync(string Host, string Key, long DefaultValue)
Gets a setting that may vary depending on domain.
static async Task< double > GetSettingAsync(string Host, string Key, double DefaultValue)
Gets a setting that may vary depending on domain.
static async Task< DateTime > GetFileSettingTimestampAsync(string Host, string FileName)
Gets the timestamp of contents of a configurable domain-sensitive file.
static Task< DateTime > GetSettingAsync(IHostReference HostRef, string Key, DateTime DefaultValue)
Gets a setting that may vary depending on domain.
static Task< long > GetSettingAsync(IHostReference HostRef, string Key, long DefaultValue)
Gets a setting that may vary depending on domain.
static async Task< bool > SetSettingAsync(string Host, string Key, object Value)
Sets a setting that may vary depending on domain.
static Task< bool > SetSettingAsync(IHostReference HostRef, string Key, double Value)
Sets a setting that may vary depending on domain.
static Task< Enum > GetSettingAsync(IHostReference HostRef, string Key, Enum DefaultValue)
Gets a setting that may vary depending on domain.
static Task< bool > SetSettingAsync(IHostReference HostRef, string Key, Enum Value)
Sets a setting that may vary depending on domain.
static async Task< bool > SetSettingAsync(string Host, string Key, bool Value)
Sets a setting that may vary depending on domain.
static Task< string > GetSettingAsync(IHostReference HostRef, string Key, string DefaultValue)
Gets a setting that may vary depending on domain.
static Task< string > GetTextFileSettingAsync(IHostReference HostRef, string FileName)
Gets the contents of a configurable domain-sensitive text file.
static async Task< object > GetSettingAsync(string Host, string Key, object DefaultValue)
Gets a setting that may vary depending on domain.
static Task< bool > GetSettingAsync(IHostReference HostRef, string Key, bool DefaultValue)
Gets a setting that may vary depending on domain.
static async Task< byte[]> GetBinaryFileSettingAsync(string Host, string FileName)
Gets the contents of a configurable domain-sensitive binary file.
static async Task< bool > SetSettingAsync(string Host, string Key, TimeSpan Value)
Sets a setting that may vary depending on domain.
static Task< bool > SetSettingAsync(IHostReference HostRef, string Key, string Value)
Sets a setting that may vary depending on domain.
static Task< byte[]> GetBinaryFileSettingAsync(IHostReference HostRef, string FileName)
Gets the contents of a configurable domain-sensitive binary file.
static async Task< bool > SetSettingAsync(string Host, string Key, long Value)
Sets a setting that may vary depending on domain.
static async Task< string > GetSettingAsync(string Host, string Key, string DefaultValue)
Gets a setting that may vary depending on domain.
static Task< object > GetSettingAsync(IHostReference HostRef, string Key, object DefaultValue)
Gets a setting that may vary depending on domain.
static async Task< string > GetTextFileSettingAsync(string Host, string FileName)
Gets the contents of a configurable domain-sensitive text file.
static Task< bool > SetSettingAsync(IHostReference HostRef, string Key, long Value)
Sets a setting that may vary depending on domain.
static Task< bool > SetSettingAsync(IHostReference HostRef, string Key, bool Value)
Sets a setting that may vary depending on domain.
static async Task< Enum > GetSettingAsync(string Host, string Key, Enum DefaultValue)
Gets a setting that may vary depending on domain.
static async Task< TimeSpan > GetSettingAsync(string Host, string Key, TimeSpan DefaultValue)
Gets a setting that may vary depending on domain.
static Task< double > GetSettingAsync(IHostReference HostRef, string Key, double DefaultValue)
Gets a setting that may vary depending on domain.
static Task< bool > SetSettingAsync(IHostReference HostRef, string Key, DateTime Value)
Sets a setting that may vary depending on domain.
static async Task< bool > SetSettingAsync(string Host, string Key, Enum Value)
Sets a setting that may vary depending on domain.
static Task< bool > SetSettingAsync(IHostReference HostRef, string Key, TimeSpan Value)
Sets a setting that may vary depending on domain.
static async Task< bool > SetSettingAsync(string Host, string Key, double Value)
Sets a setting that may vary depending on domain.
static Task< bool > SetSettingAsync(IHostReference HostRef, string Key, object Value)
Sets a setting that may vary depending on domain.
static Task< DateTime > GetFileSettingTimestampAsync(IHostReference HostRef, string FileName)
Gets the timestamp of contents of a configurable domain-sensitive file.
static Task< TimeSpan > GetSettingAsync(IHostReference HostRef, string Key, TimeSpan DefaultValue)
Gets a setting that may vary depending on domain.
static async Task< bool > GetSettingAsync(string Host, string Key, bool DefaultValue)
Gets a setting that may vary depending on domain.
static async Task< DateTime > GetSettingAsync(string Host, string Key, DateTime DefaultValue)
Gets a setting that may vary depending on domain.
static async Task< bool > SetSettingAsync(string Host, string Key, DateTime Value)
Sets a setting that may vary depending on domain.
static async Task< bool > SetSettingAsync(string Host, string Key, string Value)
Sets a setting that may vary depending on domain.
Static class managing the runtime environment of the IoT Gateway.
static bool IsDomain(string DomainOrHost, bool IncludeAlternativeDomains)
If a domain or host name represents the gateway.
Static class managing persistent host settings. Host settings default to runtime settings if host-spe...
static async Task< string > GetAsync(string Host, string Key, string DefaultValue)
Gets a string-valued setting.
static async Task< bool > SetAsync(string Host, string Key, string Value)
Sets a string-valued setting.
Static class managing persistent settings.
static async Task< string > GetAsync(string Key, string DefaultValue)
Gets a string-valued setting.
static async Task< bool > SetAsync(string Key, string Value)
Sets a string-valued setting.
Interface for objects that contain a reference to a host.
string Host
Host reference.