public static DeserializationTemplate GetDeserializationTemplate(string type_name)
        {
            DeserializationTemplate value = null;

            deserializationTemplatesByTypeName.TryGetValue(type_name, out value);
            return(value);
        }
        public static void DeserializeDirectory(IReader reader)
        {
            deserializationTemplatesByTypeName.Clear();
            deserializationTemplatesByType.Clear();
            deserializationMappings.Clear();
            int num = reader.ReadInt32();

            for (int i = 0; i < num; i++)
            {
                string text = reader.ReadKleiString();
                try
                {
                    DeserializationTemplate value = new DeserializationTemplate(text, reader);
                    deserializationTemplatesByTypeName[text] = value;
                    Type type = GetType(text);
                    if (type != null)
                    {
                        deserializationTemplatesByType[type] = value;
                    }
                }
                catch (Exception ex)
                {
                    string text2 = "Error deserializing template " + text + "\n" + ex.Message + "\n" + ex.StackTrace;
                    Debug.LogError(text2);
                    throw new Exception(text2, ex);
                }
            }
        }
        public static DeserializationTemplate GetDeserializationTemplate(Type type)
        {
            DeserializationTemplate value = null;

            deserializationTemplatesByType.TryGetValue(type, out value);
            return(value);
        }
        private static DeserializationMapping GetMapping(DeserializationTemplate dtemplate, SerializationTemplate stemplate)
        {
            DeserializationMapping deserializationMapping = null;

            if (deserializationMappings.TryGetValue(dtemplate, out KeyValuePair <SerializationTemplate, DeserializationMapping> value))
            {
                deserializationMapping = value.Value;
            }
            else
            {
                deserializationMapping = new DeserializationMapping(dtemplate, stemplate);
                value = new KeyValuePair <SerializationTemplate, DeserializationMapping>(stemplate, deserializationMapping);
                deserializationMappings[dtemplate] = value;
            }
            return(deserializationMapping);
        }
        public static DeserializationMapping GetDeserializationMapping(string type_name)
        {
            DeserializationTemplate deserializationTemplate = GetDeserializationTemplate(type_name);

            if (deserializationTemplate == null)
            {
                throw new ArgumentException("Tried to deserialize a class named: " + type_name + " but no such class exists");
            }
            SerializationTemplate serializationTemplate = GetSerializationTemplate(type_name);

            if (serializationTemplate == null)
            {
                throw new ArgumentException("Tried to deserialize into a class named: " + type_name + " but no such class exists");
            }
            return(GetMapping(deserializationTemplate, serializationTemplate));
        }