using System; using System.Collections.Generic; using System.Linq; namespace Mtp2Dav.WebDAVSharp.Server._1d2086a502937936ebc6bfe19cfa15d855be1c31.MethodHandlers { /// /// This class contains code to produce the built-in /// instances known by WebDAV#. /// internal static class WebDavMethodHandlers { private static readonly List _BuiltIn = new List(); /// /// Gets the collection of built-in /// HTTP method handler instances. /// public static IEnumerable BuiltIn { get { lock (_BuiltIn) { if (_BuiltIn.Count == 0) ScanAssemblies(); } return _BuiltIn; } } /// /// Scans the WebDAV# assemblies for known /// types. /// private static void ScanAssemblies() { var methodHandlerTypes = from type in typeof (WebDavServer).Assembly.GetTypes() where !type.IsAbstract where typeof (IWebDavMethodHandler).IsAssignableFrom(type) select type; var methodHandlerInstances = from type in methodHandlerTypes select (IWebDavMethodHandler) Activator.CreateInstance(type); _BuiltIn.AddRange(methodHandlerInstances); } } }