예제 #1
0
 protected IVirtualDisk ValidateVirtualDisk(string path)
 {
     Invariant.ArgumentAssert(File.Exists(path), nameof(path), "The file provided doesn't actually exist");
     using (IImageManagementService managementService = ImageManagementService.GetImageManagementService(this._Host))
     {
         managementService.ValidateVirtualHardDisk(path);
         return((IVirtualDisk) new VirtualDisk(this._Host, path, this._Logger));
     }
 }
예제 #2
0
 public AccommodationManagementService(IManagerContextService managerContextService,
                                       IServiceSupplierContextService serviceSupplierContextService,
                                       IImageManagementService imageManagementService,
                                       IAmenityService amenityService,
                                       DirectContractsDbContext dbContext,
                                       GeometryFactory geometryFactory,
                                       IDateTimeProvider dateTimeProvider)
 {
     _managerContext         = managerContextService;
     _serviceSupplierContext = serviceSupplierContextService;
     _imageManagementService = imageManagementService;
     _amenityService         = amenityService;
     _geometryFactory        = geometryFactory;
     _dbContext        = dbContext;
     _dateTimeProvider = dateTimeProvider;
 }
        public ApplicationViewModel(ILogger logger,
                                    ISchedulerProvider schedulerProvider,
                                    IImageManagementService imageManagementService,
                                    Func <IImageViewModel> imageViewModelFactory,
                                    Func <IImageFolderViewModel> imageFolderViewModelFactory)
        {
            _logger                      = logger;
            _schedulerProvider           = schedulerProvider;
            _imageManagementService      = imageManagementService;
            _imageViewModelFactory       = imageViewModelFactory;
            _imageFolderViewModelFactory = imageFolderViewModelFactory;

            Images       = new ObservableCollection <IImageViewModel>();
            ImageFolders = new ObservableCollection <IImageFolderViewModel>();

            AddFolder = ReactiveCommand.CreateFromObservable <string, Unit>(ExecuteAddFolder);
        }
예제 #4
0
 public VHDInfo GetCfg()
 {
     using (IImageManagementService managementService = ImageManagementService.GetImageManagementService(this._Host))
     {
         using (IVirtualHardDiskSettingData hardDiskSettingData = managementService.GetVirtualHardDiskSettingData(this._Path))
         {
             using (IVirtualHardDiskState virtualHardDiskState = managementService.GetVirtualHardDiskState(this._Path))
                 return new VHDInfo()
                        {
                            Path            = this._Path,
                            FileSize        = (long)virtualHardDiskState.FileSize,
                            MaxInternalSize = (long)hardDiskSettingData.MaxInternalSize,
                            ParentPath      = hardDiskSettingData.ParentPath,
                            Type            = (int)hardDiskSettingData.Type
                        };
         }
     }
 }
예제 #5
0
 public OfferedItemService(IUnitOfWork unitOfWork, IImageManagementService imgService)
 {
     _unitOfWork = unitOfWork;
     _imgService = imgService;
 }
예제 #6
0
 public ImageManagementController(IImageManagementService imageManagementService)
 {
     _imageManagementService = imageManagementService;
 }
 /// <summary>
 /// Creates new instance of OrganizationRegistrationService
 /// </summary>
 /// <param name="unitOfWork">Unit of work</param>
 public OrganizationRegistrationService(IUnitOfWork unitOfWork, IImageManagementService imgManageService)
 {
     _unitOfWork       = unitOfWork;
     _imgManageService = imgManageService;
 }
예제 #8
0
 public void MountVirtualDisk(string path, bool assignDriveLetter, bool readOnly)
 {
     using (IImageManagementService managementService = ImageManagementService.GetImageManagementService(this._Host))
         managementService.AttachVirtualHardDisk(path, assignDriveLetter, readOnly);
 }
예제 #9
0
 public void MountVirtualDisk(string path)
 {
     using (IImageManagementService managementService = ImageManagementService.GetImageManagementService(this._Host))
         managementService.AttachVirtualHardDisk(path, false, false);
 }
예제 #10
0
 public void ChainVhd(string childVhd, string parentVhd)
 {
     using (IImageManagementService managementService = ImageManagementService.GetImageManagementService(this._Host))
         managementService.SetParentVirtualHardDisk(childVhd, parentVhd, (string)null, true);
 }
예제 #11
0
 public void CreateVirtualDisk(string path, ulong size, string virtualDiskType, ushort format)
 {
     if (File.Exists(path))
     {
         this._Logger.Information(string.Format("Validating existing disk {0}...", (object)path));
         try
         {
             using (IVirtualDisk virtualDisk = this.ValidateVirtualDisk(path))
             {
                 if (virtualDisk != null)
                 {
                     if (virtualDisk.GetCfg().MaxInternalSize >= (long)size)
                     {
                         this._Logger.Information("Existing disk validated.");
                         return;
                     }
                 }
             }
         }
         catch (Exception ex)
         {
             if (this.HandleException(ex))
             {
                 throw;
             }
             else
             {
                 this._Logger.Warning(ex, "Existing disk validation failed");
             }
         }
         this._Logger.Information(string.Format("Deleting existing disk {0}...", (object)path));
         File.Delete(path);
     }
     if ((long)(size % 4096UL) != 0L)
     {
         size += 4096UL - size % 4096UL;
     }
     using (IImageManagementService managementService = ImageManagementService.GetImageManagementService(this._Host))
     {
         using (IVirtualHardDiskSettingData hardDiskSettingData = VirtualHardDiskSettingData.CreateVirtualHardDiskSettingData(this._Host))
         {
             hardDiskSettingData.Path            = path;
             hardDiskSettingData.MaxInternalSize = size;
             if (!(virtualDiskType == "Fixed"))
             {
                 if (!(virtualDiskType == "Dynamic"))
                 {
                     throw new HyperVException("Don't know how to create a disk of type " + virtualDiskType);
                 }
                 hardDiskSettingData.Type = (ushort)3;
             }
             else
             {
                 hardDiskSettingData.Type = (ushort)2;
             }
             hardDiskSettingData.Format             = format;
             hardDiskSettingData.PhysicalSectorSize = 512U;
             managementService.CreateVirtualHardDisk(hardDiskSettingData);
         }
     }
 }
예제 #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EventManagementService"/> class.
 /// </summary>
 /// <param name="unitOfWorkParam">The unit of work parameter.</param>
 public EventManagementService(IUnitOfWork unitOfWorkParam, IImageManagementService imgService) : base()
 {
     this._unitOfWork = unitOfWorkParam;
     this._imgService = imgService;
 }
예제 #13
0
 /// <Summary>
 /// Creates new instance of FinOpService
 /// </Amountmary>
 /// <param name="_unitOfWork">Unit of work</param>
 public FinOpService(IUnitOfWork _unitOfWork, IImageManagementService _imgService)
 {
     this._unitOfWork = _unitOfWork;
     this._imgService = _imgService;
 }
예제 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RequestedItemService"/> class.
 /// </summary>
 /// <param name="unitOfWork">Unit of work</param>
 public RequestedItemService(IUnitOfWork unitOfWork, IImageManagementService imgService)
 {
     this._unitOfWork = unitOfWork;
     _imgService      = imgService;
 }