public static void UpdateCache(ResourceRecord rec)
        {
            var dev = new DeviceRecordsDevice();

            dev.name      = rec.Device.ToString();
            dev.timestamp = DateTime.Now;
            var rlist = new List <DeviceRecordsDeviceResource>();

            rlist.Add(new DeviceRecordsDeviceResource()
            {
                name   = PropEnum.ToString(EDeviceResource.SliceRegisters, EPropAssoc.PARReport),
                amount = rec.SliceRegisters
            });
            rlist.Add(new DeviceRecordsDeviceResource()
            {
                name   = PropEnum.ToString(EDeviceResource.SliceLUTs, EPropAssoc.PARReport),
                amount = rec.SliceLUTs
            });
            rlist.Add(new DeviceRecordsDeviceResource()
            {
                name   = PropEnum.ToString(EDeviceResource.OccupiedSlices, EPropAssoc.PARReport),
                amount = rec.OccupiedSlices
            });
            rlist.Add(new DeviceRecordsDeviceResource()
            {
                name   = PropEnum.ToString(EDeviceResource.RAMB18s, EPropAssoc.PARReport),
                amount = rec.RAMB18s
            });
            rlist.Add(new DeviceRecordsDeviceResource()
            {
                name   = PropEnum.ToString(EDeviceResource.RAMB36s, EPropAssoc.PARReport),
                amount = rec.RAMB36s
            });
            rlist.Add(new DeviceRecordsDeviceResource()
            {
                name   = PropEnum.ToString(EDeviceResource.DSP48E1s, EPropAssoc.PARReport),
                amount = rec.DSP48E1s
            });
            dev.providedResources = rlist.ToArray();
            var drecs = DeviceRecords;
            int idx   = Array.FindIndex(drecs.device, d => d.name == dev.name);

            if (idx < 0)
            {
                drecs.device = drecs.device.Concat(new DeviceRecordsDevice[] { dev }).ToArray();
            }
            else
            {
                drecs.device[idx] = dev;
            }
            using (var wr = new StreamWriter(DeviceCachePath))
            {
                DeviceDataSerializer.Serialize(wr, drecs);
                wr.Close();
            }
        }
 public static void UpdateCache(ResourceRecord rec)
 {
     var dev = new DeviceRecordsDevice();
     dev.name = rec.Device.ToString();
     dev.timestamp = DateTime.Now;
     var rlist = new List<DeviceRecordsDeviceResource>();
     rlist.Add(new DeviceRecordsDeviceResource()
     {
         name = PropEnum.ToString(EDeviceResource.SliceRegisters, EPropAssoc.PARReport),
         amount = rec.SliceRegisters
     });
     rlist.Add(new DeviceRecordsDeviceResource()
     {
         name = PropEnum.ToString(EDeviceResource.SliceLUTs, EPropAssoc.PARReport),
         amount = rec.SliceLUTs
     });
     rlist.Add(new DeviceRecordsDeviceResource()
     {
         name = PropEnum.ToString(EDeviceResource.OccupiedSlices, EPropAssoc.PARReport),
         amount = rec.OccupiedSlices
     });
     rlist.Add(new DeviceRecordsDeviceResource()
     {
         name = PropEnum.ToString(EDeviceResource.RAMB18s, EPropAssoc.PARReport),
         amount = rec.RAMB18s
     });
     rlist.Add(new DeviceRecordsDeviceResource()
     {
         name = PropEnum.ToString(EDeviceResource.RAMB36s, EPropAssoc.PARReport),
         amount = rec.RAMB36s
     });
     rlist.Add(new DeviceRecordsDeviceResource()
     {
         name = PropEnum.ToString(EDeviceResource.DSP48E1s, EPropAssoc.PARReport),
         amount = rec.DSP48E1s
     });
     dev.providedResources = rlist.ToArray();
     var drecs = DeviceRecords;
     int idx = Array.FindIndex(drecs.device, d => d.name == dev.name);
     if (idx < 0)
         drecs.device = drecs.device.Concat(new DeviceRecordsDevice[] { dev }).ToArray();
     else
         drecs.device[idx] = dev;
     using (var wr = new StreamWriter(DeviceCachePath))
     {
         DeviceDataSerializer.Serialize(wr, drecs);
         wr.Close();
     }
 }