protected static IpcResponse GetDataResponse <T>(T data) { var response = new IpcResponse(true); response.SetData(data); return(response); }
private static string CmdNotRegisteredResponse(string command) { var response = new IpcResponse(false); response.SetData($"Command \"{command}\" is not registered"); return(JsonConvert.SerializeObject(response)); }
protected IpcResponse GetErrorResponse(string message, string methodName, string suffix = null) { var prefix = string.IsNullOrEmpty(suffix) ? $"{_engineName}{methodName}() error" : $"{_engineName}{methodName}() {suffix} error"; var ex = new Exception($"{prefix}. {message}"); ExceptionThrown?.Invoke(this, ex); var response = new IpcResponse(false); response.SetData(message); return(response); }
protected IpcResponse GetErrorResponse(Exception ex, string methodName, string suffix = null) { var message = string.IsNullOrEmpty(suffix) ? $"{_engineName}{methodName}() error" : $"{_engineName}{methodName}() {suffix} error"; var outerEx = new Exception(message, ex); ExceptionThrown?.Invoke(this, outerEx); var response = new IpcResponse(false); response.SetData(ex.Message); return(response); }