GP SoftwareTwitter
Opus FAQsManualCommandsObjects

LinqPad OPUS Hotkey Exploded view


#1

/// Plug this code into linqpad for an exploded view (html) of all your hotkeys
/// You will have to change the path of MasterData

string MasterData = @"C:\Documents and Settings\All Users\Application Data\GPSoftware\Directory Opus\ConfigFiles\hotkeys.oxc";
List readText = File.ReadAllLines(MasterData, Encoding.UTF8).ToList();

StringBuilder doc = new StringBuilder();
readText.ForEach(x => doc.AppendLine(x));

XElement xml = XElement.Parse (doc.ToString());

		List<XElement> keyz = (from e in xml.Elements() where e.Name == "key" select e).ToList();
		


		var HotKeyz = (keyz.Select(s => new
		{
		Key_Name =  (s.Elements ("label").Count() > 0) ? s.Element("label").Value: "UnKnown",
		Type =  s.Element("function").Attribute("type").Value,
		Key = s.Attribute("hotkey").Value,
		Function = s.Element("function").Elements("instruction").Select(x => x.Value).ToList()
		
		})).OrderBy(x => x.Key_Name);

HotKeyz.Dump();