示例#1
0
            public void GetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
            {
                Altaxo.Data.TextColumn s = (Altaxo.Data.TextColumn)obj;
                System.Runtime.Serialization.ISurrogateSelector ss = AltaxoStreamingContext.GetSurrogateSelector(context);
                if (null != ss)
                {
                    System.Runtime.Serialization.ISerializationSurrogate surr =
                        ss.GetSurrogate(typeof(Altaxo.Data.DataColumn), context, out ss);

                    surr.GetObjectData(obj, info, context); // stream the data of the base object
                }
                else
                {
                    ((DataColumn)s).GetObjectData(info, context);
                }

                if (s.m_Count != s.m_Capacity)
                {
                    // instead of the data array itself, stream only the first m_Count
                    // array elements, since only they contain data
                    string[] streamarray = new string[s.m_Count];
                    System.Array.Copy(s.m_Array, streamarray, s.m_Count);
                    info.AddValue("Data", streamarray);
                }
                else // if the array is fully filled, we don't need to save a shrinked copy
                {
                    info.AddValue("Data", s.m_Array);
                }
            }
示例#2
0
 public NetDataContractSerializer(StreamingContext context,
                                  int maxItemsInObjectGraph,
                                  bool ignoreExtensionDataObject,
                                  FormatterAssemblyStyle assemblyFormat,
                                  ISurrogateSelector surrogateSelector)
 {
     Initialize(context, maxItemsInObjectGraph, ignoreExtensionDataObject, assemblyFormat, surrogateSelector);
 }
示例#3
0
 public NetDataContractSerializer(XmlDictionaryString rootName, XmlDictionaryString rootNamespace,
                                  StreamingContext context,
                                  int maxItemsInObjectGraph,
                                  bool ignoreExtensionDataObject,
                                  FormatterAssemblyStyle assemblyFormat,
                                  ISurrogateSelector surrogateSelector)
 {
     Initialize(rootName, rootNamespace, context, maxItemsInObjectGraph, ignoreExtensionDataObject, assemblyFormat, surrogateSelector);
 }
 internal XmlObjectSerializerReadContextComplex(NetDataContractSerializer serializer)
     : base(serializer)
 {
     mode = SerializationMode.SharedType;
     preserveObjectReferences = true;
     binder            = serializer.Binder;
     surrogateSelector = serializer.SurrogateSelector;
     assemblyFormat    = serializer.AssemblyFormat;
 }
示例#5
0
 internal XmlObjectSerializerWriteContextComplex(NetDataContractSerializer serializer, Hashtable surrogateDataContracts)
     : base(serializer)
 {
     mode = SerializationMode.SharedType;
     preserveObjectReferences = true;
     streamingContext         = serializer.Context;
     binder                      = serializer.Binder;
     surrogateSelector           = serializer.SurrogateSelector;
     this.surrogateDataContracts = surrogateDataContracts;
 }
示例#6
0
        public NetDataContractSerializer(string rootName, string rootNamespace,
                                         StreamingContext context,
                                         int maxItemsInObjectGraph,
                                         bool ignoreExtensionDataObject,
                                         FormatterAssemblyStyle assemblyFormat,
                                         ISurrogateSelector surrogateSelector)
        {
            XmlDictionary dictionary = new XmlDictionary(2);

            Initialize(dictionary.Add(rootName), dictionary.Add(DataContract.GetNamespace(rootNamespace)), context, maxItemsInObjectGraph, ignoreExtensionDataObject, assemblyFormat, surrogateSelector);
        }
示例#7
0
 private void Initialize(XmlDictionaryString rootName, XmlDictionaryString rootNamespace,
                         StreamingContext context,
                         int maxItemsInObjectGraph,
                         bool ignoreExtensionDataObject,
                         FormatterAssemblyStyle assemblyFormat,
                         ISurrogateSelector surrogateSelector)
 {
     Initialize(context, maxItemsInObjectGraph, ignoreExtensionDataObject, assemblyFormat, surrogateSelector);
     this.rootName      = rootName;
     this.rootNamespace = rootNamespace;
 }
示例#8
0
 public object SetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.ISurrogateSelector selector)
 {
     System.Runtime.Serialization.ISurrogateSelector ss = AltaxoStreamingContext.GetSurrogateSelector(context);
     if (null != ss)
     {
         System.Runtime.Serialization.ISerializationSurrogate surr =
             ss.GetSurrogate(obj.GetType().BaseType, context, out ss);
         surr.SetObjectData(obj, info, context, selector);
     }
     else
     {
         throw new NotImplementedException(string.Format("Serializing a {0} without surrogate not implemented yet!", obj.GetType()));
     }
     return(obj);
 }
