Example #1
0
        private static IEnumerable <CompletionPort> ValidateAsync(AsyncMachine <IList <VhdValidationResult> > machine, VhdValidationType validation, Stream vhdStream)
        {
            var result = new List <VhdValidationResult>();

            var fileFactory = new VhdFileFactory();

            fileFactory.BeginCreate(vhdStream, machine.CompletionCallback, null);
            yield return(CompletionPort.SingleOperation);

            VhdFile   vhdFile   = null;
            Exception exception = null;

            try
            {
                vhdFile = fileFactory.EndCreate(machine.CompletionResult);
            }
            catch (VhdParsingException e)
            {
                exception = e;
            }

            machine.ParameterValue = DoValidate(validation, vhdFile, exception);
        }
Example #2
0
        private static IEnumerable<CompletionPort> ValidateAsync(AsyncMachine<IList<VhdValidationResult>> machine, VhdValidationType validation, Stream vhdStream)
        {
            var result = new List<VhdValidationResult>();

            var fileFactory = new VhdFileFactory();

            fileFactory.BeginCreate(vhdStream, machine.CompletionCallback, null);
            yield return CompletionPort.SingleOperation;

            VhdFile vhdFile = null;
            Exception exception = null;
            try
            {
                vhdFile = fileFactory.EndCreate(machine.CompletionResult);
            }
            catch (VhdParsingException e)
            {
                exception = e;
            }

            machine.ParameterValue = DoValidate(validation, vhdFile, exception);
        }