public static CoverageDataDescriptor ReadExternal(EmmaBinaryReader ebr)
        {
            int size = ebr.ReadInt32();
            Dictionary<string, DataHolder> coverageMap = new Dictionary<string, DataHolder>();

            for (int i = 0; i < size; ++i)
            {
                string classVMName = ebr.ReadUTF();
                long stamp = ebr.ReadLong();

                int length = ebr.ReadInt32();
                bool[][] coverage = new bool[length][];
                for (int c = 0; c < length; ++c)
                {
                    coverage[c] = DataFactory.readBooleanArray(ebr);
                }

                coverageMap.Add(classVMName, new DataHolder(coverage, stamp));
            }

            return new CoverageDataDescriptor(coverageMap);
        }
        public static ClassDescriptor ReadExternal(EmmaBinaryReader ebr)
        {
            string packageVMName = ebr.ReadUTF();
            string name = ebr.ReadUTF();

            long stamp = ebr.ReadLong();

            sbyte srcFileNameFlag = ebr.ReadSbyte();
            string srcFileName = srcFileNameFlag != 0 ? ebr.ReadUTF() : null;

            int length = ebr.ReadInt32();
            MethodDescriptor[] methods = new MethodDescriptor[length];
            for (int i = 0; i < length; ++i)
            {
                methods[i] = MethodDescriptor.ReadExternal(ebr);
            }
            return new ClassDescriptor(packageVMName,name,stamp,srcFileName,methods);
        }
예제 #3
0
        private static object LoadEmmaFile(EmmaBinaryReader ebr)
        {
            long length = ebr.Length;
            int m = ebr.ReadInt32();
            bool t = m == Magic;
            long a = ebr.ReadLong();
            bool t2 = a == DATA_FORMAT_VERSION;
            int major = 0, minor = 0, build = 0;
            bool gotAppVersion = false;

            major = ebr.ReadInt32();
            minor = ebr.ReadInt32();
            build = ebr.ReadInt32();

            gotAppVersion = true;
            ebr.Seek(FILE_HEADER_LENGTH, SeekOrigin.Begin);
            long position = FILE_HEADER_LENGTH;
            long entryLength;
            long entrystart = 0;

            object data = null;

            while (true)
            {
                if (position >= length)
                    break;
                entryLength = ebr.ReadLong();
                if ((entryLength <= 0) || (position + entryLength + ENTRY_HEADER_LENGTH > length))
                    break;
                else
                {
                    sbyte type = ebr.ReadSbyte();
                    if ((type < 0) || (type >= 2))
                        break;

                    switch (type)
                    {
                        case TYPE_METADATA: data = MetaDataDescriptor.ReadExternal(ebr);
                            break;

                        case TYPE_COVERAGEDATA: data = CoverageDataDescriptor.ReadExternal(ebr);
                            break;

                    } // end of switch

                    //MetaDataDescriptor data=MetaDataDescriptor.ReadExternal(ebr);
                    position += entryLength + ENTRY_HEADER_LENGTH;
                    ebr.Seek(position, SeekOrigin.Begin);
                }
            }
            return data;
        }