コード例 #1
0
        /*--------< Deserializes an XML document and constructs objects from the given path and filename >--------------*/
        public void xmlDeserialization <T>(string receivedPath, string xmlFileName)
        {
            ToAndFromXml       xDeserialization = new ToAndFromXml();
            List <TestRequest> newTrq           = xDeserialization.FromXml <List <TestRequest> >(receivedPath, xmlFileName);

            foreach (TestRequest trq in newTrq)
            {
                foreach (string tlb in trq.TestLibraries)
                {
                    _files.Add(tlb);
                }
            }
        }
コード例 #2
0
        /*--------< Deserializes an XML document, constructs objects and return them. >--------------*/
        public Dictionary <int, List <string> > xmlDeserialization <T>(string receivedPath, string _xmlFileName)
        {
            ToAndFromXml xDeserialization          = new ToAndFromXml();
            BuildRequest newBrq                    = xDeserialization.FromXml <BuildRequest>(receivedPath, _xmlFileName); // Deserialization
            Dictionary <int, List <string> > tests = new Dictionary <int, List <string> >();

            foreach (var test in newBrq.Tests)
            {
                List <string> files = new List <string>();
                files.Add(test.Testfile);
                files.Add(test.TestInterface);
                files.Add(test.Testdriver);
                tests.Add(test.id, files);
            }
            return(tests);
        }
コード例 #3
0
        static void Main(string[] args)
        {
            ToAndFromXml testSerialization   = new ToAndFromXml();
            ToAndFromXml testDeserialization = new ToAndFromXml();

            Console.WriteLine("Demonstrating XML Serialization and Deserialization");
            Console.Write("\n  attempting to serialize Widget object:");
            List <string> tl          = new List <string>();
            string        builderPath = "../../../Builder/TempDirectory";
            string        xmlFileName = "/BuildRequest.xml";

            Console.Write("\n  attempting to serialize object:");
            testSerialization.ToXml(tl, builderPath);
            Console.Write("\n  attempting to deserialize Widget object:");
            testDeserialization.FromXml <string>(builderPath, xmlFileName);
        }