public EditorResponse DeleteAllPrefs() { PrepareRequest(Methods.DeleteAllPrefs); _response = SocketHelper.SendMessage(Socket, _request); EditorResponse result; if (_response == null) { result = new EditorResponse { StatusCode = ErrorCodes.PuppetDriverError, IsSuccess = false, ErrorMessage = "Communication Error exception in PuppetDriver" } } ; else if (!_response.ContainsKey(Parameters.Method) && _response[Parameters.Method] != Methods.TakeScreenshot) { result = new EditorResponse { StatusCode = ErrorCodes.UnexpectedResponse, IsSuccess = false, ErrorMessage = "Unexpected request was received" } } ; else { result = new EditorResponse { StatusCode = ErrorCodes.Success, IsSuccess = true, Result = _response[Parameters.Result] } }; return(result); }
public EditorResponse Count(string root, string name, string parent, string upath) { PrepareRequest(Methods.Count, upath: upath, root: root, name: name, parent: parent); _response = SocketHelper.SendMessage(Socket, _request); EditorResponse result; if (_response == null) { result = new EditorResponse { StatusCode = ErrorCodes.PuppetDriverError, IsSuccess = false, ErrorMessage = "Communication Error exception in PuppetDriver" } } ; else if (!_response.ContainsKey(Parameters.Method) && _response[Parameters.Method] != Methods.Exist) { result = new EditorResponse { StatusCode = ErrorCodes.UnexpectedResponse, IsSuccess = false, ErrorMessage = "Unexpected request was received" } } ; else { result = new EditorResponse { StatusCode = ErrorCodes.Success, IsSuccess = true, Result = _response[Parameters.Result] } }; return(result); }
public EditorResponse Active(string root, string name, string parent, string upath) { PrepareRequest(Methods.Active, upath: upath, root: root, name: name, parent: parent); _response = SocketHelper.SendMessage(Socket, _request); EditorResponse result; if (_response == null) { result = new EditorResponse { StatusCode = ErrorCodes.PuppetDriverError, IsSuccess = false, ErrorMessage = "Communication Error exception in PuppetDriver" } } ; else if (!_response.ContainsKey(Parameters.Method) && _response[Parameters.Method] != Methods.Active) { result = new EditorResponse { StatusCode = ErrorCodes.UnexpectedResponse, IsSuccess = false, ErrorMessage = "Unexpected request was received" } } ; else if (_response[Parameters.Result] == NotFoundMessage) { result = new EditorResponse { StatusCode = ErrorCodes.NoSuchGameObjectFound, IsSuccess = false, ErrorMessage = _response[Parameters.Result] } } ; else if (!bool.TryParse(_response[Parameters.Result], out var r)) { result = new EditorResponse { StatusCode = ErrorCodes.PuppetDriverError, IsSuccess = false, ErrorMessage = $"Unexpected response: {_response[Parameters.Result]} was received" } } ; else { result = new EditorResponse { StatusCode = ErrorCodes.Success, IsSuccess = true, Result = _response[Parameters.Result] } }; return(result); }