Esempio n. 1
0
        protected static IpcResponse GetDataResponse <T>(T data)
        {
            var response = new IpcResponse(true);

            response.SetData(data);
            return(response);
        }
Esempio n. 2
0
        private static string CmdNotRegisteredResponse(string command)
        {
            var response = new IpcResponse(false);

            response.SetData($"Command \"{command}\" is not registered");
            return(JsonConvert.SerializeObject(response));
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }