コード例 #1
0
        /// <summary>
        /// Deserializes the given object.
        /// </summary>
        /// <param name="stream">Stream containing data.</param>
        /// <param name="type">The type of the object to create.</param>
        /// <returns>The deserialized object.</returns>
        public object Deserialize(Type type, SerializeStream stream)
        {
            int length = stream.ReadInt("registered");

            for (int i = 0; i < length; i++)
            {
                stream.EnterObject(null);
                Register(stream.ReadString("Name"), stream.ReadString("DllPath"), stream.ReadString("ClassName"));
                stream.LeaveObject();
            }
            return(this);
        }
コード例 #2
0
        //---------------------------------------------------------------
        #endregion
        //---------------------------------------------------------------

        //---------------------------------------------------------------
        #region FactorySerializer
        //---------------------------------------------------------------
        /// <summary>
        /// Serializes the given object.
        /// </summary>
        /// <param name="obj">The object to serialize.</param>
        /// <param name="stream">Stream to fill with data.</param>
        public void Serialize(object obj, SerializeStream stream)
        {
            ICollection collection = registered.Values;

            stream.Write("registered", collection.Count);
            foreach (PlugInData data in collection)
            {
                stream.EnterObject("PlugIn");
                stream.Write("Name", data.Name);
                stream.Write("DllPath", data.DllPath);
                stream.Write("ClassName", data.ClassName);
                stream.LeaveObject();
            }
        }