Example #1
0
        public static MainPacket Create(Par2LibraryArguments args)
        {
            MainPacket tmpPacket = new MainPacket();
            tmpPacket.header = new PacketHeader();
            tmpPacket.header.setid = new byte[16];
            tmpPacket.header.magic = Par2FileReader.packet_magic;
            tmpPacket.header.type = Par2FileReader.mainpacket_type;

            tmpPacket.blocksize = (ulong)args.blocksize;
            tmpPacket.recoverablefilecount = (uint)args.inputFiles.Length;
            tmpPacket.fileids = new List<byte[]>();
            tmpPacket.header.length = (ulong)(tmpPacket.GetSize() + (16 * sizeof(byte) * args.inputFiles.Length));

            // setid calculation and fileids insertion will occur in Par2RecoverySet.OpenSourceFiles method

            System.Threading.Tasks.Task.Factory.StartNew((b) =>
            {
                //FastCRC32.FastCRC32 crc32 = new FastCRC32.FastCRC32((ulong)b);
                FastCRC32.FastCRC32 crc32 = FastCRC32.FastCRC32.GetCRC32Instance((ulong)b);
            }, tmpPacket.blocksize);

            return tmpPacket;
        }
Example #2
0
        public static MainPacket Create(Par2LibraryArguments args)
        {
            MainPacket tmpPacket = new MainPacket();

            tmpPacket.header       = new PacketHeader();
            tmpPacket.header.setid = new byte[16];
            tmpPacket.header.magic = Par2FileReader.packet_magic;
            tmpPacket.header.type  = Par2FileReader.mainpacket_type;

            tmpPacket.blocksize            = (ulong)args.blocksize;
            tmpPacket.recoverablefilecount = (uint)args.inputFiles.Length;
            tmpPacket.fileids       = new List <byte[]>();
            tmpPacket.header.length = (ulong)(tmpPacket.GetSize() + (16 * sizeof(byte) * args.inputFiles.Length));

            // setid calculation and fileids insertion will occur in Par2RecoverySet.OpenSourceFiles method

            System.Threading.Tasks.Task.Factory.StartNew((b) =>
            {
                //FastCRC32.FastCRC32 crc32 = new FastCRC32.FastCRC32((ulong)b);
                FastCRC32.FastCRC32 crc32 = FastCRC32.FastCRC32.GetCRC32Instance((ulong)b);
            }, tmpPacket.blocksize);

            return(tmpPacket);
        }