Beispiel #1
0
        public Benchmark([Optional] string benchmarkName)
        {
            HttpServerUtilityWrapper = new HttpServerUtilityWrapper(HttpContext.Current.Server);
            FileSystemRepository     = new FileSystemRepository(HttpServerUtilityWrapper, BenchmarkFolder);
            BenchmarkName            = benchmarkName ?? $"{HttpServerUtilityWrapper.MachineName}_Benchmark";

            (List <ActionResultBenchmark> result, bool hasLoaded, _) = FileSystemRepository.LoadJsonFile <List <ActionResultBenchmark> >(BenchmarkName);
            Benchmarks = hasLoaded ? result : new List <ActionResultBenchmark>();
        }
Beispiel #2
0
        protected void Application_Start(object sender, EventArgs e)
        {
            if (Debugger.IsAttached)
            {
                BasicConfigurator.Configure();
            }
            else
            {
                XmlConfigurator.Configure();
            }
            HttpServerUtilityBase wrapperServer = new HttpServerUtilityWrapper(Server);

            Settings.Init(wrapperServer);
        }
        public async Task <IHttpActionResult> Upload()
        {
            if (!Request.Content.IsMimeMultipartContent())
            {
                this.Request.CreateResponse(HttpStatusCode.UnsupportedMediaType);
            }
            string subpath    = "/" + DateTime.Now.Year.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Day.ToString() + "/";
            string uploadpath = "~/images" + subpath;

            var var = Directory.Exists(uploadpath);


            var localFilePath = new HttpServerUtilityWrapper(HttpContext.Current.Server).MapPath(uploadpath);

            var directory = System.IO.Path.GetDirectoryName(localFilePath);

            if (!System.IO.Directory.Exists(localFilePath))
            {
                System.IO.Directory.CreateDirectory(directory);
            }



            var uploadProcessor = new FlowUploadProcessor(uploadpath);
            await uploadProcessor.ProcessUploadChunkRequest(Request);

            if (uploadProcessor.IsComplete)
            {
                // Do post processing here:
                // - Move the file to a permanent location
                // - Persist information to a database
                // - Raise an event to signal it was completed (if you are really feeling up to it)
                //      - http://www.udidahan.com/2009/06/14/domain-\events-salvation/
                //      - http://msdn.microsoft.com/en-gb/magazine/ee236415.aspx#id0400079
            }

            return(Ok());
        }
 public PageWwtContext(Page page)
 {
     Request  = new HttpRequestWrapper(page.Request);
     Response = new HttpResponseWrapper(page.Response);
     Server   = new HttpServerUtilityWrapper(page.Server);
 }