private void CmdToolsTestReload_Executed(object sender, ExecutedEventArgs e) { if (_communication == null) { return; } var tempFileName = Path.GetTempFileName(); var fileInfo = new FileInfo(tempFileName); var newFileName = fileInfo.Name.Substring(0, fileInfo.Name.Length - fileInfo.Extension.Length); newFileName = "sldproj_" + newFileName + ".sldproj"; Debug.Assert(fileInfo.DirectoryName != null, "fileInfo.DirectoryName != null"); tempFileName = Path.Combine(fileInfo.DirectoryName, newFileName); var project = visualizer.Editor.Project.Project; var writer = ProjectWriter.CreateLatest(); writer.WriteProject(project, tempFileName); var @params = new EditReloadRequestParams { BackgroundMusicFile = project.MusicFileName, BeatmapFile = tempFileName, BeatmapOffset = 0, BeatmapIndex = (int)(visualizer.Editor.Difficulty - 1) }; _communication.Client.SendReloadRequest(@params); }
internal async void SendReloadRequest([NotNull] EditReloadRequestParams param0) { var serverUri = _communication.SimulatorServerUri; if (serverUri == null) { return; } var @params = new object[] { param0 }; var result = await SendRequestAsync(serverUri, CommonProtocolMethodNames.Edit_Reload, @params, null); if (!result.StatusCode.IsSuccessful()) { // TODO: Handle HTTP protocol errors. return; } Debug.Assert(result.ResponseObject != null, "result.ResponseObject != null"); if (!JsonRpcHelper.IsResponseValid(result.ResponseObject)) { // TODO: Handle malformed RPC object. Debug.Print("RPC response is invalid."); return; } if (JsonRpcHelper.IsResponseSuccessful(result.ResponseObject)) { var response = JsonRpcHelper.TranslateAsResponse(result.ResponseObject); } else { var error = JsonRpcHelper.TranslateAsResponse(result.ResponseObject); } }