private void BMSChanged() { try { statusAssign = Status.GetNeutralPos; LargeTab.SelectedIndex = 0; // Read Theater List TheaterList.PopulateAndSave(appReg, Dropdown_TheaterList); // Read BMS-FULL.key string fname = appReg.GetInstallDir() + "\\User\\Config\\" + appReg.getKeyFileName(); string fnameauto = appReg.GetInstallDir() + "\\User\\Config\\" + appReg.getAutoKeyFileName(); if (!File.Exists(fnameauto)) { File.Copy(fname, fnameauto); } keyFile = new KeyFile(fnameauto, appReg); // Write Data Grid WriteDataGrid(); } catch (Exception ex) { Diagnostics.WriteLogFile(ex); Close(); } }
/// <summary> /// As the name implies... /// </summary> protected virtual void SaveKeyMapping(Hashtable inGameAxis, DeviceControl deviceControl, KeyFile keyFile) { string filename = appReg.GetInstallDir() + "/User/Config/" + appReg.getAutoKeyFileName(); if (File.Exists(filename)) { File.SetAttributes(filename, File.GetAttributes(filename) & ~FileAttributes.ReadOnly); } StreamWriter sw = new StreamWriter (filename, false, Encoding.GetEncoding("utf-8")); for (int i = 0; i < keyFile.keyAssign.Length; i++) { sw.Write(keyFile.keyAssign[i].GetKeyLine()); } for (int i = 0; i < deviceControl.joyAssign.Length; i++) { sw.Write(deviceControl.joyAssign[i].GetKeyLineDX(i, deviceControl.joyAssign.Length)); // PRIMARY DEVICE POV if (((InGameAxAssgn)inGameAxis["Roll"]).GetDeviceNumber() == i) { sw.Write(deviceControl.joyAssign[i].GetKeyLinePOV()); } } sw.Close(); }