Exemple #1
0
        public static object ToType(this DataItem this_, YamlConfig conf)
        {
            Type type = this_.GetNodeType();

            if (type != null)
            {
                return(conf.GetMappingObject(this_));
            }
            if (!(this_ is Sequence))
            {
                string textOrDefault = this_.GetTextOrDefault("");
                type = StringTypeResolver.Resolve(textOrDefault);
                return(TConverter.ChangeType(type, textOrDefault));
            }
            if (!typeof(Array).Equals(type) && !typeof(Array).IsSubclassOf(type) &&
                !typeof(Object[]).Equals(type) && !typeof(Object[]).IsSubclassOf(type))
            {
                Log.Warn(string.Format("[{0}] Cant parse Sequence to {1}", conf.GetURL(this_), type.Name), new object[0]);
                return(null);
            }
            List <object> list = new List <object>();

            foreach (DataItem this_2 in (this_ as Sequence).Enties)
            {
                list.Add(this_2.ToType(conf));
            }
            return(list.ToArray());
        }
Exemple #2
0
 public MappingWrapper(Mapping mapping, YamlConfig config)
 {
     this._mapping = mapping;
     this._config  = config;
 }
Exemple #3
0
 public virtual void OnShutDown(YamlConfig conf)
 {
     throw new NotImplementedException();
 }
Exemple #4
0
 public void ReadMapping(MappingWrapper mapping, YamlConfig config)
 {
     this._mapping = mapping;
     this.PopulateMapping(mapping);
     this.ReadMapping(mapping);
 }