Example #1
0
        private void Load(CfgFile cfgFile, string[] strings)
        {
            int[][] channelsData = new int[cfgFile.AllChannelsCount][];

            for (int index = 0; index < channelsData.Length; index++)
            {
                channelsData[index] = new int[strings.Length];
            }

            for (int i = 0; i < strings.Length; i++)
            {
                var parameters = strings[i].Split(',');
                for (int j = 0; j < cfgFile.AllChannelsCount; j++)
                {
                    channelsData[j][i] = (int)double.Parse(parameters[j + 2], CultureInfo.InvariantCulture);
                }
            }

            _analogChannels = new AnalogChannel[cfgFile.AnalogChannels];
            for (int i = 0; i < cfgFile.AnalogChannelConfigurations.Length; i++)
            {
                AnalogChannels[i] = new AnalogChannel(cfgFile.AnalogChannelConfigurations[i], channelsData[i], cfgFile.RunOsc);;
            }
            AnalogChannel.SetBrushes(AnalogChannels);
            _discretChannels = new DiscretChannel[cfgFile.DiscretChannels];

            for (int i = 0; i < cfgFile.DiscretChannelConfigurations.Length; i++)
            {
                DiscretChannels[i] = new DiscretChannel(cfgFile.DiscretChannelConfigurations[i], channelsData[i + cfgFile.AnalogChannelConfigurations.Length], cfgFile.RunOsc);
            }
        }
Example #2
0
        public DatFile(CfgFile cfgFile, List <int[]> analogData, List <ushort[]> discretData)
        {
            _analogChannels = new AnalogChannel[cfgFile.AnalogChannels];
            for (int i = 0; i < cfgFile.AnalogChannelConfigurations.Length; i++)
            {
                AnalogChannels[i] = new AnalogChannel(cfgFile.AnalogChannelConfigurations[i], analogData[i].ToArray(), cfgFile.RunOsc);;
            }
            AnalogChannel.SetBrushes(AnalogChannels);
            _discretChannels = new DiscretChannel[cfgFile.DiscretChannels];

            for (int i = 0; i < cfgFile.DiscretChannelConfigurations.Length; i++)
            {
                DiscretChannels[i] = new DiscretChannel(cfgFile.DiscretChannelConfigurations[i], discretData[i].Select(o => (int)o).ToArray(), cfgFile.RunOsc);
            }
        }