Beispiel #1
0
        public object Deserialize(IkonBaseObject data, LoadSession session)
        {
            if (this.deserializationMethod == null)
            {
                throw new InvalidOperationException("No deserialization method defined for " + data.Tag);
            }

            return(this.deserializationMethod(data, session));
        }
Beispiel #2
0
        private object deserializeChildren <T>(Ikadn.IkadnBaseObject rawData, LoadSession session)
        {
            var saveData = rawData.To <IkonArray>();
            var result   = (ICollection <T>) this.constructor();

            foreach (var elementData in saveData)
            {
                result.Add(session.Load <T>(elementData));
            }

            return(result);
        }
Beispiel #3
0
        private object deserializeChildren <T>(Ikadn.IkadnBaseObject rawData, LoadSession session)
        {
            var saveData = rawData.To <IkonArray>();
            var result   = (T[])this.lengthConstructor(saveData.Count);

            for (int i = 0; i < saveData.Count; i++)
            {
                result[i] = session.Load <T>(saveData[i]);
            }

            return(result);
        }
Beispiel #4
0
        private object deserializeChildren <K, V>(Ikadn.IkadnBaseObject rawData, LoadSession session)
        {
            var saveData = rawData.To <IkonArray>();
            var result   = (IDictionary <K, V>) this.constructor();

            for (int i = 0; i < saveData.Count; i += 2)
            {
                result.Add(
                    session.Load <K>(saveData[i]),
                    session.Load <V>(saveData[i + 1])
                    );
            }

            return(result);
        }
Beispiel #5
0
        public object Deserialize(IkonBaseObject rawData, LoadSession session)
        {
            var loadedValue = this.constructor();
            var saveData    = rawData.To <IkonComposite>();

            foreach (var property in this.properties.Where(x => x.Attribute.DoSave))
            {
                if (saveData.Keys.Contains(property.Name))
                {
                    property.Deserialize(loadedValue, saveData[property.Name].To <IkonBaseObject>(), session);
                }
                else
                {
                    property.SetNull(loadedValue);
                }
            }

            return(loadedValue);
        }
Beispiel #6
0
 public void Deserialize(object parentObject, IkonBaseObject rawData, LoadSession session)
 {
     this.deserializer(parentObject, rawData, session);
 }
 public object Deserialize(IkonBaseObject data, LoadSession session)
 {
     return(this.deserializeChildrenInvoker(this, data, session));
 }