//<-----------------------------------------Driver Logic-------------------------------------------> static void Main(string[] args) { BuildItem te1 = new BuildItem(); te1.builddesc = "firstproject"; file driver = new file(); driver.name = "TestDriver.cs"; te1.addDriver(driver); file one = new file(); one.name = "TestedOne.cs"; file two = new file(); two.name = "TestedTwo.cs"; te1.addCode(one); te1.addCode(two); BuildRequest tr = new BuildRequest(); tr.author = "Rama Teja Repaka"; tr.Builds.Add(te1); string trXml = tr.ToXml(); Console.Write("\n BuildRequest data structure:\n\n {0}\n", trXml); "Testing Deserialization of TestRequest from XML".title(); BuildRequest newRequest = trXml.FromXml <BuildRequest>(); string typeName = newRequest.GetType().Name; Console.Write("\n deserializing xml string results in type: {0}\n", typeName); foreach (BuildItem te in newRequest.Builds) { foreach (file files in te.driver) { string name = files.name; Console.WriteLine("driver--->" + name); } foreach (file file in te.sourcefiles) { string name = file.name; Console.WriteLine("sourcefile-->" + name); } } Console.WriteLine(); }
//<--------------------used for adding the file names to the source code list-------------------> public void addCode(file name) { sourcefiles.Add(name); }
//<-------------------used for adding the driver name to the list-----------------------------> public void addDriver(file name) { driver.Add(name); }