using System; using System.Collections.Generic; using System.Text; using System.Drawing; using System.IO; using System.Xml; namespace FCC_Uber_MDX_Configurator { public static class LogicModules { public const int MaxErrorPixels = 3; public static Size SizeOfLogicBlocks = new Size(58, 56); #region Root Logic Area public static List _RootMainLogicModuleList = new List(); #endregion #region Generic Function public static List _Global_FunctionsList = new List(); public class PsuedoFunctionMDX { public List _listOfInputs = new List(); public string _id; public PsuedoFunctionMDX(List input_Inputs, string input_ID) { _id = input_ID; _listOfInputs = input_Inputs; } } public class Module_FunctionMDX : Module { public string _ID; public Module_FunctionMDX(PsuedoFunctionMDX input_PsuedoModel, Point input_ModuleLocation, Bitmap input_Image) { _ID = input_PsuedoModel._id; List _inNodes = new List(); for (int i = 0; i < input_PsuedoModel._listOfInputs.Count; i++) { ModuleFace _MF = ModuleFace.LeftSide; if (input_PsuedoModel._listOfInputs.Count <= 3) { _MF = ModuleFace.LeftSide; } else { //Change Faces based on number of inputs } _inNodes.Add(new Node(input_PsuedoModel._listOfInputs[i], _MF)); } Node output = new Node("Output of " + input_PsuedoModel._id, ModuleFace.RightSide); Input_Nodes.Clear(); Input_Nodes.AddRange(_inNodes.ToArray()); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = input_PsuedoModel._id; HelpText = input_PsuedoModel._id + " ["; int _sIteration = 0; foreach (string _s in input_PsuedoModel._listOfInputs) { if (_sIteration != 0) { HelpText += ","; } HelpText += " " + _s; _sIteration++; } HelpText += "]"; ModuleCursor = new System.Windows.Forms.Cursor(input_Image.GetHicon()); } } public class FunctionMDX { public string _FunctionID = "My Function"; public List _Modules = new List(); /* ROOT NODE EDITING ONLY */ public string _timerID = "logic"; public int _TimeInbetween = 100; public List _ThenList = new List(); public List _AntiThenList = new List(); /* END ROOT NODE EDITING ONLY*/ public FunctionMDX() { NameMe(); _Modules = new List(); } public FunctionMDX(string input_id) { NameMe(); _Modules = new List(); } private void NameMe() { _FunctionID = "My Function"; if (!CheckAgainstAllFunctions(_FunctionID)) { int i_MyFunc = 1; while (!CheckAgainstAllFunctions(_FunctionID + i_MyFunc.ToString())) { i_MyFunc++; } _FunctionID = _FunctionID + i_MyFunc.ToString(); } } private bool CheckAgainstAllFunctions(string test) { foreach (PsuedoFunctionMDX _p in _Global_FunctionsList) { if (_p._id.ToLower() == test.ToLower()) { return false; } } return true; } } #endregion #region Check if Module is a Function public static bool Module_is_a_Function(Module _mod) { switch (_mod.id) { case "AND": case "OR": case "NOT": case "NAND": case "NOR": case "XOR": case "LESS THAN": case "LESS THAN OR EQUAL TO": case "GREATER THAN": case "GREATER THAN OR EQUAL TO": case "EQUAL TO": case "NOT EQUAL TO": case "DIGITALOUTPUT": case "ADD": case "SUBTRACT": case "MULTIPLY": case "DIVIDE": case "NUMBER": case "VARIABLE": return false; default: //Check against all functions that it is a function foreach (LogicModules.PsuedoFunctionMDX temp_psuedo in LogicModules._Global_FunctionsList) { if (temp_psuedo._id.ToLower() == _mod.id.ToLower()) { return true; } } return false; } } #endregion #region ReadInAllFunctions public static void ReadInAllFunctions() { _Global_FunctionsList.Clear(); string[] _AllFiles = Directory.GetFiles(GlobalStaticClass.FUNCTION_DIRECTORY, "*.xml"); List _AllSupportedFilesList = new List(); for (int i = 0; i < _AllFiles.Length; i++) { if (_AllFiles[i].EndsWith(".xml")) { string _tempFileNoExtension = _AllFiles[i].Substring(0, _AllFiles[i].Length - ".xml".Length); if (File.Exists(_tempFileNoExtension + ".designer")) { _AllSupportedFilesList.Add(_tempFileNoExtension); } } } if (_AllSupportedFilesList.Count == 0) { return; } foreach (string _file in _AllSupportedFilesList) { try { FileStream _fs = new FileStream(_file + ".xml", FileMode.Open, FileAccess.Read); StreamReader _sr = new StreamReader(_fs); string _tempRead = _sr.ReadToEnd(); _sr.Close(); _fs.Close(); XmlDocument _xml = new XmlDocument(); _xml.LoadXml(_tempRead); if (_xml == null) { continue; } XmlNode _tempRoot = _xml.SelectSingleNode("function"); if (_tempRoot == null) { continue; } XmlNodeList _xml_inputs = _tempRoot.SelectNodes("input"); string[] _tempInputArray = new string[_xml_inputs.Count]; for (int i_Node = 0; i_Node < _xml_inputs.Count; i_Node++) { _tempInputArray[i_Node] = _xml_inputs[i_Node].InnerText; } _Global_FunctionsList.Add(new PsuedoFunctionMDX(new List(_tempInputArray), (_file.Split(new char[] { '\\' }))[(_file.Split(new char[] { '\\' })).Length - 1])); } catch (Exception) { } } } #endregion #region Node public class Node { public enum LinkDirection { INPUT, OUTPUT } public class ConnectLink { public Module Link_Module; public LinkDirection Link_Direction; public Node Link_Node; public ConnectLink(Module _mod, LinkDirection _dir, Node _nod) { Link_Module = _mod; Link_Direction = _dir; Link_Node = _nod; } } public string NodeName; public ConnectLink LinkTo; public ModuleFace Module_Face; public System.Drawing.Rectangle Node_Bounds; public Node(string input_name, ModuleFace input_Face) { NodeName = input_name; Module_Face = input_Face; } public void SetNodeBounds(System.Drawing.Rectangle _rect) { Node_Bounds = _rect; } public bool isConnected() { if (LinkTo == null) { return false; } return true; } } #endregion #region Module public enum ModuleFace { LeftSide = 0, RightSide, UpSide, DownSide } public class Module { public string id; public string HelpText = ""; public List Input_Nodes = new List(); public List Output_Nodes = new List(); public System.Drawing.Point ModuleLocation; public System.Drawing.Size ModuleSize; public System.Drawing.Image ModuleImage; public System.Drawing.Rectangle ModuleBounds; public System.Drawing.Rectangle ModuleBounds_NonTerminal; public System.Windows.Forms.Cursor ModuleCursor = System.Windows.Forms.Cursors.Arrow; } #endregion #region Input public class LogicModule_INPUT : Module { public string referenceID; public LogicModule_INPUT(Point input_ModuleLocation, Image input_Image, Module input_Parent, string input_referenceID) { Node output = new Node("Function Input", ModuleFace.RightSide); Input_Nodes.Clear(); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "INPUT"; referenceID = input_referenceID; HelpText = "Function's Input Entrance Node"; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.LogicInputIcon.GetHicon()); } } #endregion #region Output public class LogicModule_OUTPUT : Module { public LogicModule_OUTPUT(Point input_ModuleLocation, Image input_Image, Module input_Parent) { setup(input_ModuleLocation, input_Image, input_Parent); } public LogicModule_OUTPUT() { setup(new Point(0, 0), global::FCC_Uber_MDX_Configurator.Properties.Resources.LogicOutputIcon, null); } private void setup(Point input_ModuleLocation, Image input_Image, Module input_Parent) { Node input_node = new Node("Function Output", ModuleFace.LeftSide); Input_Nodes.Clear(); Input_Nodes.AddRange(new Node[] { input_node }); Output_Nodes.Clear(); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "OUTPUT"; HelpText = "Function's Output Exit Node"; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.LogicOutputIcon.GetHicon()); } } #endregion #region And Module public class LogicModule_And2 : Module { public LogicModule_And2(Point input_ModuleLocation, Image input_Image, Module input_Parent) { Node input_A = new Node("Input A", ModuleFace.LeftSide); Node input_B = new Node("Input B", ModuleFace.LeftSide); Node output = new Node("Output", ModuleFace.RightSide); Input_Nodes.Clear(); Input_Nodes.AddRange(new Node[] { input_A, input_B }); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "AND"; HelpText = "AND: Both inputs must be true for the output to be true. Otherwise false."; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.AND_Icon.GetHicon()); } } #endregion #region Or Module public class LogicModule_Or2 : Module { public LogicModule_Or2(Point input_ModuleLocation, Image input_Image, Module input_Parent) { Node input_A = new Node("Input A", ModuleFace.LeftSide); Node input_B = new Node("Input B", ModuleFace.LeftSide); Node output = new Node("Output", ModuleFace.RightSide); Input_Nodes.Clear(); Input_Nodes.AddRange(new Node[] { input_A, input_B }); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "OR"; HelpText = "OR: Either input can be true for the output to be true. Otherwise false."; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.OR_Icon.GetHicon()); } } #endregion #region Not Module public class LogicModule_Not2 : Module { public LogicModule_Not2(Point input_ModuleLocation, Image input_Image, Module input_Parent) { Node input_A = new Node("Input A", ModuleFace.LeftSide); Node output = new Node("Output", ModuleFace.RightSide); Input_Nodes.Clear(); Input_Nodes.AddRange(new Node[] { input_A }); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "NOT"; HelpText = "NOT: Inverts the input. If input is true, output is false. If input is false, output is true."; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.NOT_Icon.GetHicon()); } } #endregion #region Nand Module public class LogicModule_Nand2 : Module { public LogicModule_Nand2(Point input_ModuleLocation, Image input_Image, Module input_Parent) { Node input_A = new Node("Input A", ModuleFace.LeftSide); Node input_B = new Node("Input B", ModuleFace.LeftSide); Node output = new Node("Output", ModuleFace.RightSide); Input_Nodes.Clear(); Input_Nodes.AddRange(new Node[] { input_A, input_B }); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "NAND"; HelpText = "NAND: Both inputs must be true, for the output to be false. Otherwise true."; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.NAND_Icon.GetHicon()); } } #endregion #region Nor Module public class LogicModule_Nor2 : Module { public LogicModule_Nor2(Point input_ModuleLocation, Image input_Image, Module input_Parent) { Node input_A = new Node("Input A", ModuleFace.LeftSide); Node input_B = new Node("Input B", ModuleFace.LeftSide); Node output = new Node("Output", ModuleFace.RightSide); Input_Nodes.Clear(); Input_Nodes.AddRange(new Node[] { input_A, input_B }); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "NOR"; HelpText = "NOR: If either output is true, then output is false. Otherwise true."; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.NOR_Icon.GetHicon()); } } #endregion #region Xor Module public class LogicModule_Xor2 : Module { public LogicModule_Xor2(Point input_ModuleLocation, Image input_Image, Module input_Parent) { Node input_A = new Node("Input A", ModuleFace.LeftSide); Node input_B = new Node("Input B", ModuleFace.LeftSide); Node output = new Node("Output", ModuleFace.RightSide); Input_Nodes.Clear(); Input_Nodes.AddRange(new Node[] { input_A, input_B }); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "XOR"; HelpText = "XOR: If both inputs are the same (both true or both false) then the output would be false. If the inputs are different, then the output will be true."; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.XOR_Icon.GetHicon()); } } #endregion #region Addition Module public class LogicModule_Add : Module { public LogicModule_Add(Point input_ModuleLocation, Image input_Image, Module input_Parent) { Node input_A = new Node("Input A", ModuleFace.LeftSide); Node input_B = new Node("Input B", ModuleFace.LeftSide); Node output = new Node("Output", ModuleFace.RightSide); Input_Nodes.Clear(); Input_Nodes.AddRange(new Node[] { input_A, input_B }); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "ADD"; HelpText = "ADD: Sums the 2 numeric inputs."; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.Text_Addition_Icon.GetHicon()); } } #endregion #region Subtraction Module public class LogicModule_Subtraction : Module { public LogicModule_Subtraction(Point input_ModuleLocation, Image input_Image, Module input_Parent) { Node input_A = new Node("Input A", ModuleFace.LeftSide); Node input_B = new Node("Input B", ModuleFace.LeftSide); Node output = new Node("Output", ModuleFace.RightSide); Input_Nodes.Clear(); Input_Nodes.AddRange(new Node[] { input_A, input_B }); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "SUBTRACT"; HelpText = "SUBTRACT: Subtracts Input B from Input A and outputs it."; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.Text_Subtraction_Icon.GetHicon()); } } #endregion #region Multiplication Module public class LogicModule_Multiplication : Module { public LogicModule_Multiplication(Point input_ModuleLocation, Image input_Image, Module input_Parent) { Node input_A = new Node("Input A", ModuleFace.LeftSide); Node input_B = new Node("Input B", ModuleFace.LeftSide); Node output = new Node("Output", ModuleFace.RightSide); Input_Nodes.Clear(); Input_Nodes.AddRange(new Node[] { input_A, input_B }); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "MULTIPLY"; HelpText = "MULTIPLY: Multiplies Input A with Input B and outputs it."; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.Text_Multiplication_Icon.GetHicon()); } } #endregion #region Division Module public class LogicModule_Division : Module { public LogicModule_Division(Point input_ModuleLocation, Image input_Image, Module input_Parent) { Node input_A = new Node("Input A", ModuleFace.LeftSide); Node input_B = new Node("Input B", ModuleFace.LeftSide); Node output = new Node("Output", ModuleFace.RightSide); Input_Nodes.Clear(); Input_Nodes.AddRange(new Node[] { input_A, input_B }); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "DIVIDE"; HelpText = "DIVIDE: Divides Input A by Input B and outputs it."; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.Text_Division_Icon.GetHicon()); } } #endregion #region Equals Module public class LogicModule_Equals : Module { public LogicModule_Equals(Point input_ModuleLocation, Image input_Image, Module input_Parent) { Node input_A = new Node("Input A", ModuleFace.LeftSide); Node input_B = new Node("Input B", ModuleFace.LeftSide); Node output = new Node("Output", ModuleFace.RightSide); Input_Nodes.Clear(); Input_Nodes.AddRange(new Node[] { input_A, input_B }); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "EQUAL TO"; HelpText = "EQUAL TO: If the 2 inputs are exactly equal, then the output is true. Otherwise false."; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.Text_Equals_Icon.GetHicon()); } } #endregion #region Not Equals Module public class LogicModule_NotEquals : Module { public LogicModule_NotEquals(Point input_ModuleLocation, Image input_Image, Module input_Parent) { Node input_A = new Node("Input A", ModuleFace.LeftSide); Node input_B = new Node("Input B", ModuleFace.LeftSide); Node output = new Node("Output", ModuleFace.RightSide); Input_Nodes.Clear(); Input_Nodes.AddRange(new Node[] { input_A, input_B }); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "NOT EQUAL TO"; HelpText = "NOT EQUALS TO: If the two inputs are not exactly equal, then the output is true. If they are the same, then the output is false."; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.Text_NotEqual_Icon.GetHicon()); } } #endregion #region Less Than Module public class LogicModule_LessThan : Module { public LogicModule_LessThan(Point input_ModuleLocation, Image input_Image, Module input_Parent) { Node input_A = new Node("Input A", ModuleFace.LeftSide); Node input_B = new Node("Input B", ModuleFace.LeftSide); Node output = new Node("Output", ModuleFace.RightSide); Input_Nodes.Clear(); Input_Nodes.AddRange(new Node[] { input_A, input_B }); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "LESS THAN"; HelpText = "LESS THAN: If Input A is less than Input B, output is true. Otherwise false."; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.Text_LessThan_icon.GetHicon()); } } #endregion #region Less Than or Equal To Module public class LogicModule_LessThanOrEqualTo : Module { public LogicModule_LessThanOrEqualTo(Point input_ModuleLocation, Image input_Image, Module input_Parent) { Node input_A = new Node("Input A", ModuleFace.LeftSide); Node input_B = new Node("Input B", ModuleFace.LeftSide); Node output = new Node("Output", ModuleFace.RightSide); Input_Nodes.Clear(); Input_Nodes.AddRange(new Node[] { input_A, input_B }); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "LESS THAN OR EQUAL TO"; HelpText = "LESS THAN OR EQUAL TO: If input A is less than or equal to input B, then output is true. Otherwise false."; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.Text_LessThanOrEqualTo_icon.GetHicon()); } } #endregion #region Greater Than Module public class LogicModule_GreaterThan : Module { public LogicModule_GreaterThan(Point input_ModuleLocation, Image input_Image, Module input_Parent) { Node input_A = new Node("Input A", ModuleFace.LeftSide); Node input_B = new Node("Input B", ModuleFace.LeftSide); Node output = new Node("Output", ModuleFace.RightSide); Input_Nodes.Clear(); Input_Nodes.AddRange(new Node[] { input_A, input_B }); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "GREATER THAN"; HelpText = "GREATER THAN: If Input A is greater than Input B, output is true. Otherwise false."; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.Text_GreaterThan_Icon.GetHicon()); } } #endregion #region Greater Than or Equal To Module public class LogicModule_GreaterThanOrEqualTo : Module { public LogicModule_GreaterThanOrEqualTo(Point input_ModuleLocation, Image input_Image, Module input_Parent) { Node input_A = new Node("Input A", ModuleFace.LeftSide); Node input_B = new Node("Input B", ModuleFace.LeftSide); Node output = new Node("Output", ModuleFace.RightSide); Input_Nodes.Clear(); Input_Nodes.AddRange(new Node[] { input_A, input_B }); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "GREATER THAN OR EQUAL TO"; HelpText = "GREATER THAN OR EQUAL TO: If input A is greater than or equal to Input B, then output is true. Otherwise false."; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.Text_GreaterThanOrEqualTo_Icon.GetHicon()); } } #endregion #region Between Exclusive/Exclusive Module public class LogicModule_BetweenEE : Module { public LogicModule_BetweenEE(Point input_ModuleLocation, Image input_Image, Module input_Parent) { Node input_L = new Node("Lower Value", ModuleFace.UpSide); Node input_C = new Node("Comparison Value", ModuleFace.LeftSide); Node input_U = new Node("Upper Value", ModuleFace.DownSide); Node output = new Node("Output", ModuleFace.RightSide); Input_Nodes.Clear(); Input_Nodes.AddRange(new Node[] { input_L, input_C, input_U }); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "BETWEEN EE"; HelpText = "BETWEEN EE: If Input C is greater than input L and less than input U, output is true. Otherwise, false."; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.Text_Between_Exclusive_Exclusive.GetHicon()); } } #endregion #region Between Inclusive/Exclusive Module public class LogicModule_BetweenIE : Module { public LogicModule_BetweenIE(Point input_ModuleLocation, Image input_Image, Module input_Parent) { Node input_L = new Node("Lower Value", ModuleFace.UpSide); Node input_C = new Node("Comparison Value", ModuleFace.LeftSide); Node input_U = new Node("Upper Value", ModuleFace.DownSide); Node output = new Node("Output", ModuleFace.RightSide); Input_Nodes.Clear(); Input_Nodes.AddRange(new Node[] { input_L, input_C, input_U }); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "BETWEEN IE"; HelpText = "BETWEEN IE: If Input C is greater than or equal to input L and less than input U, output is true. Otherwise, false."; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.Text_Between_Inclusive_Exclusive.GetHicon()); } } #endregion #region Between Inclusive/Exclusive Module public class LogicModule_BetweenEI : Module { public LogicModule_BetweenEI(Point input_ModuleLocation, Image input_Image, Module input_Parent) { Node input_L = new Node("Lower Value", ModuleFace.UpSide); Node input_C = new Node("Comparison Value", ModuleFace.LeftSide); Node input_U = new Node("Upper Value", ModuleFace.DownSide); Node output = new Node("Output", ModuleFace.RightSide); Input_Nodes.Clear(); Input_Nodes.AddRange(new Node[] { input_L, input_C, input_U }); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "BETWEEN EI"; HelpText = "BETWEEN EI: If Input C is greater than input L and less than or equal to input U, output is true. Otherwise, false."; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.Text_Between_Exclusive_Inclusive.GetHicon()); } } #endregion #region Between Inclusive/Inclusive Module public class LogicModule_BetweenII : Module { public LogicModule_BetweenII(Point input_ModuleLocation, Image input_Image, Module input_Parent) { Node input_L = new Node("Lower Value", ModuleFace.UpSide); Node input_C = new Node("Comparison Value", ModuleFace.LeftSide); Node input_U = new Node("Upper Value", ModuleFace.DownSide); Node output = new Node("Output", ModuleFace.RightSide); Input_Nodes.Clear(); Input_Nodes.AddRange(new Node[] { input_L, input_C, input_U }); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "BETWEEN II"; HelpText = "BETWEEN II: If Input C is greater than or equal to input L and less than or equal to input U, output is true. Otherwise, false."; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.Text_Between_Inclusive_Inclusive.GetHicon()); } } #endregion #region Number Module public class LogicModule_Number : Module { public double NumberValue = 0.0f; public LogicModule_Number(Point input_ModuleLocation, Image input_Image, Module input_Parent, double input_value) { Node output = new Node("Output", ModuleFace.RightSide); Input_Nodes.Clear(); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "NUMBER"; NumberValue = input_value; HelpText = "NUMBER: A static number to compare against or use in equations."; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.NumberIconTransparent.GetHicon()); } } #endregion #region Analogue Input public class LogicModule_ANALOGUEINPUT : Module { public string referenceID; public LogicModule_ANALOGUEINPUT(Point input_ModuleLocation, Image input_Image, Module input_Parent, string input_referenceID) { Node output = new Node("Analogue Input", ModuleFace.RightSide); Input_Nodes.Clear(); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "ANALOGUEINPUT"; referenceID = input_referenceID; HelpText = "Analogue Input Node"; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.InputIcon.GetHicon()); } } #endregion #region Digital Output public class LogicModule_DIGITALOUTPUT : Module { public string referenceID; public LogicModule_DIGITALOUTPUT(Point input_ModuleLocation, Image input_Image, Module input_Parent, string input_referenceID) { Node output = new Node("Digital Output", ModuleFace.RightSide); Input_Nodes.Clear(); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "DIGITALOUTPUT"; referenceID = input_referenceID; HelpText = "Digital Output Node"; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.OutputIcon.GetHicon()); } } #endregion #region Variable public class LogicModule_VARIABLE : Module { public string referenceID; public string getOrSet = "get"; public LogicModule_VARIABLE(Point input_ModuleLocation, Image input_Image, Module input_Parent, string input_referenceID, string input_getOrSet) { Node output = new Node("Variable", ModuleFace.RightSide); Node inputPassThrough = new Node("VariablePassThroughInput", ModuleFace.LeftSide); Input_Nodes.Clear(); Output_Nodes.Clear(); Output_Nodes.AddRange(new Node[] { output }); if (input_getOrSet.ToLower() == "set") { Input_Nodes.AddRange(new Node[] { inputPassThrough }); } ModuleLocation = input_ModuleLocation; ModuleImage = input_Image; ModuleSize = SizeOfLogicBlocks; id = "VARIABLE"; referenceID = input_referenceID; getOrSet = input_getOrSet.ToLower(); HelpText = "Variable Node"; ModuleCursor = new System.Windows.Forms.Cursor(global::FCC_Uber_MDX_Configurator.Properties.Resources.VariableIcon.GetHicon()); } } #endregion } }