Example #1
0
        private static List <restype> ReadRes(BJSON.Field f)
        {
            List <restype>     res  = new List <restype>();
            List <BJSON.Entry> list = (List <BJSON.Entry>)f.data;

            foreach (BJSON.Entry e in list)
            {
                restype r = new restype();
                r.link = e;
                foreach (BJSON.Field f2 in e.fields)
                {
                    switch (f2.fieldname)
                    {
                    case "name":
                        r.name = (string)f2.data;
                        break;

                    case "sha1":
                        r.SHA1 = (byte[])f2.data;
                        break;

                    case "size":
                        r.size = (byte[])f2.data;
                        break;

                    case "originalSize":
                        r.osize = (byte[])f2.data;
                        break;

                    case "resType":
                        r.rtype = (byte[])f2.data;
                        break;

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

                    case "baseSha1":
                        r.baseSha1 = (byte[])f2.data;
                        break;

                    case "deltaSha1":
                        r.deltaSha1 = (byte[])f2.data;
                        break;
                    }
                }
                res.Add(r);
            }
            return(res);
        }
Example #2
0
        public static Bundle Create(byte[] binary, bool fast = false)
        {
            Bundle res = new Bundle();

            res.iscas = false;
            res.ebx   = new List <ebxtype>();
            res.res   = new List <restype>();
            res.chunk = new List <chunktype>();
            BinaryBundle bin = new BinaryBundle(new MemoryStream(binary), fast);

            if (bin.EbxList != null)
            {
                foreach (BinaryBundle.EbxEntry ebx in bin.EbxList)
                {
                    ebxtype e = new ebxtype();
                    e.name         = ebx._name;
                    e.originalSize = BitConverter.GetBytes((long)ebx.ucsize);
                    e.Sha1         = ebx._sha1;
                    res.ebx.Add(e);
                }
            }
            if (bin.ResList != null)
            {
                foreach (BinaryBundle.ResEntry r in bin.ResList)
                {
                    restype e = new restype();
                    e.name  = r._name;
                    e.osize = BitConverter.GetBytes((long)r.ucsize);
                    e.SHA1  = r._sha1;
                    e.rtype = BitConverter.GetBytes(r.type);
                    res.res.Add(e);
                }
            }
            if (bin.ChunkList != null)
            {
                foreach (BinaryBundle.ChunkEntry c in bin.ChunkList)
                {
                    chunktype e = new chunktype();
                    e.size = BitConverter.GetBytes((long)c._originalSize);
                    e.SHA1 = c._sha1;
                    e.id   = c.id;
                    res.chunk.Add(e);
                }
            }
            return(res);
        }
        private static List <restype> ReadRes(Tools.Field f)
        {
            List <restype>     res  = new List <restype>();
            List <Tools.Entry> list = (List <Tools.Entry>)f.data;

            foreach (Tools.Entry e in list)
            {
                restype r = new restype();
                r.link = e;
                foreach (Tools.Field f2 in e.fields)
                {
                    switch (f2.fieldname)
                    {
                    case "name":
                        r.name = (string)f2.data;
                        break;

                    case "sha1":
                        r.SHA1 = (byte[])f2.data;
                        break;

                    case "size":
                        r.size = (byte[])f2.data;
                        break;

                    case "originalSize":
                        r.osize = (byte[])f2.data;
                        break;

                    case "resType":
                        r.rtype = (byte[])f2.data;
                        break;
                    }
                }
                res.Add(r);
            }
            return(res);
        }
Example #4
0
 public static Bundle Create(byte[] binary, bool fast = false)
 {
     Bundle res = new Bundle();
     res.iscas = false;
     res.ebx = new List<ebxtype>();
     res.res = new List<restype>();
     res.chunk = new List<chunktype>();
     BinaryBundle bin = new BinaryBundle(new MemoryStream(binary), fast);
     if(bin.EbxList != null)
         foreach (BinaryBundle.EbxEntry ebx in bin.EbxList)
         {
             ebxtype e = new ebxtype();
             e.name = ebx._name;
             e.originalSize = BitConverter.GetBytes((long)ebx.ucsize);
             e.Sha1 = ebx._sha1;
             res.ebx.Add(e);
         }
     if (bin.ResList != null)
         foreach (BinaryBundle.ResEntry r in bin.ResList)
         {
             restype e = new restype();
             e.name = r._name;
             e.osize = BitConverter.GetBytes((long)r.ucsize);
             e.SHA1 = r._sha1;
             e.rtype = BitConverter.GetBytes(r.type);
             res.res.Add(e);
         }
     if (bin.ChunkList!= null)
         foreach (BinaryBundle.ChunkEntry c in bin.ChunkList)
         {
             chunktype e = new chunktype();
             e.size = BitConverter.GetBytes((long)c._originalSize);
             e.SHA1 = c._sha1;
             e.id = c.id;
             res.chunk.Add(e);
         }
     return res;
 }
Example #5
0
 private static List<restype> ReadRes(BJSON.Field f)
 {
     List<restype> res = new List<restype>();
     List<BJSON.Entry> list = (List<BJSON.Entry>)f.data;
     foreach (BJSON.Entry e in list)
     {
         restype r = new restype();
         r.link = e;
         foreach (BJSON.Field f2 in e.fields)
             switch (f2.fieldname)
             {
                 case "name":
                     r.name = (string)f2.data;
                     break;
                 case "sha1":
                     r.SHA1 = (byte[])f2.data;
                     break;
                 case "size":
                     r.size = (byte[])f2.data;
                     break;
                 case "originalSize":
                     r.osize = (byte[])f2.data;
                     break;
                 case "resType":
                     r.rtype = (byte[])f2.data;
                     break;
                 case "casPatchType":
                     r.casPatchType = Helpers.ReadInt(new MemoryStream((byte[])f2.data));
                     break;
                 case "baseSha1":
                     r.baseSha1 = (byte[])f2.data;
                     break;
                 case "deltaSha1":
                     r.deltaSha1 = (byte[])f2.data;
                     break;
             }
         res.Add(r);
     }
     return res;
 }