private static MessageArgument ReadArgument(BinaryReader reader)
        {
            string argName = reader.ReadString();
            object value = ReadValue(reader);

            MessageArgument argument = new MessageArgument(argName, value);

            int sz = reader.ReadInt32();
            for (int i = 0; i < sz; i++)
                argument.Children.Add(ReadArgument(reader));

            return argument;
        }
        private static void WriteArgument(MessageArgument argument, BinaryWriter writer)
        {
            writer.Write(argument.Name);
            WriteValue(argument.Value, writer);

            int sz = argument.Children.Count;
            writer.Write(sz);
            for (int i = 0; i < sz; i++) {
                WriteArgument(argument.Children[i], writer);
            }
        }
Exemplo n.º 3
0
        public object Clone()
        {
            object newValue = Value;
            if (newValue is ICloneable)
                newValue = ((ICloneable) newValue).Clone();

            MessageArgument arg = new MessageArgument(Name, newValue, readOnly);
            arg.children = (MessageArguments) children.Clone();
            return arg;
        }