Esempio n. 1
0
        static DecryptedMethodInfo[] ReadMethodInfos(byte[] data)
        {
            var toOffset      = new Dictionary <DecryptedMethodInfo, int>();
            var reader        = MemoryImageStream.Create(data);
            int numMethods    = (int)reader.Read7BitEncodedUInt32();
            int totalCodeSize = (int)reader.Read7BitEncodedUInt32();
            var methodInfos   = new DecryptedMethodInfo[numMethods];
            int offset        = 0;

            for (int i = 0; i < numMethods; i++)
            {
                int id   = (int)reader.Read7BitEncodedUInt32();
                int size = (int)reader.Read7BitEncodedUInt32();
                var info = new DecryptedMethodInfo(id, size);
                methodInfos[i] = info;
                toOffset[info] = offset;
                offset        += size;
            }
            long dataOffset = reader.Position;

            foreach (var info in methodInfos)
            {
                reader.Position = dataOffset + toOffset[info];
                reader.Read(info.data, 0, info.data.Length);
            }
            return(methodInfos);
        }
Esempio n. 2
0
        static DecryptedMethodInfo[] ReadMethodInfos(byte[] data)
        {
            var toOffset   = new Dictionary <DecryptedMethodInfo, int>();
            var reader     = ByteArrayDataReaderFactory.CreateReader(data);
            int numMethods = (int)reader.Read7BitEncodedUInt32();

            /*int totalCodeSize = (int)*/ reader.Read7BitEncodedUInt32();
            var methodInfos = new DecryptedMethodInfo[numMethods];
            int offset      = 0;

            for (int i = 0; i < numMethods; i++)
            {
                int id   = (int)reader.Read7BitEncodedUInt32();
                int size = (int)reader.Read7BitEncodedUInt32();
                var info = new DecryptedMethodInfo(id, size);
                methodInfos[i] = info;
                toOffset[info] = offset;
                offset        += size;
            }
            uint dataOffset = reader.Position;

            foreach (var info in methodInfos)
            {
                reader.Position = dataOffset + (uint)toOffset[info];
                reader.ReadBytes(info.data, 0, info.data.Length);
            }
            return(methodInfos);
        }
		static DecryptedMethodInfo[] ReadMethodInfos(byte[] data) {
			var toOffset = new Dictionary<DecryptedMethodInfo, int>();
			var reader = MemoryImageStream.Create(data);
			int numMethods = (int)reader.Read7BitEncodedUInt32();
			int totalCodeSize = (int)reader.Read7BitEncodedUInt32();
			var methodInfos = new DecryptedMethodInfo[numMethods];
			int offset = 0;
			for (int i = 0; i < numMethods; i++) {
				int id = (int)reader.Read7BitEncodedUInt32();
				int size = (int)reader.Read7BitEncodedUInt32();
				var info = new DecryptedMethodInfo(id, size);
				methodInfos[i] = info;
				toOffset[info] = offset;
				offset += size;
			}
			long dataOffset = reader.Position;
			foreach (var info in methodInfos) {
				reader.Position = dataOffset + toOffset[info];
				reader.Read(info.data, 0, info.data.Length);
			}
			return methodInfos;
		}