3using System.Threading.Tasks;
16 #region Getting settings
37 public static async Task<string>
GetSettingAsync(
string Host,
string Key,
string DefaultValue)
39 Host = IsAlternativeDomain(Host);
41 if (!
string.IsNullOrEmpty(Host))
66 public static async Task<long>
GetSettingAsync(
string Host,
string Key,
long DefaultValue)
68 Host = IsAlternativeDomain(Host);
70 if (!
string.IsNullOrEmpty(Host))
95 public static async Task<double>
GetSettingAsync(
string Host,
string Key,
double DefaultValue)
97 Host = IsAlternativeDomain(Host);
99 if (!
string.IsNullOrEmpty(Host))
124 public static async Task<DateTime>
GetSettingAsync(
string Host,
string Key, DateTime DefaultValue)
126 Host = IsAlternativeDomain(Host);
128 if (!
string.IsNullOrEmpty(Host))
153 public static async Task<TimeSpan>
GetSettingAsync(
string Host,
string Key, TimeSpan DefaultValue)
155 Host = IsAlternativeDomain(Host);
157 if (!
string.IsNullOrEmpty(Host))
182 public static async Task<Enum>
GetSettingAsync(
string Host,
string Key, Enum DefaultValue)
184 Host = IsAlternativeDomain(Host);
186 if (!
string.IsNullOrEmpty(Host))
211 public static async Task<bool>
GetSettingAsync(
string Host,
string Key,
bool DefaultValue)
213 Host = IsAlternativeDomain(Host);
215 if (!
string.IsNullOrEmpty(Host))
240 public static async Task<object>
GetSettingAsync(
string Host,
string Key,
object DefaultValue)
242 Host = IsAlternativeDomain(Host);
244 if (!
string.IsNullOrEmpty(Host))
250 internal static string IsAlternativeDomain(
string Host)
252 if (
string.IsNullOrEmpty(Host))
255 Host = Host.RemovePortNumber();
265 #region Setting settings
288 Host = IsAlternativeDomain(Host);
290 if (!
string.IsNullOrEmpty(Host))
317 Host = IsAlternativeDomain(Host);
319 if (!
string.IsNullOrEmpty(Host))
346 Host = IsAlternativeDomain(Host);
348 if (!
string.IsNullOrEmpty(Host))
373 public static async Task<bool>
SetSettingAsync(
string Host,
string Key, DateTime Value)
375 Host = IsAlternativeDomain(Host);
377 if (!
string.IsNullOrEmpty(Host))
402 public static async Task<bool>
SetSettingAsync(
string Host,
string Key, TimeSpan Value)
404 Host = IsAlternativeDomain(Host);
406 if (!
string.IsNullOrEmpty(Host))
433 Host = IsAlternativeDomain(Host);
435 if (!
string.IsNullOrEmpty(Host))
462 Host = IsAlternativeDomain(Host);
464 if (!
string.IsNullOrEmpty(Host))
491 Host = IsAlternativeDomain(Host);
493 if (!
string.IsNullOrEmpty(Host))
501 #region Getting file-based settings
522 Host = IsAlternativeDomain(Host);
526 if (!
string.IsNullOrEmpty(Host))
531 if (!
string.IsNullOrEmpty(Content))
556 Host = IsAlternativeDomain(Host);
560 if (!
string.IsNullOrEmpty(Host))
565 if (!
string.IsNullOrEmpty(Content))
569 return Convert.FromBase64String(Content);
577 return await Runtime.IO.Files.ReadAllBytesAsync(FileName);
599 Host = IsAlternativeDomain(Host);
603 if (!
string.IsNullOrEmpty(Host))
608 if (Timestamp == DateTime.MinValue)
609 return File.GetLastWriteTimeUtc(FileName);
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 async Task< string > ReadAllTextAsync(string FileName)
Reads a text file asynchronously.
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.