mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 05:05:05 +00:00
feat: OnConsolePrint event and better VC-4 console support
This commit is contained in:
@@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|||||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
### Added
|
||||||
|
- IcdConsole.OnConsolePrint event
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Better VC-4 support for IcdConsole
|
||||||
|
|
||||||
## [8.3.0] - 2019-01-25
|
## [8.3.0] - 2019-01-25
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using ICD.Common.Properties;
|
using ICD.Common.Properties;
|
||||||
|
using ICD.Common.Utils.EventArguments;
|
||||||
|
using ICD.Common.Utils.Extensions;
|
||||||
#if SIMPLSHARP
|
#if SIMPLSHARP
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
#else
|
#else
|
||||||
@@ -18,6 +20,8 @@ namespace ICD.Common.Utils
|
|||||||
Administrator = 2
|
Administrator = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static event EventHandler<StringEventArgs> OnConsolePrint;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Wraps CrestronConsole.ConsoleCommandResponse for S+ compatibility.
|
/// Wraps CrestronConsole.ConsoleCommandResponse for S+ compatibility.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -41,17 +45,23 @@ namespace ICD.Common.Utils
|
|||||||
message = string.Format(message, args);
|
message = string.Format(message, args);
|
||||||
|
|
||||||
#if SIMPLSHARP
|
#if SIMPLSHARP
|
||||||
try
|
if (IcdEnvironment.RuntimeEnvironment == IcdEnvironment.eRuntimeEnvironment.SimplSharpPro)
|
||||||
{
|
{
|
||||||
CrestronConsole.ConsoleCommandResponse(message);
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
CrestronConsole.ConsoleCommandResponse(message);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (NotSupportedException)
|
||||||
|
{
|
||||||
|
Print(message);
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
catch (NotSupportedException)
|
|
||||||
{
|
|
||||||
Print(message);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
Print(message);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Print(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void PrintLine(string message)
|
public static void PrintLine(string message)
|
||||||
@@ -90,10 +100,12 @@ namespace ICD.Common.Utils
|
|||||||
public static void Print(string message)
|
public static void Print(string message)
|
||||||
{
|
{
|
||||||
#if SIMPLSHARP
|
#if SIMPLSHARP
|
||||||
CrestronConsole.Print(message);
|
if (IcdEnvironment.RuntimeEnvironment != IcdEnvironment.eRuntimeEnvironment.SimplSharpProMono)
|
||||||
|
CrestronConsole.Print(message);
|
||||||
#else
|
#else
|
||||||
Console.Write(message);
|
Console.Write(message);
|
||||||
#endif
|
#endif
|
||||||
|
OnConsolePrint.Raise(null, new StringEventArgs(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Print(string message, params object[] args)
|
public static void Print(string message, params object[] args)
|
||||||
|
|||||||
Reference in New Issue
Block a user