示例#1
0
        /// <summary>
        /// Write a list of SerializationInfo objects into stream,
        /// typically MemoryStream
        /// </summary>
        /// <param name="serializationStream">Stream to write the data into</param>
        /// <param name="objectData">List of SerializationInfo objects to write to stream</param>
        public void Write(Stream serializationStream, List <SerializationInfo> objectData)
        {
            keywordsDictionary.Clear();
            using (var writer = new CslaNonClosingBinaryWriter(serializationStream))
            {
                writer.Write(objectData.Count);
                foreach (var serializationInfo in objectData)
                {
                    writer.Write(serializationInfo.ReferenceId);
                    WriteSystemString(serializationInfo.TypeName, writer);

                    writer.Write(serializationInfo.Children.Count);
                    foreach (var childData in serializationInfo.Children)
                    {
                        WriteSystemString(childData.Key, writer);
                        Write(childData.Value.IsDirty, writer);
                        Write(childData.Value.ReferenceId, writer);
                    }
                    writer.Write(serializationInfo.Values.Count);
                    foreach (var valueData in serializationInfo.Values)
                    {
                        WriteSystemString(valueData.Key, writer);
                        WriteSystemString(valueData.Value.EnumTypeName ?? string.Empty, writer);
                        Write(valueData.Value.IsDirty, writer);
                        Write(valueData.Value.Value, writer);
                    }
                }
                writer.Flush();
            }
        }
示例#2
0
        /// <summary>
        /// Write a list of SerializationInfo objects into stream,
        /// typically MemoryStream
        /// </summary>
        /// <param name="serializationStream">Stream to write the data into</param>
        /// <param name="objectData">List of SerializationInfo objects to write to stream</param>
        public void Write(Stream serializationStream, List<SerializationInfo> objectData)
        {
            keywordsDictionary.Clear();
            using (var writer = new CslaNonClosingBinaryWriter(serializationStream))
            {
                writer.Write(objectData.Count);
                foreach (var serializationInfo in objectData)
                {
                    writer.Write(serializationInfo.ReferenceId);
                    WriteSystemString(serializationInfo.TypeName, writer);

                    writer.Write(serializationInfo.Children.Count);
                    foreach (var childData in serializationInfo.Children)
                    {
                        WriteSystemString(childData.Key, writer);
                        Write(childData.Value.IsDirty, writer);
                        Write(childData.Value.ReferenceId, writer);
                    }
                    writer.Write(serializationInfo.Values.Count);
                    foreach (var valueData in serializationInfo.Values)
                    {
                        WriteSystemString(valueData.Key, writer);
                        WriteSystemString(valueData.Value.EnumTypeName ?? string.Empty, writer);
                        Write(valueData.Value.IsDirty, writer);
                        Write(valueData.Value.Value, writer);
                    }
                }
                writer.Flush();
            }
        }