/// <summary> /// What the instruction should do /// </summary> protected override void _Process() { // Parameters string camId = _GetParameter(PatchInstructionParameter.ParameterName.cameraIKIdentifier); string viewSource = _GetParameter(PatchInstructionParameter.ParameterName.viewSource); Cameras.Position sourcePosition = _ValidatePosition(viewSource); string viewTarget = _GetParameter(PatchInstructionParameter.ParameterName.viewTarget); Cameras.Position targetPosition = _ValidatePosition(viewTarget); // Loading current camera string currentCamFile = LibraryConstants.GetSpecialFile(LibraryConstants.TduSpecialFile.CamerasBin); Cameras currentCameras = TduFile.GetFile(currentCamFile) as Cameras; if (currentCameras == null || !currentCameras.Exists) { throw new Exception("Unable to load current camera data: " + currentCamFile); } // Retrieving entry Cameras.CamEntry entryToEdit = currentCameras.GetEntryByCameraId(camId); VehicleSlotsHelper.CustomizeCameraPosition(currentCameras, entryToEdit, Cameras.ViewType.Cockpit, sourcePosition, targetPosition); // Saving currentCameras.Save(); }
private void cockSetButton_Click(object sender, EventArgs e) { // Click on Set c**k position button try { Cursor = Cursors.WaitCursor; Cameras.Position sourcePos = (Cameras.Position)Enum.Parse(typeof(Cameras.Position), cockSourceComboBox.Text); Cameras.Position targetPos = (Cameras.Position)Enum.Parse(typeof(Cameras.Position), cockTargetComboBox.Text); Cameras.CamEntry currentEntry = _CameraData.GetEntryByCameraId(customCameraIdLabel.Text); if (currentEntry.isValid) { VehicleSlotsHelper.CustomizeCameraPosition(_CameraData, currentEntry, Cameras.ViewType.Cockpit, sourcePos, targetPos); // Refresh _RefreshCameraIKContents(); // Modification flag _IsCameraModified = true; StatusBarLogManager.ShowEvent(this, _STATUS_CHANGING_VIEW_POS_OK); } } catch (Exception ex) { MessageBoxes.ShowError(this, ex); } finally { Cursor = Cursors.Default; } }