示例#9
0
        private void Initialize(StreamingContext context,
                                int maxItemsInObjectGraph,
                                bool ignoreExtensionDataObject,
                                FormatterAssemblyStyle assemblyFormat,
                                ISurrogateSelector surrogateSelector)
        {
            this.context = context;
            if (maxItemsInObjectGraph < 0)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(maxItemsInObjectGraph), SR.ValueMustBeNonNegative));
            }

            this.maxItemsInObjectGraph     = maxItemsInObjectGraph;
            this.ignoreExtensionDataObject = ignoreExtensionDataObject;
            this.surrogateSelector         = surrogateSelector;
            AssemblyFormat = assemblyFormat;
        }
        public object SetObjectData(
            object obj,
            System.Runtime.Serialization.SerializationInfo info,
            System.Runtime.Serialization.StreamingContext context,
            System.Runtime.Serialization.ISurrogateSelector selector)
        {
            System.Diagnostics.Stopwatch stopWatch = null;
            bool isNull = info.GetBoolean(NULL_INDICATOR_STRING);

            if (!isNull)
            {
                stopWatch = obj as System.Diagnostics.Stopwatch;
                // read other values and set via reflection
            }

            return(stopWatch);
        }
示例#11
0
            public void GetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
            {
                Altaxo.Data.DataTable s = (Altaxo.Data.DataTable)obj;
                System.Runtime.Serialization.ISurrogateSelector ss = AltaxoStreamingContext.GetSurrogateSelector(context);
                if (null != ss)
                {
                    System.Runtime.Serialization.ISerializationSurrogate surr =
                        ss.GetSurrogate(typeof(Altaxo.Data.DataColumnCollection), context, out ss);
                    surr.GetObjectData(obj, info, context); // stream the data of the base object
                }
                else
                {
                    throw new NotImplementedException(string.Format("Serializing a {0} without surrogate not implemented yet!", obj.GetType()));
                }

                info.AddValue("Name", s._tableName);           // name of the Table
                info.AddValue("PropCols", s._propertyColumns); // the property columns of that table
            }
示例#12
0
            public void GetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
            {
                System.Runtime.Serialization.ISurrogateSelector ss = AltaxoStreamingContext.GetSurrogateSelector(context);
                if (null != ss)
                {
                    System.Runtime.Serialization.ISerializationSurrogate surr =
                        ss.GetSurrogate(obj.GetType().BaseType, context, out ss);

                    surr.GetObjectData(obj, info, context); // stream the data of the base object
                }
                else
                {
                    throw new NotImplementedException(string.Format("Serializing a {0} without surrogate not implemented yet!", obj.GetType()));
                }
                RowHeaderStyle s = (RowHeaderStyle)obj;

                info.AddValue("Height", (float)s.m_RowHeight);
            }
        static StackObject *ChainSelector_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Runtime.Serialization.ISurrogateSelector selector = (System.Runtime.Serialization.ISurrogateSelector) typeof(System.Runtime.Serialization.ISurrogateSelector).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.Serialization.UnitySurrogateSelector instance_of_this_method;
            instance_of_this_method = (UnityEngine.Serialization.UnitySurrogateSelector) typeof(UnityEngine.Serialization.UnitySurrogateSelector).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.ChainSelector(selector);

            return(__ret);
        }
        public override System.Runtime.Serialization.ISerializationSurrogate GetSurrogate(
            System.Type type,
            System.Runtime.Serialization.StreamingContext context,
            out System.Runtime.Serialization.ISurrogateSelector selector)
        {
            System.Runtime.Serialization.ISerializationSurrogate surrogate;

            surrogate = base.GetSurrogate(type, context, out selector);

            if (surrogate == null)
            {
                if (type == typeof(System.Diagnostics.Stopwatch))
                {
                    surrogate = _Surrogate;
                }
            }

            return(surrogate);
        }
示例#15
0
            public object SetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.ISurrogateSelector selector)
            {
                // first the base class
                System.Runtime.Serialization.ISurrogateSelector ss = AltaxoStreamingContext.GetSurrogateSelector(context);
                if (null != ss)
                {
                    System.Runtime.Serialization.ISerializationSurrogate surr =
                        ss.GetSurrogate(obj.GetType().BaseType, context, out ss);
                    surr.SetObjectData(obj, info, context, selector);
                }
                else
                {
                    throw new NotImplementedException(string.Format("Serializing a {0} without surrogate not implemented yet!", obj.GetType()));
                }
                // now the class itself
                RowHeaderStyle s = (RowHeaderStyle)obj;

                s.m_RowHeight = (int)info.GetSingle("Height");
                return(obj);
            }
