/// <summary>Create a ServerStatisticsInfo instance from the specified host name.</summary> internal ServerStatisticsInfo(string hostName, NativeMethods.STAT_SERVER_0?serverStat) { HostName = !Utils.IsNullOrWhiteSpace(hostName) ? hostName : Environment.MachineName; if (serverStat.HasValue) { _dateTimeNowUtc = DateTime.UtcNow; _serverStat = (NativeMethods.STAT_SERVER_0)serverStat; } else { Refresh(); } }
/// <summary>Refreshes the state of the object.</summary> public void Refresh() { _dateTimeNowUtc = DateTime.UtcNow; _serverStat = Host.GetNetStatisticsNative <NativeMethods.STAT_SERVER_0>(true, HostName); }