mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-01-11 19:44:55 +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).
|
||||
|
||||
## [Unreleased]
|
||||
### Added
|
||||
- IcdConsole.OnConsolePrint event
|
||||
|
||||
### Changed
|
||||
- Better VC-4 support for IcdConsole
|
||||
|
||||
## [8.3.0] - 2019-01-25
|
||||
### Added
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using ICD.Common.Properties;
|
||||
using ICD.Common.Utils.EventArguments;
|
||||
using ICD.Common.Utils.Extensions;
|
||||
#if SIMPLSHARP
|
||||
using Crestron.SimplSharp;
|
||||
#else
|
||||
@@ -18,6 +20,8 @@ namespace ICD.Common.Utils
|
||||
Administrator = 2
|
||||
}
|
||||
|
||||
public static event EventHandler<StringEventArgs> OnConsolePrint;
|
||||
|
||||
/// <summary>
|
||||
/// Wraps CrestronConsole.ConsoleCommandResponse for S+ compatibility.
|
||||
/// </summary>
|
||||
@@ -41,17 +45,23 @@ namespace ICD.Common.Utils
|
||||
message = string.Format(message, args);
|
||||
|
||||
#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
|
||||
|
||||
Print(message);
|
||||
}
|
||||
|
||||
public static void PrintLine(string message)
|
||||
@@ -90,10 +100,12 @@ namespace ICD.Common.Utils
|
||||
public static void Print(string message)
|
||||
{
|
||||
#if SIMPLSHARP
|
||||
CrestronConsole.Print(message);
|
||||
if (IcdEnvironment.RuntimeEnvironment != IcdEnvironment.eRuntimeEnvironment.SimplSharpProMono)
|
||||
CrestronConsole.Print(message);
|
||||
#else
|
||||
Console.Write(message);
|
||||
#endif
|
||||
OnConsolePrint.Raise(null, new StringEventArgs(message));
|
||||
}
|
||||
|
||||
public static void Print(string message, params object[] args)
|
||||
|
||||
Reference in New Issue
Block a user