diff --git a/src/Microsoft.AspNet.StaticFiles/Resources.Designer.cs b/src/Microsoft.AspNet.StaticFiles/Resources.Designer.cs
index 8207987f63..dd2bc337ec 100644
--- a/src/Microsoft.AspNet.StaticFiles/Resources.Designer.cs
+++ b/src/Microsoft.AspNet.StaticFiles/Resources.Designer.cs
@@ -1,144 +1,158 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.34006
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
+//
+namespace Microsoft.AspNet.StaticFiles
+{
+ using System.Globalization;
+ using System.Reflection;
+ using System.Resources;
+
+ internal static class Resources
+ {
+ private static readonly ResourceManager _resourceManager
+ = new ResourceManager("Microsoft.AspNet.StaticFiles.Resources", typeof(Resources).GetTypeInfo().Assembly);
-namespace Microsoft.AspNet.StaticFiles {
- using System;
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources() {
- }
-
///
- /// Returns the cached ResourceManager instance used by this class.
+ /// No IContentTypeProvider was specified.
///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.AspNet.StaticFiles.Resources", System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(Resources)).Assembly);
- resourceMan = temp;
+ internal static string Args_NoContentTypeProvider
+ {
+ get { return GetString("Args_NoContentTypeProvider"); }
+ }
+
+ ///
+ /// No IContentTypeProvider was specified.
+ ///
+ internal static string FormatArgs_NoContentTypeProvider()
+ {
+ return GetString("Args_NoContentTypeProvider");
+ }
+
+ ///
+ /// No formatter provided.
+ ///
+ internal static string Args_NoFormatter
+ {
+ get { return GetString("Args_NoFormatter"); }
+ }
+
+ ///
+ /// No formatter provided.
+ ///
+ internal static string FormatArgs_NoFormatter()
+ {
+ return GetString("Args_NoFormatter");
+ }
+
+ ///
+ /// Index of
+ ///
+ internal static string HtmlDir_IndexOf
+ {
+ get { return GetString("HtmlDir_IndexOf"); }
+ }
+
+ ///
+ /// Index of
+ ///
+ internal static string FormatHtmlDir_IndexOf()
+ {
+ return GetString("HtmlDir_IndexOf");
+ }
+
+ ///
+ /// Last Modified
+ ///
+ internal static string HtmlDir_LastModified
+ {
+ get { return GetString("HtmlDir_LastModified"); }
+ }
+
+ ///
+ /// Last Modified
+ ///
+ internal static string FormatHtmlDir_LastModified()
+ {
+ return GetString("HtmlDir_LastModified");
+ }
+
+ ///
+ /// Modified
+ ///
+ internal static string HtmlDir_Modified
+ {
+ get { return GetString("HtmlDir_Modified"); }
+ }
+
+ ///
+ /// Modified
+ ///
+ internal static string FormatHtmlDir_Modified()
+ {
+ return GetString("HtmlDir_Modified");
+ }
+
+ ///
+ /// Name
+ ///
+ internal static string HtmlDir_Name
+ {
+ get { return GetString("HtmlDir_Name"); }
+ }
+
+ ///
+ /// Name
+ ///
+ internal static string FormatHtmlDir_Name()
+ {
+ return GetString("HtmlDir_Name");
+ }
+
+ ///
+ /// Size
+ ///
+ internal static string HtmlDir_Size
+ {
+ get { return GetString("HtmlDir_Size"); }
+ }
+
+ ///
+ /// Size
+ ///
+ internal static string FormatHtmlDir_Size()
+ {
+ return GetString("HtmlDir_Size");
+ }
+
+ ///
+ /// The list of files in the given directory. Column headers are listed in the first row.
+ ///
+ internal static string HtmlDir_TableSummary
+ {
+ get { return GetString("HtmlDir_TableSummary"); }
+ }
+
+ ///
+ /// The list of files in the given directory. Column headers are listed in the first row.
+ ///
+ internal static string FormatHtmlDir_TableSummary()
+ {
+ return GetString("HtmlDir_TableSummary");
+ }
+
+ private static string GetString(string name, params string[] formatterNames)
+ {
+ var value = _resourceManager.GetString(name);
+
+ System.Diagnostics.Debug.Assert(value != null);
+
+ if (formatterNames != null)
+ {
+ for (var i = 0; i < formatterNames.Length; i++)
+ {
+ value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}");
}
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- ///
- /// Looks up a localized string similar to No IContentTypeProvider was specified..
- ///
- internal static string Args_NoContentTypeProvider {
- get {
- return ResourceManager.GetString("Args_NoContentTypeProvider", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to No formatter provided..
- ///
- internal static string Args_NoFormatter {
- get {
- return ResourceManager.GetString("Args_NoFormatter", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to This server does not support the sendfile.SendAsync extension..
- ///
- internal static string Exception_SendFileNotSupported {
- get {
- return ResourceManager.GetString("Exception_SendFileNotSupported", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Index of.
- ///
- internal static string HtmlDir_IndexOf {
- get {
- return ResourceManager.GetString("HtmlDir_IndexOf", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Last Modified.
- ///
- internal static string HtmlDir_LastModified {
- get {
- return ResourceManager.GetString("HtmlDir_LastModified", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Modified.
- ///
- internal static string HtmlDir_Modified {
- get {
- return ResourceManager.GetString("HtmlDir_Modified", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Name.
- ///
- internal static string HtmlDir_Name {
- get {
- return ResourceManager.GetString("HtmlDir_Name", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Size.
- ///
- internal static string HtmlDir_Size {
- get {
- return ResourceManager.GetString("HtmlDir_Size", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The list of files in the given directory. Column headers are listed in the first row..
- ///
- internal static string HtmlDir_TableSummary {
- get {
- return ResourceManager.GetString("HtmlDir_TableSummary", resourceCulture);
}
+
+ return value;
}
}
}
diff --git a/src/Microsoft.AspNet.StaticFiles/Resources.resx b/src/Microsoft.AspNet.StaticFiles/Resources.resx
index 6c58583e87..d6df934382 100644
--- a/src/Microsoft.AspNet.StaticFiles/Resources.resx
+++ b/src/Microsoft.AspNet.StaticFiles/Resources.resx
@@ -123,9 +123,6 @@
No formatter provided.
-
- This server does not support the sendfile.SendAsync extension.
-
Index of
diff --git a/src/Microsoft.AspNet.StaticFiles/SendFileResponseExtensions.cs b/src/Microsoft.AspNet.StaticFiles/SendFileResponseExtensions.cs
deleted file mode 100644
index 2c15097a8f..0000000000
--- a/src/Microsoft.AspNet.StaticFiles/SendFileResponseExtensions.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.AspNet.Http;
-
-namespace Microsoft.AspNet.StaticFiles
-{
- ///
- /// Provides extensions for HttpResponse exposing the SendFile extension.
- ///
- public static class SendFileResponseExtensions
- {
- ///
- /// Checks if the SendFile extension is supported.
- ///
- ///
- /// True if sendfile.SendAsync is defined in the environment.
- public static bool SupportsSendFile([NotNull] this HttpResponse response)
- {
- return response.HttpContext.GetFeature() != null;
- }
-
- ///
- /// Sends the given file using the SendFile extension.
- ///
- ///
- ///
- ///
- public static Task SendFileAsync([NotNull] this HttpResponse response, [NotNull] string fileName)
- {
- return response.SendFileAsync(fileName, 0, null, CancellationToken.None);
- }
-
- ///
- /// Sends the given file using the SendFile extension.
- ///
- ///
- /// The full or relative path to the file.
- /// The offset in the file.
- /// The number of types to send, or null to send the remainder of the file.
- ///
- ///
- public static Task SendFileAsync([NotNull] this HttpResponse response, [NotNull] string fileName, long offset, long? count, CancellationToken cancellationToken)
- {
- var sendFile = response.HttpContext.GetFeature();
- if (sendFile == null)
- {
- throw new NotSupportedException(Resources.Exception_SendFileNotSupported);
- }
-
- return sendFile.SendFileAsync(fileName, offset, count, cancellationToken);
- }
- }
-}
diff --git a/test/Microsoft.AspNet.StaticFiles.Tests/SendFileResponseExtensionsTests.cs b/test/Microsoft.AspNet.StaticFiles.Tests/SendFileResponseExtensionsTests.cs
deleted file mode 100644
index 523b824352..0000000000
--- a/test/Microsoft.AspNet.StaticFiles.Tests/SendFileResponseExtensionsTests.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.AspNet.Http.Core;
-using Microsoft.AspNet.Http;
-using Xunit;
-
-namespace Microsoft.AspNet.StaticFiles
-{
- public class SendFileResponseExtensionsTests
- {
- [Fact]
- public void SendFileSupport()
- {
- var context = new DefaultHttpContext();
- var response = context.Response;
- Assert.False(response.SupportsSendFile());
- context.SetFeature(new FakeSendFileFeature());
- Assert.True(response.SupportsSendFile());
- }
-
- [Fact]
- public Task SendFileWhenNotSupported()
- {
- var response = new DefaultHttpContext().Response;
- return Assert.ThrowsAsync(() => response.SendFileAsync("foo"));
- }
-
- [Fact]
- public async Task SendFileWorks()
- {
- var context = new DefaultHttpContext();
- var response = context.Response;
- var fakeFeature = new FakeSendFileFeature();
- context.SetFeature(fakeFeature);
-
- await response.SendFileAsync("bob", 1, 3, CancellationToken.None);
-
- Assert.Equal("bob", fakeFeature.name);
- Assert.Equal(1, fakeFeature.offset);
- Assert.Equal(3, fakeFeature.length);
- Assert.Equal(CancellationToken.None, fakeFeature.token);
- }
-
- private class FakeSendFileFeature : IHttpSendFileFeature
- {
- public string name = null;
- public long offset = 0;
- public long? length = null;
- public CancellationToken token;
-
- public Task SendFileAsync(string path, long offset, long? length, CancellationToken cancellation)
- {
- this.name = path;
- this.offset = offset;
- this.length = length;
- this.token = cancellation;
- return Task.FromResult(0);
- }
- }
- }
-}