public static void WriteBuildArgs(this XmlWriter writer, params Tuple<string, object>[] arguments)
{
if (arguments.Length == 0)
throw new ArgumentException("Arguments are missing.");
var sb = new StringBuilder();
foreach (var arg in arguments)
{
if (arg.Item1 == null)
continue;
if (arg.Item1.Length == 0)
throw new ArgumentException("Empty argument name.");
var line = String.Format("{0}={1}", arg.Item1, arg.Item2).Replace("\"", "\"\"");
sb.AppendFormat("\r\n\t\t\t\t\t\"{0}\"", line);
}
if (sb.Length == 0)
throw new ArgumentException("Arguments are missing.");
sb.Append("\r\n\t\t\t\t");
writer.WriteElementString("buildArgs", sb.ToString());
}
}