mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-01-11 19:44:55 +00:00
fix: Splitting runtime environment SimplSharpProMono into SimplSharpProServer and fixing usages
This commit is contained in:
@@ -65,7 +65,7 @@ namespace ICD.Common.Utils
|
||||
public static void PrintLine(string message)
|
||||
{
|
||||
#if SIMPLSHARP
|
||||
if (IcdEnvironment.RuntimeEnvironment != IcdEnvironment.eRuntimeEnvironment.SimplSharpProMono)
|
||||
if (IcdEnvironment.RuntimeEnvironment != IcdEnvironment.eRuntimeEnvironment.SimplSharpProServer)
|
||||
CrestronConsole.PrintLine(message);
|
||||
#else
|
||||
Console.WriteLine(message);
|
||||
@@ -94,7 +94,7 @@ namespace ICD.Common.Utils
|
||||
public static void Print(string message)
|
||||
{
|
||||
#if SIMPLSHARP
|
||||
if (IcdEnvironment.RuntimeEnvironment != IcdEnvironment.eRuntimeEnvironment.SimplSharpProMono)
|
||||
if (IcdEnvironment.RuntimeEnvironment != IcdEnvironment.eRuntimeEnvironment.SimplSharpProServer)
|
||||
CrestronConsole.Print(message);
|
||||
#else
|
||||
Console.Write(message);
|
||||
@@ -124,7 +124,7 @@ namespace ICD.Common.Utils
|
||||
{
|
||||
#if SIMPLSHARP
|
||||
// No console on VC4
|
||||
if (IcdEnvironment.RuntimeEnvironment == IcdEnvironment.eRuntimeEnvironment.SimplSharpProMono)
|
||||
if (IcdEnvironment.RuntimeEnvironment == IcdEnvironment.eRuntimeEnvironment.SimplSharpProServer)
|
||||
return false;
|
||||
|
||||
return CrestronConsole.SendControlSystemCommand(command, ref result);
|
||||
|
||||
@@ -14,19 +14,13 @@ namespace ICD.Common.Utils
|
||||
/// </summary>
|
||||
private const string INVALID_VALUE = "Invalid Value";
|
||||
|
||||
private static eRuntimeEnvironment s_RuntimeEnvironment;
|
||||
|
||||
#region Properties
|
||||
|
||||
public static string NewLine { get { return CrestronEnvironment.NewLine; } }
|
||||
|
||||
public static eRuntimeEnvironment RuntimeEnvironment
|
||||
{
|
||||
get
|
||||
{
|
||||
return CrestronEnvironment.DevicePlatform == eDevicePlatform.Server
|
||||
? eRuntimeEnvironment.SimplSharpProMono
|
||||
: GetRuntimeEnvironment(CrestronEnvironment.RuntimeEnvironment);
|
||||
}
|
||||
}
|
||||
public static eRuntimeEnvironment RuntimeEnvironment { get { return s_RuntimeEnvironment; } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the network address(es) of the processor.
|
||||
@@ -169,6 +163,14 @@ namespace ICD.Common.Utils
|
||||
/// </summary>
|
||||
static IcdEnvironment()
|
||||
{
|
||||
// Cache the runtime environment
|
||||
s_RuntimeEnvironment =
|
||||
CrestronEnvironment.DevicePlatform == eDevicePlatform.Server
|
||||
? eRuntimeEnvironment.SimplSharpProServer
|
||||
: Type.GetType("Mono.Runtime") == null
|
||||
? GetRuntimeEnvironment(CrestronEnvironment.RuntimeEnvironment)
|
||||
: eRuntimeEnvironment.SimplSharpProMono;
|
||||
|
||||
CrestronEnvironment.ProgramStatusEventHandler += CrestronEnvironmentOnProgramStatusEventHandler;
|
||||
CrestronEnvironment.EthernetEventHandler += CrestronEnvironmentOnEthernetEventHandler;
|
||||
}
|
||||
@@ -225,7 +227,7 @@ namespace ICD.Common.Utils
|
||||
}
|
||||
}
|
||||
|
||||
public static eRuntimeEnvironment GetRuntimeEnvironment(Crestron.SimplSharp.eRuntimeEnvironment runtimeEnvironment)
|
||||
private static eRuntimeEnvironment GetRuntimeEnvironment(Crestron.SimplSharp.eRuntimeEnvironment runtimeEnvironment)
|
||||
{
|
||||
switch (runtimeEnvironment)
|
||||
{
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace ICD.Common.Utils
|
||||
SimplSharp,
|
||||
SimplSharpPro,
|
||||
SimplSharpProMono,
|
||||
SimplSharpProServer,
|
||||
Standard
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace ICD.Common.Utils
|
||||
public static string RootPath {
|
||||
get
|
||||
{
|
||||
if (IcdEnvironment.RuntimeEnvironment == IcdEnvironment.eRuntimeEnvironment.SimplSharpProMono)
|
||||
if (IcdEnvironment.RuntimeEnvironment == IcdEnvironment.eRuntimeEnvironment.SimplSharpProServer)
|
||||
return IcdDirectory.GetApplicationRootDirectory();
|
||||
|
||||
return IcdDirectory.GetDirectoryRoot(IcdPath.DirectorySeparatorChar.ToString());
|
||||
@@ -44,7 +44,13 @@ namespace ICD.Common.Utils
|
||||
get
|
||||
{
|
||||
#if SIMPLSHARP
|
||||
return Join(RootPath, "User");
|
||||
switch (IcdEnvironment.RuntimeEnvironment)
|
||||
{
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharpProMono:
|
||||
return Join(RootPath, "user");
|
||||
default:
|
||||
return Join(RootPath, "User");
|
||||
}
|
||||
#elif LINUX
|
||||
return Join(RootPath, "opt", "ICD.Connect");
|
||||
#else
|
||||
@@ -72,10 +78,11 @@ namespace ICD.Common.Utils
|
||||
{
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharp:
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharpPro:
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharpProMono:
|
||||
case IcdEnvironment.eRuntimeEnvironment.Standard:
|
||||
return string.Format("Program{0:D2}Config", ProgramUtils.ProgramNumber);
|
||||
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharpProMono:
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharpProServer:
|
||||
return "ProgramConfig";
|
||||
|
||||
default:
|
||||
@@ -103,10 +110,11 @@ namespace ICD.Common.Utils
|
||||
{
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharp:
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharpPro:
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharpProMono:
|
||||
case IcdEnvironment.eRuntimeEnvironment.Standard:
|
||||
return string.Format("Program{0:D2}Data", ProgramUtils.ProgramNumber);
|
||||
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharpProMono:
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharpProServer:
|
||||
return "ProgramData";
|
||||
|
||||
default:
|
||||
@@ -151,11 +159,12 @@ namespace ICD.Common.Utils
|
||||
{
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharp:
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharpPro:
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharpProMono:
|
||||
case IcdEnvironment.eRuntimeEnvironment.Standard:
|
||||
directoryName = string.Format("Program{0:D2}Logs", ProgramUtils.ProgramNumber);
|
||||
break;
|
||||
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharpProMono:
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharpProServer:
|
||||
directoryName = "ProgramLogs";
|
||||
break;
|
||||
|
||||
@@ -183,6 +192,9 @@ namespace ICD.Common.Utils
|
||||
return Join(RootPath, "HTML");
|
||||
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharpProMono:
|
||||
return Join(RootPath, "html");
|
||||
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharpProServer:
|
||||
return Join(RootPath, "Html");
|
||||
|
||||
case IcdEnvironment.eRuntimeEnvironment.Standard:
|
||||
|
||||
@@ -29,11 +29,12 @@ namespace ICD.Common.Utils
|
||||
break;
|
||||
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharpPro:
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharpProMono:
|
||||
int proLength = Math.Min(26 - 1, name.Length);
|
||||
name = name.Substring(0, proLength).PadRight(26);
|
||||
break;
|
||||
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharpProMono:
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharpProServer:
|
||||
// No console
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user