示例#1
0
 public void LoadJoins()
 {
     InDigitals.Clear();
     foreach (IRCode irc in PluginSettings.IRCodes)
     {
         InDigitals.Add(irc.Name);
     }
 }
示例#2
0
        private void LoadDefinitions()
        {
            foreach (Signal signal in InDigitals)
            {
                signal.OnDataChange -= SignalDataChange;
            }
            foreach (Signal signal in InAnalogs)
            {
                signal.OnDataChange -= SignalDataChange;
            }
            foreach (Signal signal in InSerials)
            {
                signal.OnDataChange -= SignalDataChange;
            }
            foreach (Signal signal in OutDigitals)
            {
                signal.OnDataChange -= SignalDataChange;
            }
            foreach (Signal signal in OutAnalogs)
            {
                signal.OnDataChange -= SignalDataChange;
            }
            foreach (Signal signal in OutSerials)
            {
                signal.OnDataChange -= SignalDataChange;
            }

            InDigitals.Clear();
            InAnalogs.Clear();
            InSerials.Clear();
            OutAnalogs.Clear();
            OutDigitals.Clear();
            OutSerials.Clear();

            ushort i = 1;

            if (_plugin.InDigitals != null)
            {
                foreach (string s in _plugin.InDigitals)
                {
                    Signal ss = new Signal(this, i, s, SignalTypeEnum.Digital, SignalDirectionEnum.Input);
                    ss.OnDataChange += SignalDataChange;
                    InDigitals.Add(ss);
                    i++;
                }
            }
            i = 1;
            if (_plugin.InAnalogs != null)
            {
                foreach (string s in _plugin.InAnalogs)
                {
                    Signal ss = new Signal(this, i, s, SignalTypeEnum.Analog, SignalDirectionEnum.Input);
                    ss.OnDataChange += SignalDataChange;
                    InAnalogs.Add(ss);
                    i++;
                }
            }
            i = 1;
            if (_plugin.InSerials != null)
            {
                foreach (string s in _plugin.InSerials)
                {
                    Signal ss = new Signal(this, i, s, SignalTypeEnum.Serial, SignalDirectionEnum.Input);
                    ss.OnDataChange += SignalDataChange;
                    InSerials.Add(ss);
                    i++;
                }
            }
            i = 1;
            if (_plugin.OutDigitals != null)
            {
                foreach (string s in _plugin.OutDigitals)
                {
                    Signal ss = new Signal(this, i, s, SignalTypeEnum.Digital, SignalDirectionEnum.Output);
                    ss.OnDataChange += SignalDataChange;
                    OutDigitals.Add(ss);
                    i++;
                }
            }
            i = 1;
            if (_plugin.OutAnalogs != null)
            {
                foreach (string s in _plugin.OutAnalogs)
                {
                    Signal ss = new Signal(this, i, s, SignalTypeEnum.Analog, SignalDirectionEnum.Output);
                    ss.OnDataChange += SignalDataChange;
                    OutAnalogs.Add(ss);
                    i++;
                }
            }
            i = 1;
            if (_plugin.InSerials != null)
            {
                foreach (string s in _plugin.OutSerials)
                {
                    Signal ss = new Signal(this, i, s, SignalTypeEnum.Serial, SignalDirectionEnum.Output);
                    ss.OnDataChange += SignalDataChange;
                    OutSerials.Add(ss);
                    i++;
                }
            }
        }