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