private void BtnLoad_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Build Profile | " + MdConstant.eProfiles; dialog.Title = "Select Build Profile"; dialog.InitialDirectory = MdConstant.profiles; dialog.ShowDialog(); if (dialog.FileName != "") { BtnResetPins.PerformClick(); BtnResetMod.PerformClick(); ClBuildProfile bp = MdCore.Deserialize <ClBuildProfile>(dialog.FileName); List <string> pinpool = FlpPool.Controls.Cast <Button>().Select(btn => btn.Text).ToList(); List <string> modpool = LbModPool.Items.Cast <string>().ToList(); foreach (string str in bp.hpins) { if (pinpool.Contains(str)) { AddPin(str, FlpHPins); RemovePin("bt_" + str, FlpPool); } else { MessageBox.Show("The current controller does not contain pin " + str + "\nWhich is part of the list of horizontal pins\nAs such it is not added to the hpin pool"); } } foreach (string str in bp.vpins) { if (pinpool.Contains(str)) { AddPin(str, FlpVPins); RemovePin("bt_" + str, FlpPool); } else { MessageBox.Show("The current controller does not contain pin " + str + "\nWhich is part of the list of vertical pins\nAs such it is not added to the vpin pool"); } } foreach (string str in bp.mods) { if (modpool.Contains(str)) { LbMods.Items.Add(str); LbModPool.Items.Remove(str); } } TbBuild.Text = bp.driver_build; TbName.Text = bp.name; TbVariant.Text = bp.variant; NudRefresh.Value = Convert.ToDecimal(bp.refresh); } }
public static void BuildFromList(ClBuildList bl) { var obp = new List <ClBuildProfile>(); var octrl = new List <ClController>(); for (int i = 0; i < bl.bp.Count; i++) { obp.Add(MdCore.Deserialize <ClBuildProfile>(MdConstant.profiles + MdConstant.pseparator + bl.bp[i])); octrl.Add(MdCore.Deserialize <ClController>(MdConstant.controllers + MdConstant.pseparator + bl.controller[i])); MdCore.BuildAnimus(obp[i], octrl[i], bl.animus[i], bl.mod[i], bl.output[i]); } }
private void BtnSelectControl_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Controller File | " + MdConstant.eControllers; dialog.Title = "Select Controller"; dialog.InitialDirectory = MdConstant.controllers; dialog.ShowDialog(); if (dialog.FileName != "") { MdGlobal.selectedController = MdCore.Deserialize <ClController>(dialog.FileName); } }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MdGlobal.init(); MdGlobal.mainForm = new FmMain(); List <string> largs = args.ToList(); if (largs.Count == 1) { if (System.IO.File.Exists(largs[0])) { ClBuildList.BuildFromList(MdCore.Deserialize <ClBuildList>(largs[0])); } Application.Exit(); } else { Application.Run(MdGlobal.mainForm); } }
public static void LoadSettings() { setting = MdCore.Deserialize <MdSetting>(MdConstant.settings); }