public void OnWebSocketEvent(WebSocketEventArgs args) { DebugHandler.TraceMessage("OnWebSocketEvent Called", DebugSource.TASK, DebugType.ENTRY_EXIT); DebugHandler.TraceMessage(args.ToString(), DebugSource.TASK, DebugType.PARAMETERS); try { try{ JObject query = JObject.Parse(args.Message); string action = query.Value <string>("action"); if (action != null) { JObject extra = query.Value <JObject>("extra"); if (extra != null) { switch (action) { case "delete_file": FileWebSocketService.DeleteFile(extra); break; case "open_file": FileWebSocketService.OpenFile(extra); break; } } } } catch (JsonReaderException e) { DebugHandler.TraceMessage(e.ToString(), DebugSource.TASK, DebugType.WARNING); JsonError error = new JsonError() { type = "command_error", errormessage = "Error happend during parsing of command.", errortype = "exception", exception = e.ToString() }; WebSocketHandler.SendMessage(error.ToJson()); } } catch (Exception e) { DebugHandler.TraceMessage(e.ToString(), DebugSource.TASK, DebugType.ERROR); JsonError error = new JsonError() { type = "command_error", errormessage = "Error happend during execution of command.", errortype = "exception", exception = e.ToString() }; WebSocketHandler.SendMessage(error.ToJson()); } }
public void OnWebSocketEvent(WebSocketEventArgs args) { DebugHandler.TraceMessage("OnWebSocketEvent Called", DebugSource.TASK, DebugType.ENTRY_EXIT); DebugHandler.TraceMessage(args.ToString(), DebugSource.TASK, DebugType.PARAMETERS); try { try{ JObject query = JObject.Parse(args.Message); string action = query.Value <string>("action"); if (action != null) { JObject extra = query.Value <JObject>("extra"); if (extra != null) { switch (action) { case "set_littleweeb_settings": SettingsWebSocketService.SetLittleWeebSettings(extra); break; case "set_irc_settings": SettingsWebSocketService.SetIrcSettings(extra); break; case "set_download_directory": SettingsWebSocketService.Setfullfilepath(extra); break; } } else { switch (action) { case "get_littleweeb_settings": SettingsWebSocketService.GetCurrentLittleWeebSettings(); break; case "get_irc_settings": SettingsWebSocketService.GetCurrentIrcSettings(); break; } } } } catch (JsonReaderException e) { DebugHandler.TraceMessage(e.ToString(), DebugSource.TASK, DebugType.WARNING); JsonError error = new JsonError() { type = "command_error", errormessage = "Error happend during parsing of command.", errortype = "exception", exception = e.ToString() }; WebSocketHandler.SendMessage(error.ToJson()); } } catch (Exception e) { DebugHandler.TraceMessage(e.ToString(), DebugSource.TASK, DebugType.ERROR); JsonError error = new JsonError() { type = "command_error", errormessage = "Error happend during execution of command.", errortype = "exception", exception = e.ToString() }; WebSocketHandler.SendMessage(error.ToJson()); } }
public void OnWebSocketEvent(WebSocketEventArgs args) { DebugHandler.TraceMessage("OnWebSocketEvent Called", DebugSource.TASK, DebugType.ENTRY_EXIT); DebugHandler.TraceMessage(args.ToString(), DebugSource.TASK, DebugType.PARAMETERS); try { try { JObject query = JObject.Parse(args.Message); string action = query.Value <string>("action"); if (action != null) { JObject extra = query.Value <JObject>("extra"); if (extra != null) { switch (action) { case "add_download": DownloadWebSocketService.AddDownload(extra); break; case "add_downloads": DownloadWebSocketService.AddDownloads(extra); break; case "abort_download": DownloadWebSocketService.AbortDownload(extra); break; case "remove_download": DownloadWebSocketService.RemoveDownload(extra); break; } } else { switch (action) { case "get_downloads": DownloadWebSocketService.GetCurrentFileHistory(); break; case "get_free_space": DirectoryWebSocketService.GetFreeSpace(); break; case "open_download_directory": DownloadWebSocketService.Openfullfilepath(); break; } } } } catch (JsonReaderException e) { DebugHandler.TraceMessage(e.ToString(), DebugSource.TASK, DebugType.WARNING); JsonError error = new JsonError() { type = "command_error", errormessage = "Error happend during parsing of command.", errortype = "exception", exception = e.ToString() }; WebSocketHandler.SendMessage(error.ToJson()); } } catch (Exception e) { DebugHandler.TraceMessage(e.ToString(), DebugSource.TASK, DebugType.ERROR); JsonError error = new JsonError() { type = "command_error", errormessage = "Error happend during execution of command.", errortype = "exception", exception = e.ToString() }; WebSocketHandler.SendMessage(error.ToJson()); } }
public void OnWebSocketEvent(WebSocketEventArgs args) { DebugHandler.TraceMessage("OnWebSocketEvent Called", DebugSource.TASK, DebugType.ENTRY_EXIT); DebugHandler.TraceMessage(args.ToString(), DebugSource.TASK, DebugType.PARAMETERS); try { try{ JObject query = JObject.Parse(args.Message); string action = query.Value <string>("action"); if (action != null) { JObject extra = query.Value <JObject>("extra"); if (extra != null) { switch (action) { case "connect_irc": IrcWebSocketService.Connect(extra); break; case "sendmessage_irc": IrcWebSocketService.SendMessage(extra); break; } } else { switch (action) { case "get_irc_data": IrcWebSocketService.GetCurrentIrcSettings(); break; case "connect_irc": IrcWebSocketService.Connect(); break; case "disconnect_irc": IrcWebSocketService.Disconnect(); break; case "enablechat_irc": IrcWebSocketService.EnableSendMessage(); break; case "disablechat_irc": IrcWebSocketService.DisableSendMessage(); break; } } } } catch (JsonReaderException e) { DebugHandler.TraceMessage(e.ToString(), DebugSource.TASK, DebugType.WARNING); JsonError error = new JsonError() { type = "command_error", errormessage = "Error happend during parsing of command.", errortype = "exception", exception = e.ToString() }; WebSocketHandler.SendMessage(error.ToJson()); } } catch (Exception e) { DebugHandler.TraceMessage(e.ToString(), DebugSource.TASK, DebugType.ERROR); JsonError error = new JsonError() { type = "command_error", errormessage = "Error happend during execution of command.", errortype = "exception", exception = e.ToString() }; WebSocketHandler.SendMessage(error.ToJson()); } }
public void OnWebSocketEvent(WebSocketEventArgs args) { DebugHandler.TraceMessage("OnWebSocketEvent called", DebugSource.TASK, DebugType.ENTRY_EXIT); DebugHandler.TraceMessage(args.ToString(), DebugSource.TASK, DebugType.PARAMETERS); try { try { JObject query = JObject.Parse(args.Message); string action = query.Value <string>("action"); if (action != null) { JObject extra = query.Value <JObject>("extra"); if (extra != null) { switch (action) { case "get_files_for_anime": InfoApiWebSocketService.GetFilesForAnime(extra); break; case "get_anime_profile": InfoApiWebSocketService.GetAnimeProfile(extra); break; } } else { switch (action) { case "get_currently_airing": InfoApiWebSocketService.GetCurrentlyAiring(); break; } } } } catch (JsonReaderException e) { DebugHandler.TraceMessage(e.ToString(), DebugSource.TASK, DebugType.WARNING); JsonError error = new JsonError() { type = "command_error", errormessage = "Error happend during parsing of command.", errortype = "exception", exception = e.ToString() }; WebSocketHandler.SendMessage(error.ToJson()); } } catch (Exception e) { DebugHandler.TraceMessage(e.ToString(), DebugSource.TASK, DebugType.ERROR); JsonError error = new JsonError() { type = "command_error", errormessage = "Error happend during execution of command.", errortype = "exception", exception = e.ToString() }; WebSocketHandler.SendMessage(error.ToJson()); } }