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