コード例 #1
0
        public StreamPartsProviderSupplier(FillNotifiableWriteOnlyStreamDecorator flashDumpWriteStream, DumpParserPartsProvider partsProvider)
        {
            _flashDumpWriteStream = flashDumpWriteStream;
            _partsProvider        = partsProvider;

            flashDumpWriteStream.LengthChangedAsync += FlashDumpWriteStream_SizeChangedAsync;
        }
コード例 #2
0
        public async static Task <FlashStreamReader> CreateAsync(RUSDeviceId device,
                                                                 IDictionary <RUSDeviceId, IEnumerable <IDataEntity> > formats,
                                                                 IFlashDumpDataParserFactory parserFactory,
                                                                 AsyncOperationInfo operationInfo)
        {
            var flashDumpPath         = Storaging.GetTempFilePath();
            var baseStream            = new FileStream(flashDumpPath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.Read);
            var flashDumpWriteStream  = new FillNotifiableWriteOnlyStreamDecorator(CHUNK_SIZE, baseStream);
            var partsProvider         = new DumpParserPartsProvider(flashDumpPath);
            var partsProviderSupplier = new StreamPartsProviderSupplier(flashDumpWriteStream, partsProvider);
            var scope    = new DeviceOperationScope(new FlashDumpStreamParameter(flashDumpWriteStream));
            var sections = formats.Select(f =>
                                          new SectionedDataPacketParser.Section(
                                              f.Key,
                                              new DataPacketParser(EntitiesDeserializer.ExtractDataPacketDescriptors(f.Value))))
                           .ToArray();
            var dataParser   = new SectionedDataPacketParser(sections);
            var parserFuture = parserFactory.CreateFromRawPartsAsync(partsProvider.RawDumpParts(), dataParser, operationInfo);

            return(new FlashStreamReader(scope, device, formats, parserFuture, partsProviderSupplier, flashDumpWriteStream, flashDumpPath));
        }