Esempio n. 1
0
        // ReSharper disable once UnusedMethodReturnValue.Local
        private STUInstance ReadInstance(long offset, BinaryReader reader)
        {
            if (_instances.ContainsKey(offset))
            {
                return(_instances[offset]);
            }

            _instances[offset] = null;

            long position = reader.BaseStream.Position;

            reader.BaseStream.Position = offset + Start;
            uint checksum = reader.ReadUInt32();

            reader.BaseStream.Position = offset + Start;

            if (_InstanceTypes.ContainsKey(checksum))
            {
                Type   type     = _InstanceTypes[checksum];
                object instance = Activator.CreateInstance(type);
                _instances[offset] = InitializeObject(instance, type, reader, false, false) as STUInstance;
            }
            else
            {
                // STUInstance instance = new STUInstance();
                // instances[offset] = InitializeObject(instance, typeof(STUInstance), reader) as STUInstance;
                Debugger.Log(0, "STU", $"[Version1]: Unhandled instance type: {checksum:X} (offset={offset})\n");
            }
            TypeHashes.Add(checksum);

            reader.BaseStream.Position = position;

            return(_instances[offset]);
        }
Esempio n. 2
0
        public static int AddType(JObject jo)
        {
            var hash = "t_" + jo.ToString().GetHashCode();

            lock (TypeHashes)
            {
                var idx = 0;
                if (TypeHashes.Contains(hash) == false)
                {
                    TypeHashes.Add(hash);
                    idx = TypeHashes.IndexOf(hash);
                    Types.Add(idx, jo);
                }
            }
            return(TypeHashes.IndexOf(hash));
        }
Esempio n. 3
0
        public static int AddType(JObject jo)
        {
            var hash = string.Format("t_{0}", jo.ToString().GetHashCode());

            lock (TypeHashes)
            {
                if (TypeHashes.Contains(hash))
                {
                    return(TypeHashes.IndexOf(hash));
                }

                TypeHashes.Add(hash);
                var idx = TypeHashes.IndexOf(hash);
                Types.Add(idx, jo);
            }

            return(TypeHashes.IndexOf(hash));
        }
Esempio n. 4
0
 public override bool IsMatch(TypeHashes type, MessageTypes msgTypeFilter, Level level)
 {
     return(true);
 }
Esempio n. 5
0
 public static bool ContainsType(JObject jo)
 {
     return(TypeHashes.Contains(string.Format("t_{0}", jo.ToString().GetHashCode())));
 }
 public override bool IsMatch(TypeHashes type, MessageTypes msgTypeFilter, Level level)
 {
     return false;
 }