Compare commits

..

11 Commits

Author SHA1 Message Date
Andrew Welker
39e1e5167b Merge branch 'development' into hotfix/DisplayPortHdcp 2023-04-20 11:51:21 -06:00
Andrew Welker
c53cad8119 Merge pull request #1086 from PepperDash/hotfix/pd-core-update-ssh-issues
Update PD Core to 1.2.1 DEV
2023-04-07 11:52:23 -06:00
Andrew Welker
82e8b4b203 Merge branch 'development' into hotfix/pd-core-update-ssh-issues 2023-04-07 11:37:31 -06:00
Andrew Welker
8c3b891255 Merge pull request #1082 from PepperDash/feature/vc4-fileio
Update VC4 file handling
2023-04-07 11:25:01 -06:00
jtalborough
10fc8ee30b Merge remote-tracking branch 'origin/feature/vc4-fileio' into development 2023-03-28 16:26:32 -04:00
Andrew Welker
8da8b8c584 Merge pull request #1080 from PepperDash/hotfix/dge-hdcp
Add HDCP & Bridging support for DGE Devices DEV
2023-03-27 16:40:39 -06:00
Andrew Welker
c7e0326b8c Merge branch 'development' into hotfix/dge-hdcp 2023-03-27 16:27:16 -06:00
Neil Dorin
465aa947cf Merge pull request #1078 from PepperDash/release/1.13.0
1.13.0 DEV
2023-03-24 13:08:18 -06:00
jta
3b2fa8aec5 fix: issue with file path on four sereis
refactor: remove redundnet /
2023-01-09 17:16:03 -05:00
jta
ffa864c71b Merge remote-tracking branch 'origin/development' into feature/vc4-fileio 2023-01-09 15:45:38 -05:00
jta
112a2b7382 feature: fileio now uses Global.FilePathPrefix as its directory
All read wirtes now use the current working essentials directory. This resolves issues between 3 series, 4 series, and VC-4
2022-12-20 15:16:18 -05:00
7 changed files with 249 additions and 220 deletions

View File

@@ -0,0 +1,37 @@
name: Add bugs to bugs project
on:
issues:
types:
- opened
- labeled
jobs:
check-secret:
runs-on: ubuntu-latest
outputs:
my-key: ${{ steps.my-key.outputs.defined }}
steps:
- id: my-key
if: "${{ env.MY_KEY != '' }}"
run: echo "::set-output name=defined::true"
env:
MY_KEY: ${{ secrets.PROJECT_URL }}
throw-error:
name: Check
runs-on: ubuntu-latest
needs: [check-secret]
if: needs.check-secret.outputs.my-key != 'true'
steps:
- run: echo "The Project URL Repo Secret is empty"
add-to-project:
name: Add issue to project
runs-on: ubuntu-latest
needs: [check-secret]
if: needs.check-secret.outputs.my-key == 'true'
steps:
- uses: actions/add-to-project@main
with:
project-url: ${{ secrets.PROJECT_URL }}
github-token: ${{ secrets.GH_PROJECTS_PASSWORD }}

View File