示例#16
0
            public object SetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.ISurrogateSelector selector)
            {
                Altaxo.Data.TextColumn s = (Altaxo.Data.TextColumn)obj;
                System.Runtime.Serialization.ISurrogateSelector ss = AltaxoStreamingContext.GetSurrogateSelector(context);
                if (null != ss)
                {
                    System.Runtime.Serialization.ISerializationSurrogate surr =
                        ss.GetSurrogate(typeof(Altaxo.Data.DataColumn), context, out ss);
                    surr.SetObjectData(obj, info, context, selector);
                }
                else
                {
                    ((DataColumn)s).SetObjectData(obj, info, context, selector);
                }
                s.m_Array    = (string[])(info.GetValue("Data", typeof(string[])));
                s.m_Capacity = null == s.m_Array ? 0 : s.m_Array.Length;
                s.m_Count    = s.m_Capacity;

                return(s);
            }
示例#17
0
            public object SetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.ISurrogateSelector selector)
            {
                Altaxo.Data.DataTable s = (Altaxo.Data.DataTable)obj;
                System.Runtime.Serialization.ISurrogateSelector ss = AltaxoStreamingContext.GetSurrogateSelector(context);
                if (null != ss)
                {
                    System.Runtime.Serialization.ISerializationSurrogate surr =
                        ss.GetSurrogate(typeof(Altaxo.Data.DataColumnCollection), context, out ss);
                    surr.SetObjectData(obj, info, context, selector);
                }
                else
                {
                    throw new NotImplementedException(string.Format("Serializing a {0} without surrogate not implemented yet!", obj.GetType()));
                }

                s._tableName       = info.GetString("Name");
                s._propertyColumns = (DataColumnCollection)info.GetValue("PropCols", typeof(DataColumnCollection));

                return(s);
            }
示例#18
0
            /// <summary>
            /// Deserializes the GraphDocument Version 0.
            /// </summary>
            /// <param name="obj">The empty GraphDocument object to deserialize into.</param>
            /// <param name="info">The serialization info.</param>
            /// <param name="context">The streaming context.</param>
            /// <param name="selector">The deserialization surrogate selector.</param>
            /// <returns>The deserialized GraphDocument.</returns>
            public object SetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.ISurrogateSelector selector)
            {
                GraphDocument s = (GraphDocument)obj;

                System.Runtime.Serialization.ISurrogateSelector ss = AltaxoStreamingContext.GetSurrogateSelector(context);
                if (null != ss)
                {
                    // get the serialization surrogate of the base type
                    System.Runtime.Serialization.ISerializationSurrogate surr =
                        ss.GetSurrogate(obj.GetType().BaseType, context, out ss);

                    // deserialize the base type
                    surr.SetObjectData(obj, info, context, selector);
                }
                else
                {
                    throw new NotImplementedException(string.Format("Serializing a {0} without surrogate not implemented yet!", obj.GetType()));
                }
                s._pageBounds      = (RectangleF)info.GetValue("PageBounds", typeof(RectangleF));
                s._printableBounds = (RectangleF)info.GetValue("PrintableBounds", typeof(RectangleF));
                return(s);
            }
示例#19
0
            /// <summary>
            /// Serializes GraphDocument Version 0.
            /// </summary>
            /// <param name="obj">The GraphDocument to serialize.</param>
            /// <param name="info">The serialization info.</param>
            /// <param name="context">The streaming context.</param>
            public void GetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
            {
                GraphDocument s = (GraphDocument)obj;

                System.Runtime.Serialization.ISurrogateSelector ss = AltaxoStreamingContext.GetSurrogateSelector(context);
                if (null != ss)
                {
                    // get the serialization surrogate of the base type
                    System.Runtime.Serialization.ISerializationSurrogate surr =
                        ss.GetSurrogate(obj.GetType().BaseType, context, out ss);
                    // stream the data of the base class
                    surr.GetObjectData(obj, info, context);
                }
                else
                {
                    throw new NotImplementedException(string.Format("Serializing a {0} without surrogate not implemented yet!", obj.GetType()));
                }


                // now the data of our class
                info.AddValue("PageBounds", s._pageBounds);
                info.AddValue("PrintableBounds", s._printableBounds);
            }
示例#20
0
            /// <summary>
            /// Deserializes the XYColumnPlotItem Version 0.
            /// </summary>
            /// <param name="obj">The empty XYColumnPlotItem object to deserialize into.</param>
            /// <param name="info">The serialization info.</param>
            /// <param name="context">The streaming context.</param>
            /// <param name="selector">The deserialization surrogate selector.</param>
            /// <returns>The deserialized XYColumnPlotItem.</returns>
            public object SetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.ISurrogateSelector selector)
            {
                XYColumnPlotItem s = (XYColumnPlotItem)obj;

                s.Data  = (XYColumnPlotData)info.GetValue("Data", typeof(XYColumnPlotData));
                s.Style = (G2DPlotStyleCollection)info.GetValue("Style", typeof(G2DPlotStyleCollection));

                return(s);
            }
