diff --git a/Essentials Core/PepperDashEssentialsBase/Comm and IR/IRPortHelper.cs b/Essentials Core/PepperDashEssentialsBase/Comm and IR/IRPortHelper.cs index 189ca2fc..09a74cfa 100644 --- a/Essentials Core/PepperDashEssentialsBase/Comm and IR/IRPortHelper.cs +++ b/Essentials Core/PepperDashEssentialsBase/Comm and IR/IRPortHelper.cs @@ -20,7 +20,7 @@ namespace PepperDash.Essentials.Core { get { - return string.Format(@"\NVRAM\Program{0}\IR\", InitialParametersClass.ApplicationNumber); + return Global.FilePathPrefix + @"IR\"; } } diff --git a/Essentials Core/PepperDashEssentialsBase/Global/Global.cs b/Essentials Core/PepperDashEssentialsBase/Global/Global.cs index 8d3a8fdc..ded911e5 100644 --- a/Essentials Core/PepperDashEssentialsBase/Global/Global.cs +++ b/Essentials Core/PepperDashEssentialsBase/Global/Global.cs @@ -13,19 +13,18 @@ namespace PepperDash.Essentials.Core { public static CrestronControlSystem ControlSystem { get; set; } - public static LicenseManager LicenseManager { get; set; } - - //public static EssentialsHttpServer HttpConfigServer - //{ - // get - // { - // if (_HttpConfigServer == null) - // _HttpConfigServer = new EssentialsHttpServer(); - // return _HttpConfigServer; - // } - //} - //static EssentialsHttpServer _HttpConfigServer; - + public static LicenseManager LicenseManager { get; set; } + + public static string FilePathPrefix { get; private set; } + + /// + /// Sets the file path prefix + /// + /// + public static void SetFilePathPrefix(string prefix) + { + FilePathPrefix = prefix; + } static Global() { diff --git a/Essentials DM/Essentials_DM/Essentials_DM.csproj b/Essentials DM/Essentials_DM/Essentials_DM.csproj index 53be42d9..3fc5cc46 100644 --- a/Essentials DM/Essentials_DM/Essentials_DM.csproj +++ b/Essentials DM/Essentials_DM/Essentials_DM.csproj @@ -55,9 +55,9 @@ ..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll - + False - ..\..\..\pepperdash-simplsharp-core\Pepperdash Core\CLZ Builds\PepperDash_Core.dll + ..\..\..\PepperDash.Core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.dll False diff --git a/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj b/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj index 0a99b128..38bc0a3a 100644 --- a/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj +++ b/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj @@ -59,9 +59,9 @@ ..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.GeneralIO.dll - + False - ..\..\..\pepperdash-simplsharp-core\Pepperdash Core\CLZ Builds\PepperDash_Core.dll + ..\..\..\PepperDash.Core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.dll False diff --git a/Essentials/PepperDashEssentials/Config/ConfigReader.cs b/Essentials/PepperDashEssentials/Config/ConfigReader.cs index bd4b76af..7a743451 100644 --- a/Essentials/PepperDashEssentials/Config/ConfigReader.cs +++ b/Essentials/PepperDashEssentials/Config/ConfigReader.cs @@ -5,6 +5,7 @@ using Crestron.SimplSharp.CrestronIO; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using PepperDash.Core; +using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials @@ -21,13 +22,13 @@ namespace PepperDash.Essentials Debug.Console(0, "Loading unmerged system/template portal configuration file."); try { - var filePath = string.Format(@"\NVRAM\program{0}\ConfigurationFile.json", - InitialParametersClass.ApplicationNumber); + var filePath = Global.FilePathPrefix + @"ConfigurationFile.json"; + if (!File.Exists(filePath)) { - Debug.Console(0, - "ERROR: Configuration file not present. Please load file to {0} and reset program", filePath); - return false; + Debug.Console(0, + "ERROR: Configuration file not present. Please load file to {0} and reset program", filePath); + return false; } using (StreamReader fs = new StreamReader(filePath)) diff --git a/Essentials/PepperDashEssentials/Configuration Original/Factories/FactoryHelper.cs b/Essentials/PepperDashEssentials/Configuration Original/Factories/FactoryHelper.cs index d7c314e9..edf3f43f 100644 --- a/Essentials/PepperDashEssentials/Configuration Original/Factories/FactoryHelper.cs +++ b/Essentials/PepperDashEssentials/Configuration Original/Factories/FactoryHelper.cs @@ -17,7 +17,7 @@ namespace PepperDash.Essentials { public static class FactoryHelper { - public static string IrDriverPathPrefix = @"\NVRAM\IR\"; + public static string IrDriverPathPrefix = Global.FilePathPrefix + @"IR\"; public static void HandleUnknownType(JToken devToken, string type) { diff --git a/Essentials/PepperDashEssentials/ControlSystem.cs b/Essentials/PepperDashEssentials/ControlSystem.cs index f33e4c20..799666f4 100644 --- a/Essentials/PepperDashEssentials/ControlSystem.cs +++ b/Essentials/PepperDashEssentials/ControlSystem.cs @@ -54,9 +54,34 @@ namespace PepperDash.Essentials "Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl); }, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator); + + DeterminePlatform(); + GoWithLoad(); } + /// + /// Determines if the program is running on a processor (appliance) or server (XiO Edge). + /// + /// Sets Global.FilePathPrefix based on platform + /// + public void DeterminePlatform() + { + string filePathPrefix; + + if (CrestronEnvironment.DevicePlatform != eDevicePlatform.Server) + { + filePathPrefix = string.Format(@"\NVRAM\program{0}\", + InitialParametersClass.ApplicationNumber); + } + else + { + filePathPrefix = (@"\USER\"); + } + + Global.SetFilePathPrefix(filePathPrefix); + } + /// /// Do it, yo /// @@ -109,17 +134,16 @@ namespace PepperDash.Essentials bool SetupFilesystem() { Debug.Console(0, "Verifying and/or creating folder structure"); - var appNum = InitialParametersClass.ApplicationNumber; - var configDir = @"\NVRAM\Program" + appNum; + var configDir = Global.FilePathPrefix; var configExists = Directory.Exists(configDir); if (!configExists) Directory.Create(configDir); - var irDir = string.Format(@"\NVRAM\Program{0}\ir", appNum); + var irDir = Global.FilePathPrefix + @"ir"; if (!Directory.Exists(irDir)) Directory.Create(irDir); - var sgdDir = string.Format(@"\NVRAM\Program{0}\sgd", appNum); + var sgdDir = Global.FilePathPrefix + @"sgd"; if (!Directory.Exists(sgdDir)) Directory.Create(sgdDir); diff --git a/Essentials/PepperDashEssentials/OTHER/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs b/Essentials/PepperDashEssentials/OTHER/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs index ce70e381..7233fd6c 100644 --- a/Essentials/PepperDashEssentials/OTHER/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs +++ b/Essentials/PepperDashEssentials/OTHER/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs @@ -140,17 +140,20 @@ namespace PepperDash.Essentials.Fusion var slot = Global.ControlSystem.ProgramNumber; - string guidFilePath = string.Format(@"\NVRAM\Program{0}\{1}-FusionGuids.json", Global.ControlSystem.ProgramNumber, InitialParametersClass.ProgramIDTag); + string guidFilePath = Global.FilePathPrefix + string.Format(@"{1}-FusionGuids.json", Global.ControlSystem.ProgramNumber, InitialParametersClass.ProgramIDTag); GuidFileExists = File.Exists(guidFilePath); - if (GuidFileExists) + // Check if file exists + if (!GuidFileExists) { - ReadGuidFile(guidFilePath); + // Does not exist. Create GUIDs + GUIDs = new FusionRoomGuids(Room.Name, ipId, GUIDs.GenerateNewRoomGuid(slot, mac), FusionStaticAssets); } else { - GUIDs = new FusionRoomGuids(Room.Name, ipId, GUIDs.GenerateNewRoomGuid(slot, mac), FusionStaticAssets); + // Exists. Read GUIDs + ReadGuidFile(guidFilePath); } CreateSymbolAndBasicSigs(IpId); @@ -267,11 +270,11 @@ namespace PepperDash.Essentials.Fusion } - Debug.Console(0, this, "Fusion Guids successfully read from file:"); + Debug.Console(0, this, "Fusion Guids successfully read from file: {0}", filePath); Debug.Console(1, this, "\nRoom Name: {0}\nIPID: {1:x}\n RoomGuid: {2}", Room.Name, IpId, RoomGuid); - foreach (KeyValuePair item in FusionStaticAssets) + foreach (var item in FusionStaticAssets) { Debug.Console(1, this, "\nAsset Name: {0}\nAsset No: {1}\n Guid: {2}", item.Value.Name, item.Value.SlotNumber, item.Value.InstanceId); } diff --git a/Essentials/PepperDashEssentials/Properties/AssemblyInfo.cs b/Essentials/PepperDashEssentials/Properties/AssemblyInfo.cs index 0cc877bb..b8327f77 100644 --- a/Essentials/PepperDashEssentials/Properties/AssemblyInfo.cs +++ b/Essentials/PepperDashEssentials/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ [assembly: AssemblyCompany("PepperDash Technology Corp")] [assembly: AssemblyProduct("PepperDashEssentials")] [assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2017")] -[assembly: AssemblyVersion("1.0.47.*")] +[assembly: AssemblyVersion("1.0.48.*")] diff --git a/Essentials/PepperDashEssentials/UI/EssentialsTouchpanelController.cs b/Essentials/PepperDashEssentials/UI/EssentialsTouchpanelController.cs index 5fae4414..9224a12b 100644 --- a/Essentials/PepperDashEssentials/UI/EssentialsTouchpanelController.cs +++ b/Essentials/PepperDashEssentials/UI/EssentialsTouchpanelController.cs @@ -94,7 +94,7 @@ namespace PepperDash.Essentials Debug.Console(0, this, "WARNING: Registration failed. Continuing, but panel may not function: {0}", regSuccess); // Give up cleanly if SGD is not present. - var sgdName = @"\NVRAM\Program" + InitialParametersClass.ApplicationNumber + var sgdName = Global.FilePathPrefix + @"\sgd\" + props.SgdFile; if (!File.Exists(sgdName)) { diff --git a/Release Package/PepperDashEssentials.cpz b/Release Package/PepperDashEssentials.cpz index e33cc888..addd7a14 100644 Binary files a/Release Package/PepperDashEssentials.cpz and b/Release Package/PepperDashEssentials.cpz differ diff --git a/Release Package/PepperDashEssentials.dll b/Release Package/PepperDashEssentials.dll index 29a0431b..d1dbc7c7 100644 Binary files a/Release Package/PepperDashEssentials.dll and b/Release Package/PepperDashEssentials.dll differ