Esempio n. 1
0
        public static MxeEntryType GetEntryType(MxeIndexEntry mie)
        {
            int          length = BitConverter.ToInt32(mie.TypeCode.GetBytes(), 0);
            string       name   = mie.GetVmTitle();
            MxeEntryType ret    = _other;

            if (_knownTypes.ContainsKey(name))
            {
                ret = CheckTypeLength(mie, name, ret);
            }
            else if (name.StartsWith(VIM_PART))
            {
                string oldName = StripAdditionalName(name);
                if (_knownTypes.ContainsKey(oldName))
                {
                    MxeEntryType newType = new MxeEntryType(name, mie.GetExpectedByteWords());
                    newType.Headers = _knownTypes[oldName].Headers.ToArray().ToList(); //cheater clone?
                    while (newType.Headers.Count < newType.Length)
                    {
                        newType.Headers.Add(String.Empty);
                    }

                    ConfigDiscovery.AddNewMxeType(newType);
                    _knownTypes.Add(newType.Type1, newType);
                    ret = newType;
                }
            }

            return(ret);
        }
Esempio n. 2
0
        private static MxeEntryType CheckTypeLength(MxeIndexEntry mie, string name, MxeEntryType ret)
        {
            MxeEntryType met         = _knownTypes[name];
            int          indexLength = mie.GetExpectedByteWords();

            if (met.Length == indexLength)
            {
                ret = met;
            }
            else
            {
                Console.Out.WriteLine(String.Format(ERROR_FORMAT, name, met.Length, indexLength));
            }
            return(ret);
        }
Esempio n. 3
0
        public MxeBlockEntry(MxeIndexEntry mie, int position)
        {
            _type     = MxeEntryType.GetEntryType(mie);
            _position = position;
            _entries  = new List <MxeWord>();

            for (int i = 0; i < _type.Length && _type.Headers != null && _type.Headers.Count > i; i++)
            {
                _entries.Add(new MxeWord(position + i * 4, _type.Headers[i]));
            }

            if (_type.Equals(MxeEntryType.Other) && _entries.Count < 1)
            {
                for (int i = 0; i < mie.GetExpectedByteWords(); i++)
                {
                    _entries.Add(new MxeWord(position + i * 4, String.Empty));
                }
            }
        }
Esempio n. 4
0
        public MxeBlockEntry( MxeIndexEntry mie, int position )
        {
            _type = MxeEntryType.GetEntryType(mie);
            _position = position;
            _entries = new List<MxeWord>();

            for (int i = 0; i < _type.Length && _type.Headers != null && _type.Headers.Count > i; i++)
            {
                _entries.Add(new MxeWord(position + i * 4, _type.Headers[i]));
            }

            if(_type.Equals(MxeEntryType.Other) && _entries.Count < 1)
            {
                for (int i = 0; i < mie.GetExpectedByteWords(); i++)
                {
                    _entries.Add(new MxeWord(position + i * 4, String.Empty));
                }
            }
        }
Esempio n. 5
0
 private static MxeEntryType CheckTypeLength(MxeIndexEntry mie, string name, MxeEntryType ret)
 {
     MxeEntryType met = _knownTypes[name];
     int indexLength = mie.GetExpectedByteWords();
     if (met.Length == indexLength)
     {
         ret = met;
     }
     else
     {
         Console.Out.WriteLine(String.Format(ERROR_FORMAT, name, met.Length, indexLength));
     }
     return ret;
 }
Esempio n. 6
0
        public static MxeEntryType GetEntryType( MxeIndexEntry mie )
        {
            int length = BitConverter.ToInt32(mie.TypeCode.GetBytes(),0);
            string name = mie.GetVmTitle();
            MxeEntryType ret = _other;

            if (_knownTypes.ContainsKey(name))
            {
                ret = CheckTypeLength(mie, name, ret);
            }
            else if(name.StartsWith(VIM_PART))
            {
                string oldName = StripAdditionalName(name);
                if (_knownTypes.ContainsKey(oldName))
                {
                    MxeEntryType newType = new MxeEntryType(name, mie.GetExpectedByteWords());
                    newType.Headers = _knownTypes[oldName].Headers.ToArray().ToList(); //cheater clone?
                    while (newType.Headers.Count < newType.Length)
                    {
                        newType.Headers.Add(String.Empty);
                    }

                    ConfigDiscovery.AddNewMxeType(newType);
                    _knownTypes.Add(newType.Type1, newType);
                    ret = newType;
                }
            }

            return ret;
        }
Esempio n. 7
0
        protected override void ReadTableMeta(FileStream stream)
        {
            _tableCount = new ByteWord(_tableCountAddr);
            _tableStart = new ByteWord(_tableStartAddr);

            _tableCount.ReadFromFile(stream);
            _tableStart.ReadFromFile(stream);

            int current = BitConverter.ToInt32( _tableStart.GetBytes(), 0 );
            int count = BitConverter.ToInt32( _tableCount.GetBytes(), 0 );

            Console.Out.WriteLine("Entry count: " + count);

            for (int i = 0; i < count; i++)
            {
                MxeIndexEntry e = new MxeIndexEntry(GetRealAddress(current));
                e.ReadEntry(stream);
                _indexes.Add(e.GetIndex(), e);

                current += _tableStart.Length * 4;
            }

            Dictionary<string, MxeEntryType> dts = DiscoverTypes(stream);

            RefreshOtherTypesToDiscoveredType(dts);
        }