static void Main() { AddInElements data = new AddInElements(); data.Type = "Command"; data.Assembly = "Foo.dll"; data.AddInId = Guid.NewGuid().ToString(); data.VendorId = "Kkozlov"; data.VendorDescription = "N/A"; GenerateManifestFile(data); }
static void GenerateManifestFile(AddInElements data) { Xml.XElement addin = new Xml.XElement( "Addin", new Xml.XAttribute("Type", data.Type)); Type type = data.GetType(); PropertyInfo[] props = type.GetProperties(); foreach (PropertyInfo prop in props) { object value = prop.GetValue(data); if (null != value) { addin.SetElementValue(prop.Name, (string)value); } } Xml.XElement xmlTree = new Xml.XElement("RevitAddIns", addin); IO.StreamWriter sw = IO.File.CreateText( IO.Path.GetFileName(data.Assembly) .Replace(IO.Path.GetExtension(data.Assembly), ".addin")); sw.Write(xmlTree); sw.Close(); Console.WriteLine(xmlTree); }