private static List <ebxtype> ReadEbx(Tools.Field f) { List <ebxtype> res = new List <ebxtype>(); List <Tools.Entry> list = (List <Tools.Entry>)f.data; foreach (Tools.Entry e in list) { ebxtype ebx = new ebxtype(); ebx.link = e; foreach (Tools.Field f2 in e.fields) { switch (f2.fieldname) { case "name": ebx.name = (string)f2.data; break; case "sha1": ebx.SHA1 = (byte[])f2.data; break; case "size": ebx.size = (byte[])f2.data; break; case "originalSize": ebx.osize = (byte[])f2.data; break; } } res.Add(ebx); } return(res); }
private static List <ebxtype> ReadEbx(BJSON.Field f) { List <ebxtype> res = new List <ebxtype>(); List <BJSON.Entry> list = (List <BJSON.Entry>)f.data; foreach (BJSON.Entry e in list) { ebxtype ebx = new ebxtype(); ebx.link = e; ebx.baseSha1 = ebx.deltaSha1 = ebx.Sha1 = new byte[0]; foreach (BJSON.Field f2 in e.fields) { switch (f2.fieldname) { case "name": ebx.name = (string)f2.data; break; case "sha1": ebx.Sha1 = (byte[])f2.data; break; case "size": ebx.size = (byte[])f2.data; break; case "originalSize": ebx.originalSize = (byte[])f2.data; break; case "casPatchType": ebx.casPatchType = Helpers.ReadInt(new MemoryStream((byte[])f2.data)); break; case "baseSha1": ebx.baseSha1 = (byte[])f2.data; break; case "deltaSha1": ebx.deltaSha1 = (byte[])f2.data; break; } } res.Add(ebx); } return(res); }
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); }
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<ebxtype> ReadEbx(BJSON.Field f) { List<ebxtype> res = new List<ebxtype>(); List<BJSON.Entry> list = (List<BJSON.Entry>)f.data; foreach (BJSON.Entry e in list) { ebxtype ebx = new ebxtype(); ebx.link = e; ebx.baseSha1 = ebx.deltaSha1 = ebx.Sha1 = new byte[0]; foreach (BJSON.Field f2 in e.fields) switch (f2.fieldname) { case "name": ebx.name = (string)f2.data; break; case "sha1": ebx.Sha1 = (byte[])f2.data; break; case "size": ebx.size = (byte[])f2.data; break; case "originalSize": ebx.originalSize = (byte[])f2.data; break; case "casPatchType": ebx.casPatchType = Helpers.ReadInt(new MemoryStream((byte[])f2.data)); break; case "baseSha1": ebx.baseSha1 = (byte[])f2.data; break; case "deltaSha1": ebx.deltaSha1 = (byte[])f2.data; break; } res.Add(ebx); } return res; }