public static string Handle(IEnumerable <string> splitContent, Tags.UsedIn usedIn) { if (splitContent.Count() != 1) { return("Error while parsing"); } switch (usedIn) { case Tags.UsedIn.MainDisplay: return("NewLine()"); case Tags.UsedIn.Settings: return("NewLine()"); case Tags.UsedIn.SingleSelection: return("NewLine()"); case Tags.UsedIn.NestedTags: return(string.Empty); case Tags.UsedIn.Pasting: return("\n"); default: throw new ArgumentOutOfRangeException(nameof(usedIn), usedIn, null); } }
public static string Handle(string line, Tags.UsedIn usedIn, Action <string> action, bool changedContentEdited, string changedContent) { switch (changedContentEdited) { case true: /*don't set view.TextBoxChangeableContent.Text since the user changed it.*/ switch (usedIn) { case Tags.UsedIn.MainDisplay: return("ChangeableContent(" + changedContent + ")"); case Tags.UsedIn.NestedTags: return(changedContent); case Tags.UsedIn.Pasting: break; case Tags.UsedIn.Settings: break; case Tags.UsedIn.SingleSelection: break; default: throw new ArgumentOutOfRangeException(nameof(usedIn), usedIn, null); } break; case false: action?.Invoke(line); //sets the text box TextBoxChangeableContent.Text. switch (usedIn) { case Tags.UsedIn.MainDisplay: case Tags.UsedIn.Settings: case Tags.UsedIn.SingleSelection: return("ChangeableContent(" + line + ")"); case Tags.UsedIn.NestedTags: case Tags.UsedIn.Pasting: return(line); default: throw new ArgumentOutOfRangeException(nameof(usedIn), usedIn, null); } } return("Error while parsing"); }
public static string Handle(string line, Tags.UsedIn usedIn) { if (line == null) { return(string.Empty); } if (!ValidUrl(line.Trim())) { return(string.Empty); } switch (usedIn) { case Tags.UsedIn.MainDisplay: case Tags.UsedIn.Settings: try { var client = new WebClient { Timeout = 1500 }; var outData = client.DownloadString(line); client.Dispose(); return(outData); } catch (System.Net.Sockets.SocketException e) { return(e.ToString()); } catch (Exception) { return(string.Empty); //throw; } case Tags.UsedIn.SingleSelection: case Tags.UsedIn.NestedTags: case Tags.UsedIn.Pasting: return(line); default: throw new ArgumentOutOfRangeException(nameof(usedIn), usedIn, null); } }
public static string Handle(IEnumerable <string> splitContent, Tags.UsedIn usedIn) { if (splitContent.Count() != 1) { return("Error while parsing"); } switch (usedIn) { case Tags.UsedIn.MainDisplay: case Tags.UsedIn.Settings: case Tags.UsedIn.SingleSelection: return("Password(************)"); case Tags.UsedIn.NestedTags: case Tags.UsedIn.Pasting: return(CredentialManager.GetCredentials("ClipboardHelper").Password ?? string.Empty); default: throw new ArgumentOutOfRangeException(nameof(usedIn), usedIn, null); } }
public static string Handle(string line, Tags.UsedIn usedIn) { switch (usedIn) { case Tags.UsedIn.MainDisplay: case Tags.UsedIn.Settings: return("ConsoleOpen(" + line + ")"); case Tags.UsedIn.SingleSelection: OpenConsole(line); break; case Tags.UsedIn.NestedTags: case Tags.UsedIn.Pasting: return(string.Empty); default: throw new ArgumentOutOfRangeException(nameof(usedIn), usedIn, null); } return("Error while parsing"); }