Exemple #1
0
        public byte[] RawDataFromScanLists()
        {
            byte[] rawData   = new byte[DATA_WIDTH * MAX];
            int    tmpOffset = 0;

            for (int i = 0; i < allScanLists.Rows.Count; i++)
            {
                ScanListObject oneScanList = (ScanListObject)allScanLists.Rows[i].ItemArray[SCANLIST];
                Array.Copy(oneScanList.RawData, 0, rawData, tmpOffset, DATA_WIDTH);
                tmpOffset += DATA_WIDTH;
            }
            return(rawData);
        }
Exemple #2
0
 public void FromCSV(String[] csvData, Channels allChannels, bool withGUID)
 {
     initDataTable();
     for (int i = 1; i < csvData.Length; i++) //skip line with index 0 - it's the header line
     {
         if (csvData[i].Length > 0)
         {
             ScanListObject oneScanList = new ScanListObject();
             oneScanList.SetDataFromCSV(csvData[i], allChannels, withGUID);
             if (Debug.GetInstance().DebugOn)
             {
                 Console.WriteLine("In:  " + csvData[i]);
                 Console.WriteLine("Out: " + oneScanList.ToString(allChannels));
             }
             AddScanList(oneScanList);
         }
     }
 }
Exemple #3
0
        public void ScanListsFromRawData(byte[] rawData, bool debug)
        {
            int offset = OFFSET;

            for (int i = 0; i < MAX; i++)
            {
                //Console.WriteLine("ScanLists: "+i);
                String hex;
                byte[] oneScanListRaw = new byte[DATA_WIDTH];
                for (int j = 0; j < DATA_WIDTH; j++)
                {
                    byte value = rawData[offset + j];
                    oneScanListRaw[j] = value;
                    if (debug)
                    {
                        hex = string.Format("{0:X2}", value);
                        Console.Write(hex + " ");
                    }
                }
                if (debug)
                {
                    Console.WriteLine();
                }
                offset += DATA_WIDTH;
                ScanListObject ch = new ScanListObject();
                ch.RawData = oneScanListRaw;
                AddScanList(ch);
                if (debug)
                {
                    Console.WriteLine(ch.ToString());
                    oneScanListRaw = ch.RawData;
                    for (int j = 0; j < DATA_WIDTH; j++)
                    {
                        byte value = oneScanListRaw[j];
                        hex = string.Format("{0:X2}", value);
                        Console.Write(hex + " ");
                    }
                    Console.WriteLine();
                }
            }
        }
Exemple #4
0
        public String[] ToCSV(Channels allChannels, bool withGUID)
        {
            int size = allScanLists.Rows.Count + 1; //count + header line

            String[] allLines = new String[size];
            allLines[0] = "GUID;Name;Channel1;Channel2;Channel3;Channel4;Channel5;Channel6;Channel7;Channel8;Channel9;Channel10;Channel11;Channel12;Channel13;Channel14;Channel15;Channel16";
            for (int i = 0; i < allScanLists.Rows.Count; i++)
            {
                ScanListObject oneScanList = (ScanListObject)allScanLists.Rows[i].ItemArray[SCANLIST];
                if (withGUID && !Tools.IsEmpty(oneScanList.ScanListName))
                {
                    allLines[i + 1] = oneScanList.ToString(allChannels, true);
                }
                else
                {
                    if (!Tools.IsEmpty(oneScanList.ScanListName))
                    {
                        allLines[i + 1] = oneScanList.ToString(allChannels);
                    }
                }
            }
            return(allLines);
        }
Exemple #5
0
 public void AddScanList(ScanListObject oneScanList)
 {
     allScanLists.Rows.Add(oneScanList.GUID, oneScanList.ScanListName, oneScanList);
 }