public void AddVMImageProcess()
        {
            AddAzureVMImageCommand.AddAzureVMImageCommand variable = null;
            string imageName;

            using (OperationContextScope operationContextScope = new OperationContextScope((IContextChannel)base.Channel))
            {
                try
                {
                    AddAzureVMImageCommand.AddAzureVMImageCommand variable1 = variable;
                    OSImage oSImage = new OSImage();
                    oSImage.Name      = this.ImageName;
                    oSImage.MediaLink = new Uri(this.MediaLocation);
                    OSImage oSImage1 = oSImage;
                    if (string.IsNullOrEmpty(this.Label))
                    {
                        imageName = this.ImageName;
                    }
                    else
                    {
                        imageName = this.Label;
                    }
                    oSImage1.Label  = imageName;
                    oSImage.OS      = this.OS;
                    variable1.image = oSImage;
                    CmdletExtensions.WriteVerboseOutputForObject(this, LambdaVar23);
                    OSImage        oSImage2       = base.RetryCall <OSImage>((string s) => base.Channel.CreateOSImage(s, LambdaVar23));
                    OSImageContext oSImageContext = new OSImageContext();
                    oSImageContext.AffinityGroup = oSImage2.AffinityGroup;
                    oSImageContext.Category      = oSImage2.Category;
                    oSImageContext.Label         = oSImage2.Label;
                    oSImageContext.Location      = oSImage2.Location;
                    oSImageContext.MediaLink     = oSImage2.MediaLink;
                    oSImageContext.ImageName     = oSImage2.Name;
                    oSImageContext.OS            = oSImage2.OS;
                    OSImageContext oSImageContext1 = oSImageContext;
                    Operation      operation       = base.WaitForOperation(base.CommandRuntime.ToString());
                    oSImageContext1.set_OperationDescription(base.CommandRuntime.ToString());
                    oSImageContext1.set_OperationId(operation.OperationTrackingId);
                    oSImageContext1.set_OperationStatus(operation.Status);
                    base.WriteObject(oSImageContext1, true);
                }
                catch (CommunicationException communicationException1)
                {
                    CommunicationException communicationException = communicationException1;
                    this.WriteErrorDetails(communicationException);
                }
            }
        }
 protected override void ProcessRecord()
 {
     try
     {
         Func <OSImage, OSImageContext> func = null;
         base.ProcessRecord();
         Operation             operation      = null;
         IEnumerable <OSImage> vMImageProcess = this.GetVMImageProcess(out operation);
         if (vMImageProcess != null)
         {
             IEnumerable <OSImage> oSImages = vMImageProcess;
             if (func == null)
             {
                 func = (OSImage d) => {
                     OSImageContext oSImageContext = new OSImageContext();
                     oSImageContext.set_OperationId(operation.OperationTrackingId);
                     oSImageContext.set_OperationDescription(this.CommandRuntime.ToString());
                     oSImageContext.set_OperationStatus(operation.Status);
                     oSImageContext.AffinityGroup   = d.AffinityGroup;
                     oSImageContext.Category        = d.Category;
                     oSImageContext.Label           = d.Label;
                     oSImageContext.Location        = d.Location;
                     oSImageContext.MediaLink       = d.MediaLink;
                     oSImageContext.ImageName       = d.Name;
                     oSImageContext.OS              = d.OS;
                     oSImageContext.LogicalSizeInGB = d.LogicalSizeInGB;
                     return(oSImageContext);
                 }
                 ;
             }
             IEnumerable <OSImageContext> oSImageContexts = oSImages.Select <OSImage, OSImageContext>(func);
             base.WriteObject(oSImageContexts, true);
         }
     }
     catch (Exception exception1)
     {
         Exception exception = exception1;
         base.WriteError(new ErrorRecord(exception, string.Empty, ErrorCategory.CloseError, null));
     }
 }