示例#1
0
        internal ApplicationSetting(IHttpSite httpSite)
        {
            var conf = httpSite.Config;

            MaxUploadFileLength = conf.GetInt64(MaxUploadFileLengthProperty, DefaultMaxUploadFileLength);
            MaxPostLength       = conf.GetInt64(MaxPostLengthProperty, DefaultMaxPostLength);
        }
示例#2
0
        public ScriptEngines(IHttpSite httpSite, Config conf)
        {
            if (httpSite == null)
            {
                throw new ArgumentNullException(nameof(httpSite));
            }
            if (conf == null)
            {
                throw new ArgumentNullException(nameof(conf));
            }

            var baseDirectory = AppDomain.CurrentDomain.BaseDirectory;

            this.httpSite    = httpSite;
            this.conf        = conf;
            runtimeDirectory = Path.Combine(baseDirectory, "Runtime");

            isDebug          = conf.GetBoolean(IsDebugProperty, DefaultIsDebug);
            sessionDirectory = conf.GetString(SessionDirectoryProperty, DefaultSession);
            sessionDirectory = Path.Combine(baseDirectory, sessionDirectory);
            sessionTimeout   = conf.GetTimeSpan(SessionTimeoutProperty, DefaultSessionTimeout);
            if (Directory.Exists(sessionDirectory))
            {
                Directory.Delete(sessionDirectory, true);
            }
            if (!Directory.Exists(runtimeDirectory))
            {
                Directory.CreateDirectory(runtimeDirectory);
            }
            Directory.CreateDirectory(sessionDirectory);
            var interval = conf.GetTimeSpan(SessionCheckIntervalProperty, DefaultSessionCheckInterval);

            timer = new Timer(new TimerCallback(CheckSession), null, TimeSpan.Zero, interval);
        }
示例#3
0
        public static FileInfo GetFileInfo(IHttpSite httpSite, string rawUrl)
        {
            var path = GetLocalPath(rawUrl);

            if (path.StartsWith(BackSlashString))
            {
                path = path.TrimStart(BackSlashChar);
            }

            var dir   = new DirectoryInfo(httpSite.BaseDirectory);
            var files = dir.GetFiles(path);

            if (files.Length > 1)
            {
                throw new ArgumentException(nameof(rawUrl));
            }

            return(files.FirstOrDefault());
        }
示例#4
0
 public override bool IsMath(IHttpSite httpSite, string rawUrl)
 {
     return(IsMatchExtension(rawUrl) && HttpUtility.GetFileInfo(httpSite, rawUrl) != null);
 }
示例#5
0
 public HttpContext(IHttpSite site, HttpListenerContext httpContext, string rawUrl)
 {
     this.site        = site;
     this.httpContext = httpContext;
     this.rawUrl      = rawUrl;
 }
示例#6
0
 public abstract bool IsMath(IHttpSite httpSite, string rawUrl);