mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-17 05:35:07 +00:00
Merge remote-tracking branch 'origin/ConnectPro_v1.1' into ConnectPro_v1.2
# Conflicts: # CHANGELOG.md # ICD.Common.Utils/Properties/AssemblyInfo.cs
This commit is contained in:
@@ -6,7 +6,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- Added Shim to read a list from xml with no root element
|
- Added Shim to read a list from xml with no root element
|
||||||
- Added a URI query builder
|
- Added a URI query builder
|
||||||
@@ -15,7 +14,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
- Fixed JSON DateTime parsing in .Net Standard
|
- Fixed JSON DateTime parsing in .Net Standard
|
||||||
- Fixed threading exception in TypeExtensions
|
- Fixed threading exception in TypeExtensions
|
||||||
|
|
||||||
|
|
||||||
## [9.4.0] - 2019-05-10
|
## [9.4.0] - 2019-05-10
|
||||||
### Added
|
### Added
|
||||||
- Added extension method for peeking queues
|
- Added extension method for peeking queues
|
||||||
@@ -69,6 +67,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
- Better VC-4 support for IcdConsole
|
- Better VC-4 support for IcdConsole
|
||||||
- JSON refactoring for simpler deserialization
|
- JSON refactoring for simpler deserialization
|
||||||
|
|
||||||
|
## [8.4.1] - 2019-06-05
|
||||||
|
### Changed
|
||||||
|
- Caching the program/processor start time and calculating the uptime from those values instead of polling the crestron processor
|
||||||
|
|
||||||
## [8.4.0] - 2019-05-15
|
## [8.4.0] - 2019-05-15
|
||||||
### Added
|
### Added
|
||||||
- Added GUID utils for generating seeded GUIDs
|
- Added GUID utils for generating seeded GUIDs
|
||||||
|
|||||||
@@ -14,13 +14,16 @@ namespace ICD.Common.Utils
|
|||||||
|
|
||||||
private const string UPTIME_COMMAND = "uptime";
|
private const string UPTIME_COMMAND = "uptime";
|
||||||
private const string PROGUPTIME_COMMAND_ROOT = "proguptime:{0}";
|
private const string PROGUPTIME_COMMAND_ROOT = "proguptime:{0}";
|
||||||
private const string UPTIME_REGEX = @".*(?'uptime'\d+ days \d{2}:\d{2}:\d{2}\.\d+)";
|
private const string UPTIME_REGEX = @".*(?'uptime'(?'days'\d+) days (?'hours'\d{2}):(?'minutes'\d{2}):(?'seconds'\d{2})\.(?'milliseconds'\d+))";
|
||||||
|
|
||||||
private const string RAMFREE_COMMAND = "ramfree";
|
private const string RAMFREE_COMMAND = "ramfree";
|
||||||
private const string RAMFREE_DIGITS_REGEX = @"^(\d*)";
|
private const string RAMFREE_DIGITS_REGEX = @"^(\d*)";
|
||||||
|
|
||||||
private static string s_VersionResult;
|
private static string s_VersionResult;
|
||||||
|
|
||||||
|
private static DateTime? s_SystemUptimeStartTime;
|
||||||
|
private static DateTime? s_ProgramUptimeStartTime;
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -232,24 +235,53 @@ namespace ICD.Common.Utils
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public static string GetSystemUptime()
|
public static TimeSpan GetSystemUptime()
|
||||||
{
|
{
|
||||||
string uptime = GetUptime();
|
if (s_SystemUptimeStartTime == null)
|
||||||
Match match = Regex.Match(uptime, UPTIME_REGEX);
|
{
|
||||||
return match.Groups["uptime"].Value;
|
string uptime = GetSystemUptimeFeedback();
|
||||||
|
Match match = Regex.Match(uptime, UPTIME_REGEX);
|
||||||
|
if (!match.Success)
|
||||||
|
return default(TimeSpan);
|
||||||
|
|
||||||
|
int days = int.Parse(match.Groups["days"].Value);
|
||||||
|
int hours = int.Parse(match.Groups["hours"].Value);
|
||||||
|
int minutes = int.Parse(match.Groups["minutes"].Value);
|
||||||
|
int seconds = int.Parse(match.Groups["seconds"].Value);
|
||||||
|
int milliseconds = int.Parse(match.Groups["milliseconds"].Value);
|
||||||
|
|
||||||
|
TimeSpan span = new TimeSpan(days, hours, minutes, seconds, milliseconds);
|
||||||
|
s_SystemUptimeStartTime = IcdEnvironment.GetLocalTime() - span;
|
||||||
|
}
|
||||||
|
|
||||||
|
return IcdEnvironment.GetLocalTime() - s_SystemUptimeStartTime.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the uptime
|
/// Gets the uptime of the current program.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="progslot"></param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public static string GetProgramUptime(int progslot)
|
public static TimeSpan GetProgramUptime()
|
||||||
{
|
{
|
||||||
string uptime = GetUptime(progslot);
|
if (s_ProgramUptimeStartTime == null)
|
||||||
Match match = Regex.Match(uptime, UPTIME_REGEX);
|
{
|
||||||
return match.Groups["uptime"].Value;
|
string uptime = GetProgramUptimeFeedback((int)ProgramUtils.ProgramNumber);
|
||||||
|
Match match = Regex.Match(uptime, UPTIME_REGEX);
|
||||||
|
if (!match.Success)
|
||||||
|
return default(TimeSpan);
|
||||||
|
|
||||||
|
int days = int.Parse(match.Groups["days"].Value);
|
||||||
|
int hours = int.Parse(match.Groups["hours"].Value);
|
||||||
|
int minutes = int.Parse(match.Groups["minutes"].Value);
|
||||||
|
int seconds = int.Parse(match.Groups["seconds"].Value);
|
||||||
|
int milliseconds = int.Parse(match.Groups["milliseconds"].Value);
|
||||||
|
|
||||||
|
TimeSpan span = new TimeSpan(days, hours, minutes, seconds, milliseconds);
|
||||||
|
s_ProgramUptimeStartTime = IcdEnvironment.GetLocalTime() - span;
|
||||||
|
}
|
||||||
|
|
||||||
|
return IcdEnvironment.GetLocalTime() - s_ProgramUptimeStartTime.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -270,7 +302,7 @@ namespace ICD.Common.Utils
|
|||||||
return ramfree;
|
return ramfree;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetUptime()
|
private static string GetSystemUptimeFeedback()
|
||||||
{
|
{
|
||||||
string uptime = null;
|
string uptime = null;
|
||||||
if (!IcdConsole.SendControlSystemCommand(UPTIME_COMMAND, ref uptime))
|
if (!IcdConsole.SendControlSystemCommand(UPTIME_COMMAND, ref uptime))
|
||||||
@@ -282,7 +314,7 @@ namespace ICD.Common.Utils
|
|||||||
return uptime;
|
return uptime;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetUptime(int programSlot)
|
private static string GetProgramUptimeFeedback(int programSlot)
|
||||||
{
|
{
|
||||||
string uptime = null;
|
string uptime = null;
|
||||||
if (!IcdConsole.SendControlSystemCommand(string.Format(PROGUPTIME_COMMAND_ROOT, programSlot), ref uptime))
|
if (!IcdConsole.SendControlSystemCommand(string.Format(PROGUPTIME_COMMAND_ROOT, programSlot), ref uptime))
|
||||||
|
|||||||
@@ -140,22 +140,21 @@ namespace ICD.Common.Utils
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public static string GetSystemUptime()
|
public static TimeSpan GetSystemUptime()
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return null;
|
return default(TimeSpan);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the uptime
|
/// Gets the uptime
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="progslot"></param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public static string GetProgramUptime(int progslot)
|
public static TimeSpan GetProgramUptime()
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return null;
|
return default(TimeSpan);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Reference in New Issue
Block a user