Beispiel #1
0
        public int Unzip()
        {
            int result = 0;

            try
            {
                _countBlocks              = ZipperHelper.GetNumberOfBlocks(_sourceFile);
                _countBigBlocks           = (int)_countBlocks / Constants.BigBlockCount;
                _ioProcessor              = new IoProcessor(_sourceFile, _destFile, _countBigBlocks, _totalLength);
                _ioProcessor.ReadedEvent += (sender, args) =>
                {
                    ArchiveProcessingUnZip(args.DataProcessed, args.IndexOfArray);
                };
                var blocksLength = ZipperHelper.ReadBlockLength(_sourceFile, _countBlocks, Encoding.UTF8, Constants.Separator).Select(int.Parse).ToArray();
                _zippingFinished += WriteFile;
                for (var i = 0; i <= _countBigBlocks; i++)
                {
                    DecompressZip(i, blocksLength);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                result = 1;
            }

            return(result);
        }
Beispiel #2
0
        public int Zip()
        {
            int result = 0;

            try
            {
                _countBlocks++;
                _countBigBlocks           = (int)_countBlocks / Constants.BigBlockCount;
                _ioProcessor              = new IoProcessor(_sourceFile, _destFile, _countBigBlocks, _totalLength);
                _ioProcessor.ReadedEvent += (sender, args) =>
                {
                    ArchiveProcessingZip(args.DataProcessed, args.IndexOfArray);
                };
                _zippingFinished += WriteZip;

                for (var i = 0; i <= _countBigBlocks; i++)
                {
                    CompressZip(i);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                result = 1;
            }
            return(result);
        }
Beispiel #3
0
        public HostEvent(IIoProcessor ioProcessor,
                         ServiceId senderServiceId,
                         ServiceId?targetServiceId,
                         IOutgoingEvent outgoingEvent) : base(outgoingEvent)
        {
            if (outgoingEvent is null)
            {
                throw new ArgumentNullException(nameof(outgoingEvent));
            }

            _ioProcessor    = ioProcessor ?? throw new ArgumentNullException(nameof(ioProcessor));
            SenderServiceId = senderServiceId ?? throw new ArgumentNullException(nameof(senderServiceId));
            TargetServiceId = targetServiceId;
            Type            = EventType.External;
            DelayMs         = outgoingEvent.DelayMs;
            InvokeId        = senderServiceId as InvokeId;
            OriginType      = ioProcessor.Id;
        }