Ejemplo n.º 1
0
        public byte[] RawDataFromZones()
        {
            byte[] rawData   = new byte[DATA_WIDTH * MAX];
            int    tmpOffset = 0;

            for (int i = 0; i < allZones.Rows.Count; i++)
            {
                ZoneObject oneZone = (ZoneObject)allZones.Rows[i].ItemArray[ZONE];
                Array.Copy(oneZone.RawData, 0, rawData, tmpOffset, DATA_WIDTH);
                tmpOffset += DATA_WIDTH;
            }
            return(rawData);
        }
Ejemplo n.º 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)
         {
             ZoneObject oneZone = new ZoneObject();
             oneZone.SetDataFromCSV(csvData[i], allChannels, withGUID);
             if (Debug.GetInstance().DebugOn)
             {
                 Console.WriteLine("In:  " + csvData[i]);
                 Console.WriteLine("Out: " + oneZone.ToString(allChannels));
             }
             AddZone(oneZone);
         }
     }
 }
Ejemplo n.º 3
0
        public void ZonesFromRawData(byte[] rawData, bool debug)
        {
            int offset = OFFSET;

            for (int i = 0; i < MAX; i++)
            {
                //Console.WriteLine("Zones: "+i);
                String hex;
                byte[] oneZoneRaw = new byte[DATA_WIDTH];
                for (int j = 0; j < DATA_WIDTH; j++)
                {
                    byte value = rawData[offset + j];
                    oneZoneRaw[j] = value;
                    if (debug)
                    {
                        hex = string.Format("{0:X2}", value);
                        Console.Write(hex + " ");
                    }
                }
                if (debug)
                {
                    Console.WriteLine();
                }
                offset += DATA_WIDTH;
                ZoneObject ch = new ZoneObject();
                ch.RawData = oneZoneRaw;
                AddZone(ch);
                if (debug)
                {
                    Console.WriteLine(ch.toString());
                    oneZoneRaw = ch.RawData;
                    for (int j = 0; j < DATA_WIDTH; j++)
                    {
                        byte value = oneZoneRaw[j];
                        hex = string.Format("{0:X2}", value);
                        Console.Write(hex + " ");
                    }
                    Console.WriteLine();
                }
            }
        }
Ejemplo n.º 4
0
        public String[] ToCSV(Channels allChannels, bool withGUID)
        {
            int size = allZones.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 < allZones.Rows.Count; i++)
            {
                ZoneObject oneZone = (ZoneObject)allZones.Rows[i].ItemArray[ZONE];
                if (withGUID && !Tools.IsEmpty(oneZone.ZoneName))
                {
                    allLines[i + 1] = oneZone.ToString(allChannels, true);
                }
                else
                {
                    if (!Tools.IsEmpty(oneZone.ZoneName))
                    {
                        allLines[i + 1] = oneZone.ToString(allChannels);
                    }
                }
            }
            return(allLines);
        }
Ejemplo n.º 5
0
 public void AddZone(ZoneObject oneZone)
 {
     allZones.Rows.Add(oneZone.GUID, oneZone.ZoneName, oneZone);
 }