// /** // * File: SkySpotApplication.cs // * Author: haraldwolff // * // * This file and it's content is copyrighted by the Author and / or copyright holder. // * Any use wihtout proper permission is illegal and may lead to legal actions. // * // * // **/ using System; using ln.http.resources; using System.IO; namespace skyspot.http { public class SkySpotApplication : ResourceApplication { public String TemplatePath { get; private set; } public SkySpotApplication() :this(Path.Combine(Environment.CurrentDirectory,"www")) {} public SkySpotApplication(String templatePath) { /* Development Shortcut */ if (Directory.Exists("../../www")) templatePath = "../../www"; TemplatePath = Path.GetFullPath(templatePath); DirectoryResource templates = new DirectoryResource(TemplatePath); templates.ResourceTypeHook = ResourceTypeHook; RootResource = templates; } private Resource ResourceTypeHook(DirectoryResource directoryResource, FileInfo fileInfo) { if (fileInfo.Extension.Equals(".html")) return new TemplateResource(directoryResource, fileInfo.FullName); return null; } } }