private void build_Click(object sender, RoutedEventArgs e)// Create Build Request according to the repofiles' selected items. { string savePath = GuiEnvironment.guistorage; string fileName = xmlname.Text + ".xml"; if (!System.IO.Directory.Exists(savePath)) { System.IO.Directory.CreateDirectory(savePath); } string fileSpec = System.IO.Path.Combine(savePath, fileName); fileSpec = System.IO.Path.GetFullPath(fileSpec); requestbuilder tr = new requestbuilder(); tr.author = "Weiheng Chai"; foreach (var item in repofiles.SelectedItems) { string filename = item.ToString(); if (filename.Contains("csproj")) { tr.csproj = filename; } else if (filename.Contains("testdriver") && filename.Contains("cs")) { tr.testDriver = filename; } else { tr.testedFiles.Add(filename); } } tr.makeRequest(); tr.saveXml(fileSpec); string fullpath = System.IO.Path.GetFullPath(fileSpec); Sender sender3 = new Sender(); sender3.CreateChannel("http://*****:*****@"../../../repostorage"); showpath.Text = "the Build Request:" + fileName + " has been stored at:" + fullsavepath + " and send to:" + repofullpath; }
static string getfiles(string buildrequest) { requestbuilder rb = new requestbuilder(); rb.loadXml(@"..\..\..\ChildBuilderstorage\" + buildrequest);//parse the build request, and request filers from the repository according to the information in the buildrequest rb.parse("author"); rb.parse("csproj"); rb.parse("testDriver"); rb.parseList("tested"); Console.WriteLine("author is{0}", rb.author); Console.WriteLine("csproj is {0}", rb.csproj); Console.WriteLine("testdriver is {0}", rb.testDriver); foreach (var item in rb.testedFiles) { Console.WriteLine("tested file is {0}", item); } Sender senderrepo = new Sender(); senderrepo.CreateChannel("http://localhost:2017"); CommMessage msgcsproj = new CommMessage(); msgcsproj.Command = CommMessage.MessageCommand.requestfiles; msgcsproj.Destinaiton = "repo"; msgcsproj.Source = address; msgcsproj.Body = rb.csproj; senderrepo.PostMessage(msgcsproj); CommMessage msgtestdriver = new CommMessage(); msgtestdriver.Command = CommMessage.MessageCommand.requestfiles; msgtestdriver.Destinaiton = "repo"; msgtestdriver.Source = address; msgtestdriver.Body = rb.testDriver; senderrepo.PostMessage(msgtestdriver); foreach (var item in rb.testedFiles) { CommMessage msgtested = new CommMessage(); msgtested.Command = CommMessage.MessageCommand.requestfiles;//get files msgtested.Destinaiton = "repo"; msgtested.Source = address; msgtested.Body = item; senderrepo.PostMessage(msgtested); } return(rb.csproj); }