Ejemplo n.º 1
0
        public InitData(string pathFile, TypeCnfFile typeFile, ItemsData items, out ErrCode errInit)
        {
            this._resultData = items;
            this.ClearItems();
            ErrCode errCode;

            switch (typeFile)
            {
            case TypeCnfFile.xlsxTable1:
            case TypeCnfFile.xlsxTable2:
                errCode = this.SelectInitTable(pathFile, typeFile);
                break;

            case TypeCnfFile.txtFile:
                errCode = this.InitFromTxt(pathFile);
                break;

            case TypeCnfFile.xmlFile:
                errCode = this.InitFromXML(pathFile);
                break;

            default:
                errCode = ErrCode.initFileNotFound;
                break;
            }
            if (errCode != ErrCode.ok)
            {
                this.ClearItems();
            }
            errInit = errCode;
        }
Ejemplo n.º 2
0
        public InitData(System.Data.DataTable dataTable, TypeCnfFile typeFile, ItemsData items, out ErrCode errInit)
        {
            this._resultData = items;
            this.ClearItems();
            ErrCode errCode = this.InitFromDataTable(dataTable);

            if (errCode != ErrCode.ok)
            {
                this.ClearItems();
            }
            errInit = errCode;
        }
Ejemplo n.º 3
0
 internal ReadDataEventArgs(ItemValueResult[] values, ItemsData items)
 {
     this.Vars = new System.Collections.Generic.List <VarData>(values.Count <ItemValueResult>());
     for (int i = 0; i < values.Length; i++)
     {
         ItemValueResult itemValueResult = values[i];
         if (itemValueResult.Value != null && itemValueResult.ItemName != null && items.NameRead.ContainsKey(itemValueResult.ItemName))
         {
             VarData varData = new VarData();
             varData.Address = itemValueResult.ItemName;
             varData.Name    = items.NameRead[itemValueResult.ItemName];
             varData.Value   = itemValueResult.Value;
             varData.TypeRW  = TypeRW.Read;
             this.Vars.Add(varData);
         }
     }
 }
Ejemplo n.º 4
0
 internal ReadDataXmlEventArgs(ItemValueResult[] values, ItemsData items)
 {
     this.XDoc = new XDocument(new object[]
     {
         new XElement("Items")
     });
     for (int i = 0; i < values.Length; i++)
     {
         ItemValueResult itemValueResult = values[i];
         if (itemValueResult.Value != null && itemValueResult.ItemName != null && items.NameRead.ContainsKey(itemValueResult.ItemName))
         {
             this.XDoc.Element("Items").Add(new XElement("Item", new object[]
             {
                 new XElement("Name", items.NameRead[itemValueResult.ItemName]),
                 new XElement("Addr", itemValueResult.ItemName),
                 new XElement("Value", itemValueResult.Value),
                 new XElement("TypeRW", "read")
             }));
         }
     }
 }
Ejemplo n.º 5
0
 internal Items(ItemsData items, OPCclient client)
 {
     this._client = client;
     this._items  = items;
 }