public override void Extract(Filtering.FilteredResult fr, ref KnxPort meta)
 {
     switch (Path)
     {
         case AttributePath.Installation:
             meta.MetaData[AttributeName] = fr.ComObjects.Select(row => row.ParentDevice.Building.Parent.Parent.Name).Where(row => !string.IsNullOrWhiteSpace(row)).FirstOrDefault();
             break;
         case AttributePath.Building:
             meta.MetaData[AttributeName] = fr.ComObjects.Select(row => row.ParentDevice.Building.Parent.Name).Where(row => !string.IsNullOrWhiteSpace(row)).FirstOrDefault();
             break;
         case AttributePath.Room:
             meta.MetaData[AttributeName] = fr.ComObjects.Select(row => row.ParentDevice.Building.Name).Where(row => !string.IsNullOrWhiteSpace(row)).FirstOrDefault();
             break;
         case AttributePath.GroupAddressName:
             meta.MetaData[AttributeName] = fr.GroupAddress.Ref.Name;
             break;
         case AttributePath.ObjectName:
             meta.MetaData[AttributeName] = fr.ComObjects.Select(row => (row["Name"].Value ?? row["Text"].Value).ToString()).FirstOrDefault();
             break;
         case AttributePath.DeviceName:
             meta.MetaData[AttributeName] = fr.ComObjects.Select(row => row.ParentDevice.Name).Where(row => !string.IsNullOrWhiteSpace(row)).FirstOrDefault();
             break;
         case AttributePath.ProductName:
             meta.MetaData[AttributeName] = fr.ComObjects.Select(row => row.ParentDevice.Product.Text).Where(row => !string.IsNullOrWhiteSpace(row)).FirstOrDefault();
             break;
         default:
             break;
     }
 }
 public override void Extract(Filtering.FilteredResult fr, ref KnxPort meta)
 {
     base.Extract(fr, ref meta);
     var result = meta.MetaData[AttributeName];
     if (!string.IsNullOrWhiteSpace(result))
     {
         var splits = result.Split(' ');
         if (splits.Length < SkipWords + TakeWords)
             return;
         meta.MetaData[AttributeName] = string.Join(" ", splits.Skip(SkipWords).Take(TakeWords));
     }
 }
Ejemplo n.º 3
0
 public static void Extract(FilteredResult fr, ref KnxPort port)
 {
     port.MetaData["Room"] = "";
     try
     {
         var button = fr.ComObjects.FirstOrDefault(row => row.ParentDevice.Product.Text.Contains("Push-button"));
         port.MetaData["Room"] = button.ParentDevice.Building.Name;
     }
     catch (Exception)
     {
         port.MetaData["Room"] = fr.ComObjects.Where(row => row.ParentDevice != null && row.ParentDevice.Building != null).Select(row => row.ParentDevice.Building.Name).FirstOrDefault() ?? "";
     }
 }
 public override void Extract(Filtering.FilteredResult fr, ref KnxPort meta)
 {
     base.Extract(fr, ref meta);
     var result = meta.MetaData[AttributeName];
     if (!string.IsNullOrWhiteSpace(result))
     {
         var idx = result.IndexOf(Mark, StringComparison.InvariantCultureIgnoreCase);
         if (idx >= 0)
         {
             if (UntilMark)
                 meta.MetaData[AttributeName] = result.Substring(0, idx);
             else if (result.Length > idx + Mark.Length)
                 meta.MetaData[AttributeName] = result.Substring(idx + Mark.Length);
         }
     }
 }
Ejemplo n.º 5
0
 public KnxPort Extract(FilteredResult fr)
 {
     var port = new KnxPort()
     {
         GroupAddress = fr.GroupAddress.Ref.Value,
         MetaData = ConstructMetaData(fr),
         Type = fr.ComObjects.Any(row => row.Bits == 1) ? KnxType.Bool : KnxType.Int,
         MaxValue = fr.ComObjects.Select(row => 1 << row.Bits - 1 ).Min(),
         MinValue = 0
     };
     foreach (var extractor in Extractors.Where(row => !(row is ManualOverrideExtractor)))
         extractor.Extract(fr, ref port);
     DemoMeta.Extract(fr, ref port);
     foreach (var extractor in Extractors.Where(row => (row is ManualOverrideExtractor)))
         extractor.Extract(fr, ref port);
     return port;
 }
 public override void Extract(Filtering.FilteredResult fr, ref KnxPort meta)
 {
     if (fr.GroupAddress.Ref.ToString() == GroupAddress)
         meta.MetaData[AttributeName] = Value;
 }
Ejemplo n.º 7
0
 public abstract void Extract(FilteredResult fr, ref KnxPort meta);