public ResponseFilter(Stream baseStream, Encoding encoding, IResponseTransformer responseTransformer) { this.encoding = encoding; this.responseTransformer = responseTransformer; BaseStream = baseStream; StartStringUpper = encoding.GetBytes("<HEAD"); StartStringLower = encoding.GetBytes("<head"); StartCloseChar = encoding.GetBytes("> "); EndStringUpper = encoding.GetBytes("</HEAD>"); EndStringLower = encoding.GetBytes("</head>"); }
public ResponseFilter(Stream baseStream, Encoding encoding, IResponseTransformer responseTransformer) { this.encoding = encoding; this.responseTransformer = responseTransformer; BaseStream = baseStream; InitSearchArrays(); okWhenAdjacentToScriptStartUpper = new[] { encoding.GetBytes("<NOSCRIPT"), encoding.GetBytes("<!--") }; okWhenAdjacentToScriptStartLower = new[] { encoding.GetBytes("<noscript"), encoding.GetBytes("<!--") }; okWhenAdjacentToScriptEndUpper = new[] { encoding.GetBytes("</NOSCRIPT>"), encoding.GetBytes("-->") }; okWhenAdjacentToScriptEndLower = new[] { encoding.GetBytes("</noscript>"), encoding.GetBytes("-->") }; currentStartStringsToSkip = new bool[startStringUpper.Length]; startCloseChar = encoding.GetBytes("> "); whiteSpaceChar = encoding.GetBytes("\t\n\r "); }
public ResponseFilter(Stream baseStream, Encoding encoding, IResponseTransformer responseTransformer) { this.encoding = encoding; this.responseTransformer = responseTransformer; BaseStream = baseStream; InitSearchArrays(); okWhenAdjacentToScriptStartUpper = new[] { encoding.GetBytes("<NOSCRIPT"), encoding.GetBytes("<!--") }; okWhenAdjacentToScriptStartLower = new[] { encoding.GetBytes("<noscript"), encoding.GetBytes("<!--") }; okWhenAdjacentToScriptEndUpper = new[] { encoding.GetBytes("</NOSCRIPT>"), encoding.GetBytes("-->") }; okWhenAdjacentToScriptEndLower = new[] { encoding.GetBytes("</noscript>"), encoding.GetBytes("-->") }; currentStartStringsToSkip = new bool[StartStringUpper.Length]; StartCloseChar = encoding.GetBytes("> "); WhiteSpaceChar = encoding.GetBytes("\t\n\r "); }
public ResponseFilter(Stream baseStream, Encoding encoding, IResponseTransformer responseTransformer) { this.encoding = encoding; this.responseTransformer = responseTransformer; BaseStream = baseStream; StartStringUpper = new List<byte[]> { encoding.GetBytes("<HEAD"), encoding.GetBytes("<SCRIPT") }; StartStringLower = new List<byte[]> { encoding.GetBytes("<head"), encoding.GetBytes("<script") }; okWhenAdjacentToScriptStartUpper = new List<byte[]> { encoding.GetBytes("<NOSCRIPT"), encoding.GetBytes("<!--") }; okWhenAdjacentToScriptStartLower = new List<byte[]> { encoding.GetBytes("<noscript"), encoding.GetBytes("<!--") }; okWhenAdjacentToScriptEndUpper = new List<byte[]> { encoding.GetBytes("</NOSCRIPT>"), encoding.GetBytes("-->") }; okWhenAdjacentToScriptEndLower = new List<byte[]> { encoding.GetBytes("</noscript>"), encoding.GetBytes("-->") }; currentStartStringsToSkip = new List<bool>(StartStringUpper.Select(x => false)); StartCloseChar = encoding.GetBytes("> "); WhiteSpaceChar = encoding.GetBytes("\t\n\r "); EndStringUpper = new List<byte[]>{encoding.GetBytes("</HEAD>"), encoding.GetBytes("</SCRIPT>")}; EndStringLower = new List<byte[]>{encoding.GetBytes("</head>"), encoding.GetBytes("</script>")}; }
public object Transform(IActionConfiguration actionConfiguration, object payload) { var enumerable = payload as IEnumerable; if (enumerable == null) { return(null); } IResponseTransformer innerTransformer = null; IList resultList = null; foreach (var item in enumerable) { if (innerTransformer == null) { innerTransformer = actionConfiguration.ResponseTransformerFactory.Get(item); if (innerTransformer == null) { throw new Exception(string.Format("Unable to get response transformer for response type {0}", item.GetType())); } } var transformed = innerTransformer.Transform(actionConfiguration, item); if (transformed == null) { continue; } if (resultList == null) { var resultType = typeof(List <>).MakeGenericType(new [] { transformed.GetType() }); resultList = (IList)Activator.CreateInstance(resultType); } resultList.Add(transformed); } return(resultList); }
public GenresController(ILogger <MoviesController> log, IResponseTransformer transformer, IRepository <Genre> repo) { this.log = log; this.transformer = transformer; this.repo = repo; }
public ActorsController(ILogger <ActorsController> log, IResponseTransformer transformer, IRepository <Actor> repo) { this.log = log; this.transformer = transformer; this.repo = repo; }