Ejemplo n.º 1
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.º 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);
         }
     }
 }