public static LevelEditorInputProfile[] LoadProfiles(string path) { var profs = new List <LevelEditorInputProfile>(); foreach (string f in System.IO.Directory.GetFiles(path, "*.json")) { profs.Add(LevelEditorInputProfile.Load(f)); } return(profs.ToArray()); }
private void LoadProfile(string fileName) { Timer.Stop(); curProfile = null; var p = !string.IsNullOrEmpty(fileName) && System.IO.File.Exists(fileName) ? LevelEditorInputProfile.Load(fileName) : new LevelEditorInputProfile(); TextBoxX_CamMoveLeft.Text = GetStringFromInputControl(p["CamMoveLeft"]); TextBoxX_CamMoveRight.Text = GetStringFromInputControl(p["CamMoveRight"]); TextBoxX_CamMoveUp.Text = GetStringFromInputControl(p["CamMoveUp"]); TextBoxX_CamMoveDown.Text = GetStringFromInputControl(p["CamMoveDown"]); TextBoxX_CamMoveFordward.Text = GetStringFromInputControl(p["CamMoveFordward"]); TextBoxX_CamMoveBackward.Text = GetStringFromInputControl(p["CamMoveBackward"]); TextBoxX_ObjMoveLeft.Text = GetStringFromInputControl(p["ObjMoveLeft"]); TextBoxX_ObjMoveRight.Text = GetStringFromInputControl(p["ObjMoveRight"]); TextBoxX_ObjMoveUp.Text = GetStringFromInputControl(p["ObjMoveUp"]); TextBoxX_ObjMoveDown.Text = GetStringFromInputControl(p["ObjMoveDown"]); TextBoxX_ObjMoveFordward.Text = GetStringFromInputControl(p["ObjMoveFordward"]); TextBoxX_ObjMoveBackward.Text = GetStringFromInputControl(p["ObjMoveBackward"]); TextBoxX_LastObj.Text = GetStringFromInputControl(p["LastObj"]); TextBoxX_NextObj.Text = GetStringFromInputControl(p["NextObj"]); TextBoxX_DropToGround.Text = GetStringFromInputControl(p["DropToGround"]); TextBoxX_LastArea.Text = GetStringFromInputControl(p["LastArea"]); TextBoxX_NextArea.Text = GetStringFromInputControl(p["NextArea"]); try { var tguid = allDevices.FirstOrDefault(n => Publics.General.CompareTwoByteArrays(n.InstanceGuid.ToByteArray(), p.ControllerInstanceGuid.ToByteArray())); if (tguid is object) { ComboBoxEx1.SelectedIndex = Array.IndexOf(allDevices, tguid); } } catch (Exception ex) { } curProfile = p; }