Esempio n. 1
0
        public byte[] ExportBundleDataByPath(string path)
        {
            TOCBundleInfoStruct info = new TOCBundleInfoStruct();

            info.isbase = true;
            foreach (TOCBundleInfoStruct inf in bundles)
            {
                if (inf.id.ToLower() == path.ToLower())
                {
                    info = inf;
                    break;
                }
            }
            if (info.isbase)
            {
                return(new byte[0]);
            }
            string     sbpath = Helpers.GetFileNameWithOutExtension(MyPath) + ".sb";
            FileStream fs     = new FileStream(sbpath, FileMode.Open, FileAccess.Read);

            fs.Seek(0, SeekOrigin.End);
            if (info.offset + info.size > fs.Position)
            {
                return(new byte[0]);
            }
            fs.Seek(info.offset, 0);
            byte[] buff = new byte[info.size];
            fs.Read(buff, 0, info.size);
            fs.Close();
            return(buff);
        }
Esempio n. 2
0
        public byte[] ExportBinaryBundle(TOCBundleInfoStruct info)
        {
            if (info.isbase)
            {
                return(new byte[0]);
            }
            string     sbpath = Helpers.GetFileNameWithOutExtension(MyPath) + ".sb";
            FileStream fs     = new FileStream(sbpath, FileMode.Open, FileAccess.Read);

            fs.Seek(0, SeekOrigin.End);
            if (info.offset + info.size > fs.Position)
            {
                return(new byte[0]);
            }
            fs.Seek(info.offset, 0);
            byte[] buff = new byte[info.size];
            fs.Read(buff, 0, info.size);
            fs.Close();
            uint magic = BitConverter.ToUInt32(buff, 4);

            if (magic != 0xd58e799d)
            {
                return(new byte[0]);
            }
            return(buff);
        }
Esempio n. 3
0
 public byte[] ExportBinaryBundle(TOCBundleInfoStruct info)
 {
     if (info.isbase)
         return new byte[0];
     string sbpath = Helpers.GetFileNameWithOutExtension(MyPath) + ".sb";
     FileStream fs = new FileStream(sbpath, FileMode.Open, FileAccess.Read);
     fs.Seek(0, SeekOrigin.End);
     if(info.offset+info.size > fs.Position)
         return new byte[0];
     fs.Seek(info.offset, 0);
     byte[] buff = new byte[info.size];
     fs.Read(buff, 0, info.size);
     fs.Close();
     uint magic = BitConverter.ToUInt32(buff, 4);
     if (magic != 0xd58e799d)
         return new byte[0];
     return buff;
 }
Esempio n. 4
0
 public byte[] ExportBundleDataByPath(string path)
 {
     TOCBundleInfoStruct info = new TOCBundleInfoStruct();
     info.isbase = true;
     foreach (TOCBundleInfoStruct inf in bundles)
         if (inf.id.ToLower() == path.ToLower())
         {
             info = inf;
             break;
         }
     if (info.isbase)
         return new byte[0];
     string sbpath = Helpers.GetFileNameWithOutExtension(MyPath) + ".sb";
     FileStream fs = new FileStream(sbpath, FileMode.Open, FileAccess.Read);
     fs.Seek(0, SeekOrigin.End);
     if (info.offset + info.size > fs.Position)
         return new byte[0];
     fs.Seek(info.offset, 0);
     byte[] buff = new byte[info.size];
     fs.Read(buff, 0, info.size);
     fs.Close();
     return buff;
 }
Esempio n. 5
0
        private void ProcessBundles(BJSON.Field f)
        {
            List <BJSON.Entry> list = (List <BJSON.Entry>)f.data;

            foreach (BJSON.Entry e in list)
            {
                TOCBundleInfoStruct info = new TOCBundleInfoStruct();
                info.isdelta = false;
                foreach (BJSON.Field f2 in e.fields)
                {
                    switch (f2.fieldname)
                    {
                    case "id":
                        info.id = (string)f2.data;
                        break;

                    case "offset":
                        info.offset = Helpers.ReadInt(new MemoryStream((byte[])f2.data));
                        break;

                    case "size":
                        info.size = Helpers.ReadInt(new MemoryStream((byte[])f2.data));
                        break;

                    case "delta":
                        info.isdelta = (bool)f2.data;
                        break;

                    case "base":
                        info.isbase = (bool)f2.data;
                        break;
                    }
                }
                bundles.Add(info);
            }
        }
Esempio n. 6
0
 private void ProcessBundles(BJSON.Field f)
 {
     List<BJSON.Entry> list = (List<BJSON.Entry>)f.data;
     foreach (BJSON.Entry e in list)
     {
         TOCBundleInfoStruct info = new TOCBundleInfoStruct();
         info.isdelta = false;
         foreach(BJSON.Field f2 in e.fields)
             switch (f2.fieldname)
             {
                 case "id":
                     info.id = (string)f2.data;
                     break;
                 case "offset":
                     info.offset = Helpers.ReadInt(new MemoryStream((byte[])f2.data));
                     break;
                 case "size":
                     info.size = Helpers.ReadInt(new MemoryStream((byte[])f2.data));
                     break;
                 case "delta":
                     info.isdelta = (bool)f2.data;
                     break;
                 case "base":
                     info.isbase = (bool)f2.data;
                     break;
             }
         bundles.Add(info);
     }
 }