public ConcatenatedAsset(IEnumerable<IAsset> children, string separator)
 {
     this.children = children.ToArray();
     this.separator = separator ?? Environment.NewLine;
     stream = CopyAssetsIntoSingleStream(this.children);
     hash = stream.ComputeSHA1Hash();
 }
        byte[] Hash(Stream source)
        {
            // A stylesheet may have its URL values rewritten into absolute form.
            // This makes the stylesheet depend on the application root path.
            // Therefore we include this in the hash so if the application root changes we
            // invalidate the cached modules.
            using (var memory = new MemoryStream())
            {
                source.CopyTo(memory);
                var rootBytes = Encoding.Unicode.GetBytes(applicationRoot);
                memory.Write(rootBytes, 0, rootBytes.Length);
                memory.Position = 0;

                return memory.ComputeSHA1Hash();
            }
        }
Example #3
0
 public ConcatenatedAsset(IEnumerable<IAsset> children)
 {
     this.children = children.ToArray();
     stream = CopyAssetsIntoSingleStream(this.children);
     hash = stream.ComputeSHA1Hash();
 }