public void ParseResponse(UploadResult result, CustomUploaderInput input, bool isShortenedURL = false) { if (result != null && !string.IsNullOrEmpty(result.Response)) { CustomUploaderParser parser = new CustomUploaderParser(result.Response, RegexList); parser.Filename = input.Filename; parser.URLEncode = true; string url; if (!string.IsNullOrEmpty(URL)) { url = parser.Parse(URL); } else { url = parser.Response; } if (isShortenedURL) { result.ShortenedURL = url; } else { result.URL = url; } result.ThumbnailURL = parser.Parse(ThumbnailURL); result.DeletionURL = parser.Parse(DeletionURL); } }
public string GetData(CustomUploaderInput input) { CustomUploaderParser parser = new CustomUploaderParser(input); parser.UseNameParser = true; parser.JSONEncode = RequestFormat == CustomUploaderRequestFormat.JSON; return(parser.Parse(Data)); }
public string GetRequestURL(CustomUploaderInput input) { if (string.IsNullOrEmpty(RequestURL)) { throw new Exception(Resources.CustomUploaderItem_GetRequestURL_RequestURLMustBeConfigured); } CustomUploaderParser parser = new CustomUploaderParser(input); parser.URLEncode = true; string url = parser.Parse(RequestURL); return(URLHelpers.FixPrefix(url)); }
public Dictionary <string, string> GetArguments(CustomUploaderInput input) { Dictionary <string, string> arguments = new Dictionary <string, string>(); if (Arguments != null) { CustomUploaderParser parser = new CustomUploaderParser(input); parser.UseNameParser = true; foreach (KeyValuePair <string, string> arg in Arguments) { arguments.Add(arg.Key, parser.Parse(arg.Value)); } } return(arguments); }
public NameValueCollection GetHeaders(CustomUploaderInput input) { if (Headers != null && Headers.Count > 0) { NameValueCollection collection = new NameValueCollection(); CustomUploaderParser parser = new CustomUploaderParser(input); parser.UseNameParser = true; foreach (KeyValuePair <string, string> header in Headers) { collection.Add(header.Key, parser.Parse(header.Value)); } return(collection); } return(null); }
public CustomUploaderParser(CustomUploaderInput input) : this(input.Filename, input.Input) { }
public CustomUploaderSyntaxParser(CustomUploaderInput input) { FileName = input.FileName; Input = input.Input; }