public string toXML()
{
XmlDocument document = new XmlDocument();
var root = document.CreateElement("bug");
document.AppendChild(root);
XmlNode node;
if (BoxUUID.Text.Length > 0)
{
root.AppendChild((node = document.CreateElement("uuid")));
node.AppendChild(document.CreateTextNode(BoxUUID.Text));
}
if (BoxShortName.Text.Length > 0)
{
root.AppendChild((node = document.CreateElement("short-name")));
node.AppendChild(document.CreateTextNode(BoxShortName.Text));
}
/*if (BoxCreated.Text.Length > 0)
{
root.AppendChild((node = document.CreateElement("created")));
node.AppendChild(document.CreateTextNode(BoxCreated.Text));
}*/
if (BoxCreator.Text.Length > 0)
{
root.AppendChild((node = document.CreateElement("creator")));
node.AppendChild(document.CreateTextNode(BoxCreator.Text));
}
if (BoxReporter.Text.Length > 0)
{
root.AppendChild((node = document.CreateElement("reporter")));
node.AppendChild(document.CreateTextNode(BoxReporter.Text));
}
if (BoxAssigned.Text.Length > 0)
{
root.AppendChild((node = document.CreateElement("assigned")));
node.AppendChild(document.CreateTextNode(BoxAssigned.Text));
}
if (BoxSeverity.SelectedIndex >= 0)
{
root.AppendChild((node = document.CreateElement("severity")));
node.AppendChild(document.CreateTextNode(BoxSeverity.Text));
}
if (BoxStatus.SelectedIndex >= 0)
{
root.AppendChild((node = document.CreateElement("status")));
node.AppendChild(document.CreateTextNode(BoxStatus.Text));
}
if (BoxSummary.Text.Length > 0)
{
root.AppendChild((node = document.CreateElement("summary")));
node.AppendChild(document.CreateTextNode(BoxSummary.Text));
}
return document.OuterXml;
}
private void writeOutIssue(IssueDetail issue) { string[] arguments = new string[1], inputs = new string[1], outputs; arguments[0] = "import_xml -"; inputs[0] = "<be-xml>\n"; inputs[0] += issue.toXML(); inputs[0] += "</be-xml>"; //MessageBox.Show(this, "Would call: " + arguments[0] + "\nwith: " + inputs[0]); outputs = plugin.callBEcmd(BERepoLocation.Text, arguments, inputs); if (outputs[0].Length > 0) MessageBox.Show(this, "Command output: " + outputs[0]); changesMade(); }