mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 05:05:00 +00:00
Compare commits
11 Commits
hotfix/fil
...
1.13.4-hot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39e1e5167b | ||
|
|
c53cad8119 | ||
|
|
82e8b4b203 | ||
|
|
8c3b891255 | ||
|
|
10fc8ee30b | ||
|
|
8da8b8c584 | ||
|
|
c7e0326b8c | ||
|
|
465aa947cf | ||
|
|
3b2fa8aec5 | ||
|
|
ffa864c71b | ||
|
|
112a2b7382 |
37
.github/workflows/add-issues-to-project.yml
vendored
Normal file
37
.github/workflows/add-issues-to-project.yml
vendored
Normal 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 }}
|
||||||
|
|
||||||
@@ -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)
|
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 "";
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (fileLock != null && !fileLock.Disposed)
|
if (fileLock != null && !fileLock.Disposed)
|
||||||
fileLock.Leave();
|
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);
|
var readData = FileIO.ReadDataFromFile(file);
|
||||||
Debug.Console(0, "Returned {0}", readData);
|
Debug.Console(0, "Returned {0}", readData);
|
||||||
File.Delete(file.FullName);
|
File.Delete(file.FullName);
|
||||||
if (testData == readData)
|
if (testData == readData)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public class FileEventArgs
|
public class FileEventArgs
|
||||||
{
|
{
|
||||||
public FileEventArgs(string data) { Data = data; }
|
public FileEventArgs(string data) { Data = data; }
|
||||||
public string Data { get; private set; } // readonly
|
public string Data { get; private set; } // readonly
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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";
|
||||||
|
|
||||||
|
|||||||
@@ -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; }
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user