-// Copyright 2011-2013 Microsoft Open Technologies, Inc. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.Owin;
diff --git a/src/Microsoft.Owin.Diagnostics/WelcomePageMiddleware.cs b/src/Microsoft.Owin.Diagnostics/WelcomePageMiddleware.cs
index cbe48d525..2994b9426 100644
--- a/src/Microsoft.Owin.Diagnostics/WelcomePageMiddleware.cs
+++ b/src/Microsoft.Owin.Diagnostics/WelcomePageMiddleware.cs
@@ -1,32 +1,21 @@
-//
-// Copyright 2011-2013 Microsoft Open Technologies, Inc. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+// Copyright (c) .NET Foundation. 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.Globalization;
-using System.Text;
+using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Owin.Diagnostics.Views;
namespace Microsoft.Owin.Diagnostics
{
+ using AppFunc = Func, Task>;
+
///
/// This middleware provides a default web page for new applications.
///
- public class WelcomePageMiddleware : OwinMiddleware
+ public class WelcomePageMiddleware
{
+ private readonly AppFunc _next;
private readonly WelcomePageOptions _options;
///
@@ -34,28 +23,29 @@ public class WelcomePageMiddleware : OwinMiddleware
///
///
///
- public WelcomePageMiddleware(OwinMiddleware next, WelcomePageOptions options)
- : base(next)
+ public WelcomePageMiddleware(AppFunc next, WelcomePageOptions options)
{
+ if (next == null)
+ {
+ throw new ArgumentNullException("next");
+ }
if (options == null)
{
throw new ArgumentNullException("options");
}
+ _next = next;
_options = options;
}
///
- ///
+ /// Process an individual request.
///
- ///
+ ///
///
- public override Task Invoke(IOwinContext context)
+ public Task Invoke(IDictionary environment)
{
- if (context == null)
- {
- throw new ArgumentNullException("context");
- }
+ IOwinContext context = new OwinContext(environment);
IOwinRequest request = context.Request;
if (!_options.Path.HasValue || _options.Path == request.Path)
@@ -63,10 +53,10 @@ public override Task Invoke(IOwinContext context)
// Dynamically generated for LOC.
var welcomePage = new WelcomePage();
welcomePage.Execute(context);
- return TaskHelpers.Completed();
+ return Task.FromResult(0);
}
- return Next.Invoke(context);
+ return _next(environment);
}
}
}
diff --git a/src/Microsoft.Owin.Diagnostics/WelcomePageOptions.cs b/src/Microsoft.Owin.Diagnostics/WelcomePageOptions.cs
index 8179d5375..27757c2c3 100644
--- a/src/Microsoft.Owin.Diagnostics/WelcomePageOptions.cs
+++ b/src/Microsoft.Owin.Diagnostics/WelcomePageOptions.cs
@@ -1,18 +1,5 @@
-//
-// Copyright 2011-2013 Microsoft Open Technologies, Inc. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.Owin.Diagnostics
{
diff --git a/src/Microsoft.Owin.Diagnostics/packages.config b/src/Microsoft.Owin.Diagnostics/packages.config
deleted file mode 100644
index 48f5cd1c4..000000000
--- a/src/Microsoft.Owin.Diagnostics/packages.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Microsoft.Owin.FileSystems/EmbeddedResourceFileSystem.cs b/src/Microsoft.Owin.FileSystems/EmbeddedResourceFileSystem.cs
index b67e6d45f..c9445b68b 100644
--- a/src/Microsoft.Owin.FileSystems/EmbeddedResourceFileSystem.cs
+++ b/src/Microsoft.Owin.FileSystems/EmbeddedResourceFileSystem.cs
@@ -1,4 +1,5 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
+// Copyright (c) .NET Foundation. 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.Collections.Generic;
@@ -8,7 +9,8 @@
namespace Microsoft.Owin.FileSystems
{
///
- /// Looks up files using embedded resources in the specified assembly
+ /// Looks up files using embedded resources in the specified assembly.
+ /// This file system is case sensitive.
///
public class EmbeddedResourceFileSystem : IFileSystem
{
@@ -17,8 +19,8 @@ public class EmbeddedResourceFileSystem : IFileSystem
private readonly DateTime _lastModified;
///
- /// Initializes a new instance of the class using the calling
- /// assembly and empty base namespace.
+ /// Initializes a new instance of the class using the calling
+ /// assembly and empty base namespace.
///
public EmbeddedResourceFileSystem()
: this(Assembly.GetCallingAssembly())
@@ -26,8 +28,8 @@ public EmbeddedResourceFileSystem()
}
///
- /// Initializes a new instance of the class using the specified
- /// assembly and empty base namespace.
+ /// Initializes a new instance of the class using the specified
+ /// assembly and empty base namespace.
///
///
public EmbeddedResourceFileSystem(Assembly assembly)
@@ -36,8 +38,8 @@ public EmbeddedResourceFileSystem(Assembly assembly)
}
///
- /// Initializes a new instance of the class using the calling
- /// assembly and specified base namespace.
+ /// Initializes a new instance of the class using the calling
+ /// assembly and specified base namespace.
///
/// The base namespace that contains the embedded resources.
public EmbeddedResourceFileSystem(string baseNamespace)
@@ -46,8 +48,8 @@ public EmbeddedResourceFileSystem(string baseNamespace)
}
///
- /// Initializes a new instance of the class using the specified
- /// assembly and root namespace.
+ /// Initializes a new instance of the class using the specified
+ /// assembly and base namespace.
///
/// The assembly that contains the embedded resources.
/// The base namespace that contains the embedded resources.
@@ -62,9 +64,15 @@ public EmbeddedResourceFileSystem(Assembly assembly, string baseNamespace)
_lastModified = new FileInfo(assembly.Location).LastWriteTime;
}
- // "/file.txt" expected.
+ ///
+ /// Locate a file at the given path
+ ///
+ /// The path that identifies the file
+ /// The discovered file if any
+ /// True if a file was located at the given path
public bool TryGetFileInfo(string subpath, out IFileInfo fileInfo)
{
+ // "/file.txt" expected.
if (string.IsNullOrEmpty(subpath) || subpath[0] != '/')
{
fileInfo = null;
@@ -72,7 +80,8 @@ public bool TryGetFileInfo(string subpath, out IFileInfo fileInfo)
}
string fileName = subpath.Substring(1); // Drop the leading '/'
- string resourcePath = _baseNamespace + fileName;
+ string resourcePath = _baseNamespace + fileName.Replace('/', '.');
+
if (_assembly.GetManifestResourceInfo(resourcePath) == null)
{
fileInfo = null;
@@ -82,10 +91,17 @@ public bool TryGetFileInfo(string subpath, out IFileInfo fileInfo)
return true;
}
- // Uses a flat directory structure. Everything under the base namespace is considered to be one directory.
- // The file name is assumed to be the remainder of the resource name.
+ ///
+ /// Enumerate a directory at the given path, if any.
+ /// This file system uses a flat directory structure. Everything under the base namespace is considered to be one directory.
+ ///
+ /// The path that identifies the directory
+ /// The contents if any
+ /// True if a directory was located at the given path
public bool TryGetDirectoryContents(string subpath, out IEnumerable contents)
{
+ // The file name is assumed to be the remainder of the resource name.
+
// Non-hierarchal.
if (!subpath.Equals("/"))
{
diff --git a/src/Microsoft.Owin.FileSystems/IFileInfo.cs b/src/Microsoft.Owin.FileSystems/IFileInfo.cs
index 48e258861..a338d790c 100644
--- a/src/Microsoft.Owin.FileSystems/IFileInfo.cs
+++ b/src/Microsoft.Owin.FileSystems/IFileInfo.cs
@@ -1,18 +1,5 @@
-//
-// Copyright 2011-2013 Microsoft Open Technologies, Inc. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+// Copyright (c) .NET Foundation. 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.IO;
diff --git a/src/Microsoft.Owin.FileSystems/IFileSystem.cs b/src/Microsoft.Owin.FileSystems/IFileSystem.cs
index 2c98eacdd..4f8255ba9 100644
--- a/src/Microsoft.Owin.FileSystems/IFileSystem.cs
+++ b/src/Microsoft.Owin.FileSystems/IFileSystem.cs
@@ -1,18 +1,5 @@
-//
-// Copyright 2011-2013 Microsoft Open Technologies, Inc. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
diff --git a/src/Microsoft.Owin.FileSystems/Microsoft.Owin.FileSystems.csproj b/src/Microsoft.Owin.FileSystems/Microsoft.Owin.FileSystems.csproj
index f51e81485..88fb03bfb 100644
--- a/src/Microsoft.Owin.FileSystems/Microsoft.Owin.FileSystems.csproj
+++ b/src/Microsoft.Owin.FileSystems/Microsoft.Owin.FileSystems.csproj
@@ -1,61 +1,8 @@
-
-
-
-
- Debug
- AnyCPU
- {63988A9B-FA70-4BBA-8C7E-784145384F7C}
- Library
- Properties
- Microsoft.Owin.FileSystems
- Microsoft.Owin.FileSystems
- v4.0
- 512
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- true
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
- bin\Release\Microsoft.Owin.FileSystems.XML
-
-
-
-
-
-
-
-
- Properties\DevAssemblyInfo.cs
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ Library
+ Microsoft.Owin.FileSystems
+ net4.5
+ This package contains file system abstractions and implementations.
+
\ No newline at end of file
diff --git a/src/Microsoft.Owin.FileSystems/Microsoft.Owin.FileSystems.nuspec b/src/Microsoft.Owin.FileSystems/Microsoft.Owin.FileSystems.nuspec
deleted file mode 100644
index 85ceebd07..000000000
--- a/src/Microsoft.Owin.FileSystems/Microsoft.Owin.FileSystems.nuspec
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
- $id$
- $version$
- $authors$
- $authors$
- $licenseUrl$
- $projectUrl$
- true
- Codestin Search App
- $description$
- $tags$
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Microsoft.Owin.FileSystems/PhysicalFileSystem.cs b/src/Microsoft.Owin.FileSystems/PhysicalFileSystem.cs
index e63d481c5..3e6b00443 100644
--- a/src/Microsoft.Owin.FileSystems/PhysicalFileSystem.cs
+++ b/src/Microsoft.Owin.FileSystems/PhysicalFileSystem.cs
@@ -1,18 +1,5 @@
-//
-// Copyright 2011-2013 Microsoft Open Technologies, Inc. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+// Copyright (c) .NET Foundation. 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.Collections.Generic;
@@ -54,7 +41,7 @@ public class PhysicalFileSystem : IFileSystem
};
///
- ///
+ /// Creates a new instance of a PhysicalFileSystem at the given root directory.
///
/// The root directory
public PhysicalFileSystem(string root)
@@ -67,7 +54,7 @@ public PhysicalFileSystem(string root)
}
///
- ///
+ /// The root directory for this instance.
///
public string Root { get; private set; }
@@ -85,16 +72,23 @@ private static string GetFullRoot(string root)
private string GetFullPath(string path)
{
- var fullPath = Path.GetFullPath(Path.Combine(Root, path));
- if (!fullPath.StartsWith(Root, StringComparison.OrdinalIgnoreCase))
+ try
+ {
+ var fullPath = Path.GetFullPath(Path.Combine(Root, path));
+ if (!fullPath.StartsWith(Root, StringComparison.OrdinalIgnoreCase))
+ {
+ return null;
+ }
+ return fullPath;
+ }
+ catch
{
return null;
}
- return fullPath;
}
///
- ///
+ /// Locate a file at the given path by directly mapping path segments to physical directories.
///
/// A path under the root directory
/// The discovered file, if any
@@ -126,7 +120,7 @@ public bool TryGetFileInfo(string subpath, out IFileInfo fileInfo)
}
///
- ///
+ /// Enumerate a directory at the given path, if any.
///
/// A path under the root directory
/// The discovered directories, if any
diff --git a/src/Microsoft.Owin.FileSystems/Properties/AssemblyInfo.cs b/src/Microsoft.Owin.FileSystems/Properties/AssemblyInfo.cs
index fbdc508cc..a621886d7 100644
--- a/src/Microsoft.Owin.FileSystems/Properties/AssemblyInfo.cs
+++ b/src/Microsoft.Owin.FileSystems/Properties/AssemblyInfo.cs
@@ -1,39 +1,6 @@
-//
-// Copyright 2011-2013 Microsoft Open Technologies, Inc. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+// Copyright (c) .NET Foundation. 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.Reflection;
-using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-
-[assembly: AssemblyTitle("Microsoft.Owin.FileSystems")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-
-[assembly: Guid("2f02593f-10c1-474c-ac79-380789e1a6fe")]
[assembly: CLSCompliant(true)]
diff --git a/src/Microsoft.Owin.Host.HttpListener/App_Packages/TaskHelpers.Sources.0.3/TaskHelpers.cs b/src/Microsoft.Owin.Host.HttpListener/App_Packages/TaskHelpers.Sources.0.3/TaskHelpers.cs
deleted file mode 100644
index ea01b7475..000000000
--- a/src/Microsoft.Owin.Host.HttpListener/App_Packages/TaskHelpers.Sources.0.3/TaskHelpers.cs
+++ /dev/null
@@ -1,396 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
-using System.Diagnostics.Contracts;
-
-namespace System.Threading.Tasks
-{
- //
- // Helpers for safely using Task libraries.
- //
- internal static class TaskHelpers
- {
- private static readonly Task _defaultCompleted = FromResult(default(AsyncVoid));
-
- private static readonly Task