Exemple #1
0
 public Disc GetDiscInfo(string recordersInfo)
 {
     try
     {
         _imageMaster.Recorders.SelectedIndex = _imageMaster.Recorders.ToList().FindIndex(x =>
                                                                                          x.VolumePath.Equals(recordersInfo)); //совпадает ли путь с названием диска
         _imageMaster.LoadRecorder();
         _imageMaster.LoadMedia();                                                                                             //загрузить инфу о нужном записывателе
         return(new Disc()
         {
             Type = _imageMaster.Media,
             State = _imageMaster.MediaStates.Any(x => x == MediaState.Blank)
                 ? MediaState.Blank    //занят
                 : MediaState.Unknown, //неизвестно
             Size = _imageMaster.MediaCapacity
         });
     }
     catch (Exception)
     {
         return(new Disc()
         {
             Type = PhysicalMedia.Unknown,
             State = MediaState.Unknown,
             Size = 0
         });
     }
 }
 public Disc GetDiscInfo(DiscRecorder recorder)
 {
     try
     {
         _imageMaster.Recorders.SelectedIndex = _imageMaster.Recorders.ToList().FindIndex(x =>
                                                                                          x.VolumePath.Equals(recorder.VolumePath) && x.RecorderId.Equals(recorder.RecorderId));
         _imageMaster.LoadRecorder();
         _imageMaster.LoadMedia();
         return(new Disc()
         {
             DiscType = _imageMaster.Media,
             DiscState = _imageMaster.MediaStates.Any(x => x == MediaState.Blank)
                 ? MediaState.Blank
                 : MediaState.Unknown,
             DiscSize = _imageMaster.MediaCapacity
         });
     }
     catch (Exception)
     {
         return(new Disc()
         {
             DiscType = PhysicalMedia.Unknown,
             DiscState = MediaState.Unknown,
             DiscSize = 0
         });
     }
 }