public ServiceClientPartitionSchema(int hdToGet, string newHdSize, ImageProfileWithImage imageProfile,
                                     string partitionPrefix)
 {
     _hdToGet      = hdToGet;
     _newHdSize    = (long)(Convert.ToInt64(newHdSize) * .99);
     _imageProfile = imageProfile;
     PrimaryAndExtendedPartitions = new List <ClientPartition>();
     LogicalPartitions            = new List <ClientPartition>();
     LogicalVolumes     = new List <ClientLogicalVolume>();
     VolumeGroupHelpers = new List <ClientVolumeGroupHelper>();
     _imageSchema       = new ServiceClientPartition(_imageProfile).GetImageSchema();
 }
        public ServiceClientPartition(ImageProfileWithImage imageProfile)
        {
            string schema = null;

            if (imageProfile != null)
            {
                _imageProfile = imageProfile;
                if ((imageProfile.PartitionMethod == "Dynamic" || imageProfile.PartitionMethod == "Standard" ||
                     imageProfile.PartitionMethod == "Standard Core Storage") &&
                    !string.IsNullOrEmpty(imageProfile.CustomSchema))
                {
                    schema = imageProfile.CustomSchema;
                }
                else
                {
                    schema = new FilesystemServices().ReadSchemaFile(imageProfile.Image.Name);
                }
            }

            if (!string.IsNullOrEmpty(schema))
            {
                _imageSchema = JsonConvert.DeserializeObject <DtoImageSchema>(schema);
            }
        }