/// Plug this text into linqpad (c# statements)
/// Change Toolbar path to point to a toolbar file on your PC
/// It generates a HTML list of your buttons with the associated function.
string ToolbarPath = @"C:\Documents and Settings\All Users\Application Data\GPSoftware\Directory Opus\Buttons\ListerMenu.dop";
List readText = File.ReadAllLines(ToolbarPath, Encoding.UTF8).ToList().Select(x => x.Replace("3dborders","threedborders")).ToList();
StringBuilder doc = new StringBuilder();
readText.ForEach(x => doc.AppendLine(x));
XElement xml = XElement.Parse (doc.ToString());
List<XElement> buttons = (from e in xml.Elements().Descendants()
where e.Name == "button" && e.Elements().Any (node => node.Name == "function")
select e).ToList();
var output = buttons.Select(s => new
{
Button_Name = (s.Elements ("label").Count() > 0) ? s.Element("label").Value: "NoLabel",
Type = s.Element("function").Attribute("type").Value,
Function = s.Element("function").Elements("instruction").Select(x => x.Value).ToArray()
}).OrderBy(x => x.Button_Name);
output.Dump();