Пример #1
0
 public FileEntry(PboArchive parent, string filename, ulong type, ulong osize, ulong timestamp, ulong datasize,
                  byte[] file, ulong startOffset = 0x0)
     : this(filename, type, osize, timestamp, datasize)
 {
     ParentArchive = parent;
     OrgName       = file;
 }
Пример #2
0
        private static int Main(string[] args)
        {
            var done = PboArchive.Create(new DirectoryInfo("indata").FullName, "testpbo.pbo",
                new ProductEntry("prefix", "testpbo", "Head", new List<string>() { "SwiftPbo.dll" }));
            if (!done)
                return 1;
            var inpath = "testpbo.pbo";
            PboArchive cake;
            try
            {
                cake = new PboArchive(inpath);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return 2;
            }

            var files = new Dictionary<FileEntry, string>();
            foreach (var fileEntry in cake.Files)
            {
                var path = Path.Combine("output", fileEntry.FileName);
                fileEntry.Extract(path);
                files.Add(fileEntry, path);
            }
            var file = cake.Files[0];
            try
            {
                var stream = file.Extract();
                stream.Close();
            }
            catch (Exception)
            {

                return 3;
            }
            try
            {
                PboArchive.Create(@"nottest.pbo", cake.ProductEntry, files, cake.Checksum);
            }
            catch (Exception)
            {
                return 4;
            }

            return !FilesAreEqual(new FileInfo(inpath), new FileInfo("nottest.pbo")) ? 5 : 0;
        }
Пример #3
0
 public FileEntry(PboArchive parent,string filename, ulong type, ulong osize, ulong timestamp, ulong datasize, ulong unknown = 0x0)
 {
     _parentArchive = parent;
     FileName = filename;
     switch (type)
     {
         case 0x43707273:
             PackingMethod = PackingType.Packed;
             break;
         case 0x0:
             PackingMethod = PackingType.Uncompressed;
             break;
     }
     OriginalSize = osize;
     TimeStamp = timestamp;
     DataSize = datasize;
     Unknown = unknown;
 }
Пример #4
0
        public FileEntry(PboArchive parent, string filename, ulong type, ulong osize, ulong timestamp, ulong datasize, byte[] file, ulong unknown = 0x0)
        {
            _parentArchive = parent;
            _fileName      = filename;
            OrgName        = file;
            switch (type)
            {
            case 0x43707273:
                PackingMethod = PackingType.Packed;
                break;

            case 0x0:
                PackingMethod = PackingType.Uncompressed;
                break;

            case 0x56657273:
                PackingMethod = PackingType.Uncompressed;
                break;
            }
            OriginalSize = osize;
            TimeStamp    = timestamp;
            DataSize     = datasize;
            Unknown      = unknown;
        }