Ejemplo n.º 1
0
        private static void Test_Message()
        {
            HYS.Messaging.Objects.Message msg = new HYS.Messaging.Objects.Message();

            msg.Reference = new MessageReference();
            //msg.Reference.FileList = new XCollection<MessageReferenceFile>("File");
            //msg.Reference.FileList = new XCollection<MessageReferenceFile>();
            msg.Reference.FileList.Add(new ReferenceFile());
            msg.Reference.FileList.Add(new ReferenceFile());

            msg.Reference.FileList[0].Name     = "name test";
            msg.Reference.FileList[1].Location = "location test";

            msg.Body = "aaaaa";
            //msg.Body = "aa<aaa";

            string xml = msg.ToXMLString();

            MessageBox.Show(xml);

            HYS.Messaging.Objects.Message msg1 = XObjectManager.CreateObject <HYS.Messaging.Objects.Message>(xml);
            MessageBox.Show(msg1.ToXMLString());

            xml = msg.Reference.FileList.ToXMLString();
            MessageBox.Show(xml);

            //XCollection<MessageReferenceFile> list = XObjectManager.CreateObject<XCollection<MessageReferenceFile>>(xml);
            //MessageBox.Show(list.ToXMLString());

            ReferenceFileCollection list = XObjectManager.CreateObject <ReferenceFileCollection>(xml);

            MessageBox.Show(list.ToXMLString());
        }
Ejemplo n.º 2
0
        private static void Test_Body()
        {
            //string xmlstring = "<a><b>hello</b></a>";
            string xmlstring = XMLHeader + "<a><b>hello</b></a>";

            //XmlTextReader r = new XmlTextReader(new StringReader(xmlstring));
            //if(r.Read()) xmlstring = r.ReadOuterXml();

            HYS.Messaging.Objects.Message msg = new HYS.Messaging.Objects.Message();
            msg.Body = HYS.Messaging.Objects.Message.RemoveXmlHeader(xmlstring);

            string str = msg.ToXMLString();

            MessageBox.Show(str);

            HYS.Messaging.Objects.Message newmsg = XObjectManager.CreateObject <HYS.Messaging.Objects.Message>(str);
            MessageBox.Show(newmsg.ToXMLString());
        }