예제 #1
0
        public async void testSaveToFile()
        {
            tokenSource = new CancellationTokenSource();

            //Assert.DoesNotThrow(() =>
            //{
            //coll = await engine.BuildVolumesAsync();
            devColl = await engine.BuildDevicesAsync(tokenSource.Token).ConfigureAwait(false);;
            //});

            //string fileName = System.IO.Path.GetTempFileName();
            string fileName = @"C:\Projects\Software\Tools\ReadRawDevice.Gui\ReadRawDevice.NUnit\bin\Debug\diskOutput.bin";

            var device = devColl.Where(dev =>
            {
                return((dev.DiskSize.HasValue) && (dev.FriendlyName.Equals("Alex EFI_TEST USB Device")));
            }).First();

            var progressIndicator = new Progress <double>(progress =>
            {
                System.Diagnostics.Debug.WriteLine("Progress is: " + progress.ToString() + "%");
            });

            System.Diagnostics.Trace.WriteLine("Output file is: " + fileName);

            long bytesRead = await engine.ExtractDiskAsync(device, fileName, progressIndicator, tokenSource.Token);

            //tsk2.Wait();

            System.Diagnostics.Debug.WriteLine("--- All done ---");
            //engine.ExtractDiskAsync(
        }
예제 #2
0
 protected void selectedDevice_OnDeviceSelected(long deviceId)
 {
     try
     {
         foreach (var device in DeviceCollection.Where(dev => dev.DeviceId != deviceId && dev.Selected))
         {
             device.Selected = false;
         }
     }
     catch (Exception ex)
     {
         _ppsClientViewModel.WriteLogMessage(string.Concat("Не удалось изменить выбор устройства - ",
                                                           ex.Message));
     }
 }
예제 #3
0
        public void allDevicesShouldHaveDiskSize()
        {
            tokenSource = new CancellationTokenSource();

            Assert.DoesNotThrow(() =>
            {
                var tsk = engine.BuildDevicesAsync(tokenSource.Token);
                tsk.Wait();
                devColl = tsk.Result;
            });

            devColl.AsParallel().ForAll(dev => {
                System.Diagnostics.Trace.WriteLine("Device " + dev.FriendlyName + " size is: " + (dev.DiskSize.HasValue == true ? dev.DiskSize.Value.ToString() : "<empty>"));
            });

            var zz = devColl.Where(dev => !(dev.DiskSize.HasValue && dev.DiskSize.Value >= 0));

            Assert.True(zz.Any() == false);
        }
예제 #4
0
        private void SaveLoginDevices(object parameter)
        {
            try
            {
                if (SelectedLogin == null)
                {
                    throw new Exception("Пользователь не выбран");
                }

                using (var policySetService =
                           _ppsClientViewModel.ServiceProxy.GetPpsChannelFactory <ILoginDevicesService>())
                {
                    var channel = policySetService.CreateChannel();
                    var result  = channel.UpdateLoginDevices(SelectedLogin.LoginId,
                                                             DeviceCollection.Where(x => x.Selected)
                                                             .Select(
                                                                 x =>
                                                                 new LoginDevicesDataContract
                    {
                        DeviceId         = x.DeviceId,
                        LoginId          = SelectedLogin.LoginId,
                        NeedUpdateDevice = true
                    })
                                                             .ToArray());
                    GetLoginIdAndDeviceIdDct();

                    if (!result.BoolRes)
                    {
                        throw new Exception(result.ErrorRes);
                    }

                    _ppsClientViewModel.AddEvent(EventConstants.EVENT_ASSIGN_lOGIN_DEVICE,
                                                 string.Concat("Для логина ", SelectedLogin.Login));
                }
            }
            catch (Exception ex)
            {
                _ppsClientViewModel.WriteLogMessage(string.Concat("Не удалось сохранить устройства пользователя. ",
                                                                  ex.Message));
            }
        }
예제 #5
0
        public async void testSaveToFile()
        {
            tokenSource = new CancellationTokenSource();

            //Assert.DoesNotThrow(() =>
            //{
                //coll = await engine.BuildVolumesAsync();
            devColl = await engine.BuildDevicesAsync(tokenSource.Token).ConfigureAwait(false); ;
            //});

            //string fileName = System.IO.Path.GetTempFileName();
            string fileName = @"C:\Projects\Software\Tools\ReadRawDevice.Gui\ReadRawDevice.NUnit\bin\Debug\diskOutput.bin";

            var device = devColl.Where(dev =>
            {
                return (dev.DiskSize.HasValue) && (dev.FriendlyName.Equals("Alex EFI_TEST USB Device"));
            }).First();

            var progressIndicator = new Progress<double>(progress =>
            {
                System.Diagnostics.Debug.WriteLine("Progress is: " + progress.ToString() + "%");
            });

            System.Diagnostics.Trace.WriteLine("Output file is: " + fileName);

            long bytesRead = await engine.ExtractDiskAsync(device, fileName, progressIndicator, tokenSource.Token);
            //tsk2.Wait();

            System.Diagnostics.Debug.WriteLine("--- All done ---");
            //engine.ExtractDiskAsync(
        }