mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 20:54:55 +00:00
Refactored how configuration, IR and SGD file path prefixes are handled, in order to be able to handle a different file structure if running on XiO Edge
This commit is contained in:
@@ -20,7 +20,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return string.Format(@"\NVRAM\Program{0}\IR\", InitialParametersClass.ApplicationNumber);
|
return Global.FilePathPrefix + @"IR\";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,17 +15,16 @@ namespace PepperDash.Essentials.Core
|
|||||||
|
|
||||||
public static LicenseManager LicenseManager { get; set; }
|
public static LicenseManager LicenseManager { get; set; }
|
||||||
|
|
||||||
//public static EssentialsHttpServer HttpConfigServer
|
public static string FilePathPrefix { get; private set; }
|
||||||
//{
|
|
||||||
// get
|
|
||||||
// {
|
|
||||||
// if (_HttpConfigServer == null)
|
|
||||||
// _HttpConfigServer = new EssentialsHttpServer();
|
|
||||||
// return _HttpConfigServer;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//static EssentialsHttpServer _HttpConfigServer;
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the file path prefix
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="prefix"></param>
|
||||||
|
public static void SetFilePathPrefix(string prefix)
|
||||||
|
{
|
||||||
|
FilePathPrefix = prefix;
|
||||||
|
}
|
||||||
|
|
||||||
static Global()
|
static Global()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -55,9 +55,9 @@
|
|||||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="mscorlib" />
|
<Reference Include="mscorlib" />
|
||||||
<Reference Include="PepperDash_Core, Version=1.0.1.20241, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="PepperDash_Core, Version=1.0.4.20530, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\pepperdash-simplsharp-core\Pepperdash Core\CLZ Builds\PepperDash_Core.dll</HintPath>
|
<HintPath>..\..\..\PepperDash.Core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SimplSharpCustomAttributesInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
<Reference Include="SimplSharpCustomAttributesInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
|||||||
@@ -59,9 +59,9 @@
|
|||||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.GeneralIO.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.GeneralIO.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="mscorlib" />
|
<Reference Include="mscorlib" />
|
||||||
<Reference Include="PepperDash_Core, Version=1.0.1.20241, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="PepperDash_Core, Version=1.0.4.20530, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\pepperdash-simplsharp-core\Pepperdash Core\CLZ Builds\PepperDash_Core.dll</HintPath>
|
<HintPath>..\..\..\PepperDash.Core\Pepperdash Core\Pepperdash Core\bin\PepperDash_Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SimplSharpCustomAttributesInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
<Reference Include="SimplSharpCustomAttributesInterface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Crestron.SimplSharp.CrestronIO;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
|
||||||
namespace PepperDash.Essentials
|
namespace PepperDash.Essentials
|
||||||
@@ -21,8 +22,8 @@ namespace PepperDash.Essentials
|
|||||||
Debug.Console(0, "Loading unmerged system/template portal configuration file.");
|
Debug.Console(0, "Loading unmerged system/template portal configuration file.");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var filePath = string.Format(@"\NVRAM\program{0}\ConfigurationFile.json",
|
var filePath = Global.FilePathPrefix + @"ConfigurationFile.json";
|
||||||
InitialParametersClass.ApplicationNumber);
|
|
||||||
if (!File.Exists(filePath))
|
if (!File.Exists(filePath))
|
||||||
{
|
{
|
||||||
Debug.Console(0,
|
Debug.Console(0,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace PepperDash.Essentials
|
|||||||
{
|
{
|
||||||
public static class FactoryHelper
|
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)
|
public static void HandleUnknownType(JToken devToken, string type)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,9 +54,34 @@ namespace PepperDash.Essentials
|
|||||||
"Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl);
|
"Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl);
|
||||||
}, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator);
|
}, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
|
||||||
|
|
||||||
|
DeterminePlatform();
|
||||||
|
|
||||||
GoWithLoad();
|
GoWithLoad();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines if the program is running on a processor (appliance) or server (XiO Edge).
|
||||||
|
///
|
||||||
|
/// Sets Global.FilePathPrefix based on platform
|
||||||
|
/// </summary>
|
||||||
|
public void DeterminePlatform()
|
||||||
|
{
|
||||||
|
string filePathPrefix;
|
||||||
|
|
||||||
|
if (CrestronEnvironment.DevicePlatform != eDevicePlatform.Server)
|
||||||
|
{
|
||||||
|
filePathPrefix = string.Format(@"\NVRAM\program{0}\",
|
||||||
|
InitialParametersClass.ApplicationNumber);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
filePathPrefix = (@"\USER\");
|
||||||
|
}
|
||||||
|
|
||||||
|
Global.SetFilePathPrefix(filePathPrefix);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Do it, yo
|
/// Do it, yo
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -109,17 +134,16 @@ namespace PepperDash.Essentials
|
|||||||
bool SetupFilesystem()
|
bool SetupFilesystem()
|
||||||
{
|
{
|
||||||
Debug.Console(0, "Verifying and/or creating folder structure");
|
Debug.Console(0, "Verifying and/or creating folder structure");
|
||||||
var appNum = InitialParametersClass.ApplicationNumber;
|
var configDir = Global.FilePathPrefix;
|
||||||
var configDir = @"\NVRAM\Program" + appNum;
|
|
||||||
var configExists = Directory.Exists(configDir);
|
var configExists = Directory.Exists(configDir);
|
||||||
if (!configExists)
|
if (!configExists)
|
||||||
Directory.Create(configDir);
|
Directory.Create(configDir);
|
||||||
|
|
||||||
var irDir = string.Format(@"\NVRAM\Program{0}\ir", appNum);
|
var irDir = Global.FilePathPrefix + @"ir";
|
||||||
if (!Directory.Exists(irDir))
|
if (!Directory.Exists(irDir))
|
||||||
Directory.Create(irDir);
|
Directory.Create(irDir);
|
||||||
|
|
||||||
var sgdDir = string.Format(@"\NVRAM\Program{0}\sgd", appNum);
|
var sgdDir = Global.FilePathPrefix + @"sgd";
|
||||||
if (!Directory.Exists(sgdDir))
|
if (!Directory.Exists(sgdDir))
|
||||||
Directory.Create(sgdDir);
|
Directory.Create(sgdDir);
|
||||||
|
|
||||||
|
|||||||
@@ -140,17 +140,20 @@ namespace PepperDash.Essentials.Fusion
|
|||||||
|
|
||||||
var slot = Global.ControlSystem.ProgramNumber;
|
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);
|
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
|
else
|
||||||
{
|
{
|
||||||
GUIDs = new FusionRoomGuids(Room.Name, ipId, GUIDs.GenerateNewRoomGuid(slot, mac), FusionStaticAssets);
|
// Exists. Read GUIDs
|
||||||
|
ReadGuidFile(guidFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateSymbolAndBasicSigs(IpId);
|
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);
|
Debug.Console(1, this, "\nRoom Name: {0}\nIPID: {1:x}\n RoomGuid: {2}", Room.Name, IpId, RoomGuid);
|
||||||
|
|
||||||
foreach (KeyValuePair<int, FusionAsset> 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);
|
Debug.Console(1, this, "\nAsset Name: {0}\nAsset No: {1}\n Guid: {2}", item.Value.Name, item.Value.SlotNumber, item.Value.InstanceId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,5 +4,5 @@
|
|||||||
[assembly: AssemblyCompany("PepperDash Technology Corp")]
|
[assembly: AssemblyCompany("PepperDash Technology Corp")]
|
||||||
[assembly: AssemblyProduct("PepperDashEssentials")]
|
[assembly: AssemblyProduct("PepperDashEssentials")]
|
||||||
[assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2017")]
|
[assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2017")]
|
||||||
[assembly: AssemblyVersion("1.0.47.*")]
|
[assembly: AssemblyVersion("1.0.48.*")]
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ namespace PepperDash.Essentials
|
|||||||
Debug.Console(0, this, "WARNING: Registration failed. Continuing, but panel may not function: {0}", regSuccess);
|
Debug.Console(0, this, "WARNING: Registration failed. Continuing, but panel may not function: {0}", regSuccess);
|
||||||
|
|
||||||
// Give up cleanly if SGD is not present.
|
// Give up cleanly if SGD is not present.
|
||||||
var sgdName = @"\NVRAM\Program" + InitialParametersClass.ApplicationNumber
|
var sgdName = Global.FilePathPrefix
|
||||||
+ @"\sgd\" + props.SgdFile;
|
+ @"\sgd\" + props.SgdFile;
|
||||||
if (!File.Exists(sgdName))
|
if (!File.Exists(sgdName))
|
||||||
{
|
{
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user