Adds RuntimeInfo class to InfoConfig and populates values when CotijaController class calls RegisterSystemToServer()

This commit is contained in:
Neil Dorin
2018-03-12 15:19:31 -06:00
parent 525881ebe1
commit 5129b19748
6 changed files with 47 additions and 4 deletions

View File

@@ -1,4 +1,6 @@
using System;
using System;
using Crestron.SimplSharp.Reflection;
using Newtonsoft.Json;
@@ -19,7 +21,10 @@ namespace PepperDash.Essentials.Core.Config
public string Type { get; set; }
[JsonProperty("version")]
public string Version { get; set; }
public string Version { get; set; }
[JsonProperty("runtimeInfo")]
public RuntimeInfo RuntimeInfo { get; set; }
[JsonProperty("comment")]
public string Comment { get; set; }
@@ -30,7 +35,34 @@ namespace PepperDash.Essentials.Core.Config
Date = DateTime.Now;
Type = "";
Version = "";
Comment = "";
Comment = "";
RuntimeInfo = new RuntimeInfo();
}
}
}
/// <summary>
/// Represents runtime information about the program/processor
/// </summary>
public class RuntimeInfo
{
/// <summary>
/// The name of the running application
/// </summary>
[JsonProperty("appName")]
public string AppName { get; set; }
/// <summary>
/// The Assembly version of the running application
/// </summary>
[JsonProperty("assemblyVersion")]
public string AssemblyVersion { get; set; }
/// <summary>
/// The OS Version of the processor (Firmware Version)
/// </summary>
[JsonProperty("osVersion")]
public string OsVersion { get; set; }
}
}

View File

@@ -22,6 +22,7 @@ namespace PepperDash.Essentials
[JsonProperty("template_url")]
public string TemplateUrl { get; set; }
//public CotijaConfig Cotija { get; private set; }
public string SystemUuid

View File

@@ -99,6 +99,10 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe</HintPath>
</Reference>
<Reference Include="SimplSharpReflectionInterface, Version=1.0.5583.25238, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />

View File

@@ -5,6 +5,7 @@ using System.Text;
using System.Text.RegularExpressions;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharp.Reflection;
using Crestron.SimplSharpPro.CrestronThread;
using Crestron.SimplSharp.CrestronWebSocketClient;
using Crestron.SimplSharpPro;
@@ -208,6 +209,11 @@ namespace PepperDash.Essentials
try
{
var confObject = ConfigReader.ConfigObject;
confObject.Info.RuntimeInfo.AppName = Assembly.GetExecutingAssembly().GetName().Name;
var version = Assembly.GetExecutingAssembly().GetName().Version;
confObject.Info.RuntimeInfo.AssemblyVersion = string.Format("v{0}.{1}.{2}", version.Major, version.Minor, version.Build);
confObject.Info.RuntimeInfo.OsVersion = Crestron.SimplSharp.CrestronEnvironment.OSVersion.Firmware;
string postBody = JsonConvert.SerializeObject(confObject);
SystemUuid = confObject.SystemUuid;