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,5 +1,7 @@
using System; using System;
using Crestron.SimplSharp.Reflection;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace PepperDash.Essentials.Core.Config namespace PepperDash.Essentials.Core.Config
@@ -21,6 +23,9 @@ namespace PepperDash.Essentials.Core.Config
[JsonProperty("version")] [JsonProperty("version")]
public string Version { get; set; } public string Version { get; set; }
[JsonProperty("runtimeInfo")]
public RuntimeInfo RuntimeInfo { get; set; }
[JsonProperty("comment")] [JsonProperty("comment")]
public string Comment { get; set; } public string Comment { get; set; }
@@ -31,6 +36,33 @@ namespace PepperDash.Essentials.Core.Config
Type = ""; Type = "";
Version = ""; 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")] [JsonProperty("template_url")]
public string TemplateUrl { get; set; } public string TemplateUrl { get; set; }
//public CotijaConfig Cotija { get; private set; } //public CotijaConfig Cotija { get; private set; }
public string SystemUuid public string SystemUuid

View File

@@ -99,6 +99,10 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe</HintPath> <HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe</HintPath>
</Reference> </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" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />

View File

@@ -5,6 +5,7 @@ using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharp.Reflection;
using Crestron.SimplSharpPro.CrestronThread; using Crestron.SimplSharpPro.CrestronThread;
using Crestron.SimplSharp.CrestronWebSocketClient; using Crestron.SimplSharp.CrestronWebSocketClient;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
@@ -208,6 +209,11 @@ namespace PepperDash.Essentials
try try
{ {
var confObject = ConfigReader.ConfigObject; 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); string postBody = JsonConvert.SerializeObject(confObject);
SystemUuid = confObject.SystemUuid; SystemUuid = confObject.SystemUuid;