Ejemplo n.º 1
0
        public object FromXml(string s)
        {
            XReader reader = new XReader(s);
            UnmarshallingContext context = new UnmarshallingContext(reader, converterLookup, aliases, assemblies);

            return(context.ConvertOriginal());
        }
Ejemplo n.º 2
0
 public object FromXml(XStreamReader reader, UnmarshallingContext context)
 {
     var folders = new Folders();
     var count = reader.NoOfChildren();
     reader.MoveDown();
     for (var i = 0; i < count; i++) {
         folders.Add((Folder) context.ConvertAnother());
         reader.MoveNext();
     }
     reader.MoveUp();
     return folders;
 }
        public object UnMarshall(XStreamReader reader, UnmarshallingContext context, Type type)
        {
            var result = context.FindReferenceFromCurrentNode();
            if (result != null) return result;

            if (reader.GetAttribute(XsAttribute.Null) == true.ToString())
                return null;
            result = DynamicInstanceBuilder.CreateInstance(type);
            context.StackObject(result);
            UnmarshalAs(result, type, reader, context);
            return result;
        }
Ejemplo n.º 4
0
 public object UnMarshall(XStreamReader reader, UnmarshallingContext context, Type type)
 {
     IList result = (IList) DynamicInstanceBuilder.CreateInstance(Type.GetType(reader.GetAttribute(LIST_TYPE)));
     int count = reader.NoOfChildren();
     reader.MoveDown();
     for (int i = 0; i < count; i++) {
         object item = ReadItem(reader, context, result);
         result.Add(item);
         reader.MoveNext();
     }
     reader.MoveUp();
     return result;
 }
Ejemplo n.º 5
0
 public object UnMarshall(XStreamReader reader, UnmarshallingContext context, Type type)
 {
     int count = reader.NoOfChildren();
     Array result = Array.CreateInstance(Type.GetType(reader.GetAttribute(ARRAY_TYPE)), count);
     if (count != 0) {
         reader.MoveDown();
         for (int i = 0; i < count; i++) {
             var serializedValue = ReadSerializedValue(reader);
             var elementType = mapper.ResolveClassTypeFor(serializedValue);
             result.SetValue(context.ConvertAnother(result, elementType), i);
             reader.MoveNext();
         }
         reader.MoveUp();
     }
     return result;
 }
        private void UnmarshalAs(object result, Type type, XStreamReader reader, UnmarshallingContext context)
        {
            if (type.Equals(typeof(object))) return;

            foreach (var field in mapper.GetSerializableFieldsIn(type))
            {
                reader.MoveDown(field.SerializedName);

                var serializedField = ReadSerializedValue(reader);
                var fieldType = mapper.ResolveFieldTypeFor(field, serializedField);
                object fieldValue = context.ConvertAnother(result, fieldType);
                field.SetValue(result, fieldValue);
                reader.MoveUp();
            }
            UnmarshalAs(result, type.BaseType, reader, context);
        }
Ejemplo n.º 7
0
 public object FromXml(XStreamReader reader, UnmarshallingContext context) {
     return selfPlugin.operations;
 }
Ejemplo n.º 8
0
 private object ReadItem(XStreamReader reader, UnmarshallingContext context, IList result)
 {
     var serializedValue = ReadSerializedValue(reader);
     var type = mapper.ResolveClassTypeFor(serializedValue);
     return context.ConvertAnother(result, type);
 }
Ejemplo n.º 9
0
 public object FromXml(string s) {
     XReader reader = new XReader(s);
     UnmarshallingContext context = new UnmarshallingContext(reader, converterLookup, aliases, assemblies);
     return context.ConvertOriginal();
 }
Ejemplo n.º 10
0
			public object FromXml (XStreamReader reader, UnmarshallingContext context) {
				throw new System.NotImplementedException ();
			}
Ejemplo n.º 11
0
 public object FromXml(XStreamReader reader, UnmarshallingContext context)
 {
     return selfPlugin.Recent;
 }
Ejemplo n.º 12
0
 public Unmarshaller(XStreamReader reader, UnmarshallingContext context, ConverterLookup converterLookup)
 {
     this.reader          = reader;
     this.context         = context;
     this.converterLookup = converterLookup;
 }
Ejemplo n.º 13
0
 public object FromXml(XStreamReader reader, UnmarshallingContext context)
 {
     throw new System.NotImplementedException();
 }
Ejemplo n.º 14
0
 public Unmarshaller(XStreamReader reader, UnmarshallingContext context, ConverterLookup converterLookup) {
     this.reader = reader;
     this.context = context;
     this.converterLookup = converterLookup;
 }