예제 #1
0
        public PipelineData Process(PipelineData Input)
        {
            HttpListenerRoutedContext context = Input.PrimaryData as HttpListenerRoutedContext;
            var         path0 = context.Request.Url.LocalPath.Substring(1);
            StorageItem Result;

            if (context.Request.HttpMethod == HttpMethod.Get.Method)
            {
                if (ApplicationStorage.ObtainItemFromRelativeURL(path0, out Result, false))
                {
                    if (Result.StorageItemType == StorageItemType.Folder)
                    {
                        StorageFile DefaultPage;
                        if (((StorageFolder)Result).GetFile(GlobalConfiguration.GetDefaultPage(LWMSCoreServer.TrustedInstallerAuth), out DefaultPage, false))
                        {
                            Tools00.SendFile(context, DefaultPage);
                            (Input.SecondaryData as HttpPipelineArguments).isHandled = true;
                            return(Input);
                        }
                    }
                    else
                    {
                        Tools00.SendFile(context, Result.ToStorageFile());
                        (Input.SecondaryData as HttpPipelineArguments).isHandled = true;
                        return(Input);
                    }
                }
            }
            return(Input);
        }
예제 #2
0
        public PipelineData Process(PipelineData Input)
        {
            HttpListenerRoutedContext context = Input.PrimaryData as HttpListenerRoutedContext;
            var path0 = context.Request.Url.LocalPath.Substring(1);
            var path1 = Path.Combine(GlobalConfiguration.GetWebSiteContentRoot(context.PipelineAuth), path0);

            if (Directory.Exists(path1))
            {
                var DefaultPage = Path.Combine(path1, GlobalConfiguration.GetDefaultPage(context.PipelineAuth));
                if (File.Exists(DefaultPage))
                {
                    if (path1.EndsWith("htm") || path1.EndsWith("html"))
                    {
                        ProcessContent(context, DefaultPage);

                        (Input.SecondaryData as HttpPipelineArguments).isHandled = true;
                    }
                }
                else
                {
                }
            }
            else
            {
                if (File.Exists(path1))
                {
                    if (path1.EndsWith("htm") || path1.EndsWith("html"))
                    {
                        ProcessContent(context, path1);
                        (Input.SecondaryData as HttpPipelineArguments).isHandled = true;
                    }
                }
                else
                {
                }
                //Console.WriteLine("Directory Not Found.");
            }
            return(Input);
        }