@@ -9,18 +9,18 @@ using Crestron.SimplSharpPro.CrestronThread;
namespace PepperDash.Essentials.Core namespace PepperDash.Essentials.Core
{ {
public static class FileIO public static class FileIO
{ {
static CCriticalSection fileLock = new CCriticalSection(); static CCriticalSection fileLock = new CCriticalSection();
public delegate void GotFileEventHandler(object sender, FileEventArgs e); public delegate void GotFileEventHandler(object sender, FileEventArgs e);
public static event GotFileEventHandler GotFileEvent; public static event GotFileEventHandler GotFileEvent;
/// <summary> /// <summary>
/// Get the full file info from a path/filename, can include wildcards. /// Get the full file info from a path/filename, can include wildcards.
/// </summary> /// </summary>
/// <param name="fileName"></param> /// <param name="fileName"></param>
/// <returns></returns> /// <returns></returns>
public static FileInfo[] GetFiles(string fileName) public static FileInfo[] GetFiles(string fileName)
{ {
string fullFilePath = Global.FilePathPrefix + fileName; string fullFilePath = Global.FilePathPrefix + fileName;
@@ -54,228 +54,228 @@ namespace PepperDash.Essentials.Core
} }
/// <summary> /// <summary>
/// Get the data from string path/filename /// Get the data from string path/filename
/// </summary> /// </summary>
/// <param name="fileName"></param> /// <param name="fileName"></param>
/// <returns></returns> /// <returns></returns>
public static string ReadDataFromFile(string fileName) public static string ReadDataFromFile(string fileName)
{ {
try try
{ {
return ReadDataFromFile(GetFile(fileName)); return ReadDataFromFile(GetFile(fileName));
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e); Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e);
return ""; return "";
} }
} }
/// <summary> /// <summary>
/// Get the data with fileInfo object /// Get the data with fileInfo object
/// </summary> /// </summary>
/// <param name="fileName"></param> /// <param name="fileName"></param>
/// <returns></returns> /// <returns></returns>
public static string ReadDataFromFile(FileInfo file) public static string ReadDataFromFile(FileInfo file)
{ {
try try
{ {
if (fileLock.TryEnter()) if (fileLock.TryEnter())
{ {
DirectoryInfo dirInfo = new DirectoryInfo(file.DirectoryName); DirectoryInfo dirInfo = new DirectoryInfo(file.DirectoryName);
Debug.Console(2, "FileIO Getting Data {0}", file.FullName); Debug.Console(2, "FileIO Getting Data {0}", file.FullName);
if (File.Exists(file.FullName)) if (File.Exists(file.FullName))
{ {
using (StreamReader r = new StreamReader(file.FullName)) using (StreamReader r = new StreamReader(file.FullName))
{ {
return r.ReadToEnd(); return r.ReadToEnd();
} }
} }
else else
{ {
Debug.Console(2, "File {0} does not exsist", file.FullName); Debug.Console(2, "File {0} does not exsist", file.FullName);
return ""; return "";
} }
} }
else else
{ {
Debug.Console(0, Debug.ErrorLogLevel.Error, "FileIO Unable to enter FileLock"); Debug.Console(0, Debug.ErrorLogLevel.Error, "FileIO Unable to enter FileLock");
return ""; return "";
} }
}
catch (Exception e)
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e);
return "";
}
finally
{
if (fileLock != null && !fileLock.Disposed)
fileLock.Leave();
} }
catch (Exception e) }
{
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e);
return "";
}
finally
{
if (fileLock != null && !fileLock.Disposed)
fileLock.Leave();
}
}
public static void ReadDataFromFileASync(string fileName) public static void ReadDataFromFileASync(string fileName)
{ {
try try
{ {
ReadDataFromFileASync(GetFile(fileName)); ReadDataFromFileASync(GetFile(fileName));
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e); Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e);
} }
} }
public static void ReadDataFromFileASync(FileInfo file) public static void ReadDataFromFileASync(FileInfo file)
{ {
try try
{ {
CrestronInvoke.BeginInvoke(o => _ReadDataFromFileASync(file)); CrestronInvoke.BeginInvoke(o => _ReadDataFromFileASync(file));
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e); Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e);
} }
} }
private static void _ReadDataFromFileASync(FileInfo file) private static void _ReadDataFromFileASync(FileInfo file)
{ {
string data; string data;
try try
{ {
if (fileLock.TryEnter()) if (fileLock.TryEnter())
{ {
DirectoryInfo dirInfo = new DirectoryInfo(file.Name); DirectoryInfo dirInfo = new DirectoryInfo(file.Name);
Debug.Console(2, "FileIO Getting Data {0}", file.FullName); Debug.Console(2, "FileIO Getting Data {0}", file.FullName);
if (File.Exists(file.FullName)) if (File.Exists(file.FullName))
{ {
using (StreamReader r = new StreamReader(file.FullName)) using (StreamReader r = new StreamReader(file.FullName))
{ {
data = r.ReadToEnd(); data = r.ReadToEnd();
} }
} }
else else
{ {
Debug.Console(2, "File {0} Does not exsist", file.FullName); Debug.Console(2, "File {0} Does not exsist", file.FullName);
data = ""; data = "";
} }
GotFileEvent.Invoke(null, new FileEventArgs(data)); GotFileEvent.Invoke(null, new FileEventArgs(data));
} }
else else
{ {
Debug.Console(0, Debug.ErrorLogLevel.Error, "FileIO Unable to enter FileLock"); Debug.Console(0, Debug.ErrorLogLevel.Error, "FileIO Unable to enter FileLock");
} }
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e); Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO read failed: \r{0}", e);
data = ""; data = "";
} }
finally finally
{ {
if (fileLock != null && !fileLock.Disposed) if (fileLock != null && !fileLock.Disposed)
fileLock.Leave(); fileLock.Leave();
} }
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="data"></param> /// <param name="data"></param>
/// <param name="filePath"></param> /// <param name="filePath"></param>
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="data"></param> /// <param name="data"></param>
/// <param name="filePath"></param> /// <param name="filePath"></param>
public static void WriteDataToFile(string data, string filePath) public static void WriteDataToFile(string data, string filePath)
{ {
Thread _WriteFileThread; Thread _WriteFileThread;
_WriteFileThread = new Thread((O) => _WriteFileMethod(data, Global.FilePathPrefix + "/" + filePath), null, Thread.eThreadStartOptions.CreateSuspended); _WriteFileThread = new Thread((O) => _WriteFileMethod(data, Global.FilePathPrefix + "/" + filePath), null, Thread.eThreadStartOptions.CreateSuspended);
_WriteFileThread.Priority = Thread.eThreadPriority.LowestPriority; _WriteFileThread.Priority = Thread.eThreadPriority.LowestPriority;
_WriteFileThread.Start(); _WriteFileThread.Start();
Debug.Console(0, Debug.ErrorLogLevel.Notice, "New WriteFile Thread"); Debug.Console(0, Debug.ErrorLogLevel.Notice, "New WriteFile Thread");
} }
static object _WriteFileMethod(string data, string filePath) static object _WriteFileMethod(string data, string filePath)
{ {
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to write file: '{0}'", filePath); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to write file: '{0}'", filePath);
try try
{ {
if (fileLock.TryEnter()) if (fileLock.TryEnter())
{ {
using (StreamWriter sw = new StreamWriter(filePath)) using (StreamWriter sw = new StreamWriter(filePath))
{ {
sw.Write(data); sw.Write(data);
sw.Flush(); sw.Flush();
} }
} }
else else
{ {
Debug.Console(0, Debug.ErrorLogLevel.Error, "FileIO Unable to enter FileLock"); Debug.Console(0, Debug.ErrorLogLevel.Error, "FileIO Unable to enter FileLock");
} }
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO write failed: \r{0}", e); Debug.Console(0, Debug.ErrorLogLevel.Error, "Error: FileIO write failed: \r{0}", e);
} }
finally finally
{ {
if (fileLock != null && !fileLock.Disposed) if (fileLock != null && !fileLock.Disposed)
fileLock.Leave(); fileLock.Leave();
} }
return null; return null;
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public static bool FileIoUnitTest() public static bool FileIoUnitTest()
{ {
var testData = "Testing FileIO"; var testData = "Testing FileIO";
FileIO.WriteDataToFile(testData, "\\user\\FileIOTest.pdt"); FileIO.WriteDataToFile(testData, "\\user\\FileIOTest.pdt");
var file = FileIO.GetFile("\\user\\*FileIOTest*"); var file = FileIO.GetFile("\\user\\*FileIOTest*");
var readData = FileIO.ReadDataFromFile(file);
Debug.Console(0, "Returned {0}", readData);
File.Delete(file.FullName);
if (testData == readData)
{
return true;
}
else
{
return false;
}
}
var readData = FileIO.ReadDataFromFile(file); }
Debug.Console(0, "Returned {0}", readData); public class FileEventArgs
File.Delete(file.FullName); {
if (testData == readData) public FileEventArgs(string data) { Data = data; }
{ public string Data { get; private set; } // readonly
return true;
}
else
{
return false;
}
}
} }
public class FileEventArgs
{
public FileEventArgs(string data) { Data = data; }
public string Data { get; private set; } // readonly
}
} }