示例#21
0
 public virtual System.Runtime.Serialization.ISerializationSurrogate GetSurrogate(System.Type type, System.Runtime.Serialization.StreamingContext context, out System.Runtime.Serialization.ISurrogateSelector selector)
 {
     throw null;
 }
示例#22
0
 public ObjectManager(System.Runtime.Serialization.ISurrogateSelector selector, System.Runtime.Serialization.StreamingContext context)
 {
 }
 public BinaryFormatter(System.Runtime.Serialization.ISurrogateSelector selector, System.Runtime.Serialization.StreamingContext context)
 {
 }
示例#24
0
 public virtual void ChainSelector(System.Runtime.Serialization.ISurrogateSelector selector)
 {
 }
示例#25
0
            public object SetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.ISurrogateSelector selector)
            {
                Altaxo.Data.DataTableCollection s = (Altaxo.Data.DataTableCollection)obj;
                // s._parent = (AltaxoDocument)(info.GetValue("Parent",typeof(AltaxoDocument)));
                s.m_TablesByName = (System.Collections.SortedList)(info.GetValue("Tables", typeof(System.Collections.SortedList)));

                // setup helper objects
                s.m_SuspendedChildCollection = new System.Collections.ArrayList();
                return(s);
            }
 public void ChainSelector(System.Runtime.Serialization.ISurrogateSelector selector)
 {
     this._nextSelector = selector;
 }
        public virtual new System.Runtime.Serialization.ISerializationSurrogate GetSurrogate(Type type, System.Runtime.Serialization.StreamingContext context, out System.Runtime.Serialization.ISurrogateSelector ssout)
        {
            ssout = default(System.Runtime.Serialization.ISurrogateSelector);

            return(default(System.Runtime.Serialization.ISerializationSurrogate));
        }
        public System.Runtime.Serialization.ISerializationSurrogate GetSurrogate(Type !type, System.Runtime.Serialization.StreamingContext context, ref System.Runtime.Serialization.ISurrogateSelector ssout)
        {
            CodeContract.Requires(type != null);

            return(default(System.Runtime.Serialization.ISerializationSurrogate));
        }
示例#29
0
 // not used for deserialization, since the ISerializable constructor is used for that
 public object SetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.ISurrogateSelector selector)
 {
     return(obj);
 }
        static StackObject *GetSurrogate_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 4);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            System.Runtime.Serialization.ISurrogateSelector selector = (System.Runtime.Serialization.ISurrogateSelector) typeof(System.Runtime.Serialization.ISurrogateSelector).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Runtime.Serialization.StreamingContext context = (System.Runtime.Serialization.StreamingContext) typeof(System.Runtime.Serialization.StreamingContext).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            System.Type type = (System.Type) typeof(System.Type).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 4);
            UnityEngine.Serialization.UnitySurrogateSelector instance_of_this_method;
            instance_of_this_method = (UnityEngine.Serialization.UnitySurrogateSelector) typeof(UnityEngine.Serialization.UnitySurrogateSelector).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.GetSurrogate(type, context, out selector);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            switch (ptr_of_this_method->ObjectType)
            {
            case ObjectTypes.StackObjectReference:
            {
                var    ___dst = *(StackObject **)&ptr_of_this_method->Value;
                object ___obj = selector;
                if (___obj is CrossBindingAdaptorType)
                {
                    ___obj = ((CrossBindingAdaptorType)___obj).ILInstance;
                }
                __mStack[___dst->Value] = ___obj;
            }
            break;

            case ObjectTypes.FieldReference:
            {
                var ___obj = __mStack[ptr_of_this_method->Value];
                if (___obj is ILTypeInstance)
                {
                    ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = selector;
                }
                else
                {
                    var t = __domain.GetType(___obj.GetType()) as CLRType;
                    t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, selector);
                }
            }
            break;

            case ObjectTypes.StaticFieldReference:
            {
                var t = __domain.GetType(ptr_of_this_method->Value);
                if (t is ILType)
                {
                    ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = selector;
                }
                else
                {
                    ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, selector);
                }
            }
            break;

            case ObjectTypes.ArrayReference:
            {
                var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as System.Runtime.Serialization.ISurrogateSelector[];
                instance_of_arrayReference[ptr_of_this_method->ValueLow] = selector;
            }
            break;
            }

            object obj_result_of_this_method = result_of_this_method;

            if (obj_result_of_this_method is CrossBindingAdaptorType)
            {
                return(ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance));
            }
            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
示例#31
0
            public object SetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.ISurrogateSelector selector)
            {
                Altaxo.Data.DataTable s = (Altaxo.Data.DataTable)obj;

                s._tableName       = info.GetString("Name");
                s._dataColumns     = (DataColumnCollection)info.GetValue("DataCols", typeof(DataColumnCollection));
                s._propertyColumns = (DataColumnCollection)info.GetValue("PropCols", typeof(DataColumnCollection));

                return(s);
            }