public A_Button(ControllerMapping controllerMapping) : base() { //TODO: Will want to allow multiple presets at some point Preset preset = controllerMapping.presets.First<Preset>(); base.groupID = preset.groupSourceBindings.FirstOrDefault().GetKeyValueByValue(STEAM_DIAMOND_BUTTON_TEXT).GetKey(); base.group = controllerMapping.groups.Where(x => x.GetKeyValueByKey("id").GetValue().Equals(groupID)).FirstOrDefault(); base.keyValue = base.group.bindings.Where(x => x.GetKeyValueByKey(STEAM_A_BUTTON_TEXT) != null).FirstOrDefault().GetKeyValueByKey(STEAM_A_BUTTON_TEXT); base.action = base.keyValue.GetValue(); }
public X_Button(ControllerMapping controllerMapping) { //TODO: Will want to allow multiple presets at some point Preset preset = controllerMapping.presets.First<Preset>(); foreach (KeyValue keyvalue in preset.groupSourceBindings.First<GroupSourceBinding>().keyValues) { if (keyvalue.GetValue().Equals(STEAM_DIAMOND_BUTTON_TEXT)) { groupID = keyvalue.GetKey(); break; } } foreach (Group group in controllerMapping.groups) { KeyValue kv; if ((kv = group.FindBinding(STEAM_X_BUTTON_TEXT)) != null) action = kv.GetValue(); } }
private void btnImport_Click(object sender, EventArgs e) { try { VDFParser parser = new VDFParser(); ParentKey parent = parser.Parse(new StreamReader(File.Open(desktopVDFFileLoc, FileMode.Open))); controllerMapping = new ControllerMapping(); controllerMapping.ParseParentKey(parent); a = new A_Button(controllerMapping); b = new B_Button(controllerMapping); x = new X_Button(controllerMapping); y = new Y_Button(controllerMapping); lbl_A_Button.Text = a.action; lbl_B_Button.Text = b.action; lbl_X_Button.Text = x.action; lbl_Y_Button.Text = y.action; } catch (Exception ex) { Console.WriteLine("Could not read file"); Console.WriteLine(ex.Message); } }
private void loadToolStripMenuItem_Click(object sender, EventArgs e) { List<ControllerComponentObject> controllerComponents = new List<ControllerComponentObject>(); OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == DialogResult.OK) { desktopVDFFileLoc = ofd.FileName; } VDFParser parser = new VDFParser(); ParentKey parent = parser.Parse(new StreamReader(File.Open(desktopVDFFileLoc, FileMode.Open))); controllerMapping = new ControllerMapping(); controllerMapping.ParseParentKey(parent); }