View File

@@ -22,7 +22,7 @@ namespace PepperDash.Essentials.DM
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
/// ///
/// </summary> /// </summary>
public class DmBladeChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitchWithEndpointOnlineFeedback, IRoutingNumericWithFeedback public class DmBladeChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingNumericWithFeedback
{ {
private const string NonePortKey = "inputCard0--None"; private const string NonePortKey = "inputCard0--None";

View File

@@ -23,7 +23,7 @@ namespace PepperDash.Essentials.DM
/// ///
/// </summary> /// </summary>
[Description("Wrapper class for all DM-MD chassis variants from 8x8 to 32x32")] [Description("Wrapper class for all DM-MD chassis variants from 8x8 to 32x32")]
public class DmChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitchWithEndpointOnlineFeedback, IRoutingNumericWithFeedback public class DmChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingNumericWithFeedback
{ {
private const string NonePortKey = "inputCard0--None"; private const string NonePortKey = "inputCard0--None";
public DMChassisPropertiesConfig PropertiesConfig { get; set; } public DMChassisPropertiesConfig PropertiesConfig { get; set; }

View File

@@ -436,9 +436,9 @@ namespace PepperDash.Essentials.DM
} }
return rx; return rx;
} }
else if (parentDev is IDmSwitchWithEndpointOnlineFeedback) else if (parentDev is DmChassisController)
{ {
var controller = parentDev as IDmSwitchWithEndpointOnlineFeedback; var controller = parentDev as DmChassisController;
var chassis = controller.Chassis; var chassis = controller.Chassis;
var num = props.ParentOutputNumber; var num = props.ParentOutputNumber;
Debug.Console(1, "Creating DM Chassis device '{0}'. Output number '{1}'.", key, num); Debug.Console(1, "Creating DM Chassis device '{0}'. Output number '{1}'.", key, num);

View File

@@ -127,10 +127,10 @@ namespace PepperDash.Essentials.DM
BasicDmTxControllerBase tx; BasicDmTxControllerBase tx;
bool useChassisForOfflineFeedback = false; bool useChassisForOfflineFeedback = false;
if (parentDev is IDmSwitchWithEndpointOnlineFeedback) if (parentDev is DmChassisController)
{ {
// Get the Crestron chassis and link stuff up // Get the Crestron chassis and link stuff up
var switchDev = (parentDev as IDmSwitchWithEndpointOnlineFeedback); var switchDev = (parentDev as DmChassisController);
var chassis = switchDev.Chassis; var chassis = switchDev.Chassis;
//Check that the input is within range of this chassis' possible inputs //Check that the input is within range of this chassis' possible inputs
@@ -179,7 +179,6 @@ namespace PepperDash.Essentials.DM
return null; return null;
} }
} }
if (parentDev is DmpsRoutingController) if (parentDev is DmpsRoutingController)
{ {
// Get the DMPS chassis and link stuff up // Get the DMPS chassis and link stuff up

View File

@@ -16,17 +16,10 @@ using PepperDash.Essentials.Core;
using PepperDash.Essentials.DM.Config; using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM { namespace PepperDash.Essentials.DM {
public interface IDmSwitch public interface IDmSwitch {
{
Switch Chassis { get; } Switch Chassis { get; }
Dictionary<uint, string> TxDictionary { get; } Dictionary<uint, string> TxDictionary { get; }
Dictionary<uint, string> RxDictionary { get; } Dictionary<uint, string> RxDictionary { get; }
} }
public interface IDmSwitchWithEndpointOnlineFeedback : IDmSwitch
{
Dictionary<uint, BoolFeedback> InputEndpointOnlineFeedbacks { get; }
Dictionary<uint, BoolFeedback> OutputEndpointOnlineFeedbacks { get; }
}
} }