Exemplo n.º 1
0
        private void LoadInstances(string filename)
        {
            JObject stuTypesJson = JObject.Parse(File.ReadAllText(filename));

            foreach (KeyValuePair <string, JToken> pair in stuTypesJson)
            {
                uint            checksum = uint.Parse(pair.Key.Split('_')[1], NumberStyles.HexNumber);
                STUInstanceJSON instance = new STUInstanceJSON {
                    Fields = null,
                    Hash   = checksum,
                    Parent = (string)pair.Value["parent"] == null ? 0 : uint.Parse(((string)pair.Value["parent"]).Split('_')[1], NumberStyles.HexNumber)
                };
                Instances[checksum] = instance;

                JToken fields = pair.Value["fields"];
                if (fields == null)
                {
                    continue;
                }
                instance.Fields = new STUFieldJSON[fields.Count()];

                uint i = 0;
                foreach (JToken field in fields)
                {
                    instance.Fields[i] = new STUFieldJSON {
                        Hash = uint.Parse((string)field["name"], NumberStyles.HexNumber),
                        SerializationType = (int)field["serializationType"],
                        Size = field.Value <int>("size"),
                        Type = field.Value <string>("type")
                    };
                    i++;
                }
            }
        }
Exemplo n.º 2
0
        public InstanceBuilder(BuilderConfig config, StructuredDataInfo info, STUInstanceJSON instance) : base(config, info)
        {
            _instance = instance;

            Name = Info.GetInstanceName(_instance.Hash);
            if (instance.Parent != 0)
            {
                _parentName = Info.GetInstanceName(_instance.Parent);
            }
        }
Exemplo n.º 3
0
        public InstanceBuilder(BuilderConfig config, StructuredDataInfo info, STUInstanceJSON instance) : base(config, info)
        {
            _instance = instance;

            Name = Info.GetInstanceName(_instance.Hash);
            if (instance.Parent != 0)
            {
                _parentName = Info.GetInstanceName(_instance.Parent);

                if (!info.Instances.ContainsKey(_instance.Parent))
                {
                    Console.Out.WriteLine($"pls fix: {_instance.Hash:X32}'s parent is missing (add to ignored)");
                }
            }
        }