예제 #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 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);
 }
예제 #3
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
            }
예제 #4
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);
            }
예제 #5
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);
            }
예제 #6
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);
            }
예제 #7
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);
            }
예제 #8
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);
            }
예제 #9
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);
            }
예제 #10
0
 private bool CheckIfTypeSerializableForSharedTypeMode(Type memberType)
 {
     Fx.Assert(surrogateSelector != null, "Method should not be called when surrogateSelector is null.");
     return(surrogateSelector.GetSurrogate(memberType, streamingContext, out ISurrogateSelector surrogateSelectorNotUsed) != null);
 }