public string GetValue(XmlDataProvider xmlDataProvider, object value)
        {
            var root = xmlDataProvider.StartTag("array");

            root += xmlDataProvider.StartTag("data");
            root  = ((IEnumerable)value).Cast <object>().Aggregate(root, (current, item) => current + xmlDataProvider.CreateNode("value", xmlDataProvider.GetValue(item).ToString()));
            root += xmlDataProvider.EndTag("data");
            root += xmlDataProvider.EndTag("array");
            return(root);
        }
        public string GetValue(XmlDataProvider xmlDataProvider, object value)
        {
            var method = (MethodCall)value;
            var root   = xmlDataProvider.StartTag("methodCall");

            root += xmlDataProvider.CreateNode("methodName", method.MethodName);
            root += xmlDataProvider.StartTag("params");

            foreach (var param in method.Params)
            {
                root += xmlDataProvider.CreateNode("param",
                                                   xmlDataProvider.CreateNode("value", xmlDataProvider.GetValue(param)));
            }

            root += xmlDataProvider.EndTag("params");
            root += xmlDataProvider.EndTag("methodCall");
            return(root);
        }
Exemplo n.º 3
0
        public string GetValue(XmlDataProvider xmlDataProvider, object value)
        {
            var root = xmlDataProvider.StartTag("struct");

            foreach (var prop in value.GetType().GetProperties())
            {
                var propValue = (prop.GetValue(value));
                if (propValue == null)
                {
                    continue;
                }
                root += xmlDataProvider.StartTag("member");
                root += xmlDataProvider.CreateNode("name", xmlDataProvider.GetName(prop));
                root += xmlDataProvider.CreateNode("value", xmlDataProvider.GetValue(propValue));
                root += xmlDataProvider.EndTag("member");
            }
            root += xmlDataProvider.EndTag("struct");
            return(root);
        }