public async Task DeleteDirectory(JObject directoryJson) { DebugHandler.TraceMessage("DeleteDirectory called.", DebugSource.TASK, DebugType.ENTRY_EXIT); DebugHandler.TraceMessage(directoryJson.ToString(), DebugSource.TASK, DebugType.PARAMETERS); try { string filePath = directoryJson.Value <string>("path"); if (filePath.Contains("//")) { filePath.Replace("//", "/"); } if (filePath.Contains("\\\\")) { filePath.Replace("\\\\", "\\"); } string result = DirectoryHandler.DeleteDirectory(filePath); await WebSocketHandler.SendMessage(result); } catch (Exception e) { DebugHandler.TraceMessage(e.ToString(), DebugSource.TASK, DebugType.WARNING); JsonError error = new JsonError() { type = "create_directory_error", errormessage = "Could not create directory.", errortype = "exception", exception = e.ToString() }; await WebSocketHandler.SendMessage(error.ToJson()); } }