Exemplo n.º 1
0
		protected override void ProcessRecord()
		{
			try
			{
				base.ProcessRecord();
				string empty = string.Empty;
				OSImage oSImage = this.UpdateVMImageProcess(out empty);
				if (oSImage != null)
				{
					OSImageContext oSImageContext = new OSImageContext();
					oSImageContext.set_OperationId(empty);
					oSImageContext.AffinityGroup = oSImage.AffinityGroup;
					oSImageContext.Category = oSImage.Category;
					oSImageContext.Label = oSImage.Label;
					oSImageContext.Location = oSImage.Location;
					oSImageContext.MediaLink = oSImage.MediaLink;
					oSImageContext.ImageName = oSImage.Name;
					oSImageContext.OS = oSImage.OS;
					OSImageContext oSImageContext1 = oSImageContext;
					base.WriteObject(oSImageContext1, true);
				}
			}
			catch (Exception exception1)
			{
				Exception exception = exception1;
				base.WriteError(new ErrorRecord(exception, string.Empty, ErrorCategory.CloseError, null));
			}
		}
Exemplo n.º 2
0
		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));
			}
		}