Beispiel #1
0
        // Token: 0x0600003C RID: 60 RVA: 0x00003DA0 File Offset: 0x00001FA0
        public static void WriteCookie(string strName, string strValue)
        {
            HttpCookie httpCookie = HttpContext.Current.Request.Cookies["wms"];

            if (httpCookie == null)
            {
                httpCookie = new HttpCookie("wms");
                httpCookie.Values[strName] = FPUtils.UrlEncode(strValue);
            }
            else
            {
                httpCookie.Values[strName] = FPUtils.UrlEncode(strValue);
                if (HttpContext.Current.Request.Cookies["wms"]["expires"] != null)
                {
                    int num = FPUtils.StrToInt(HttpContext.Current.Request.Cookies["wms"]["expires"].ToString(), 0);
                    if (num > 0)
                    {
                        httpCookie.Expires = DateTime.Now.AddMinutes((double)FPUtils.StrToInt(HttpContext.Current.Request.Cookies["wms"]["expires"].ToString(), 0));
                    }
                }
            }
            string text = SysConfigs.GetConfig().cookiedomain.Trim();

            if (text != string.Empty && HttpContext.Current.Request.Url.Host.IndexOf(text.TrimStart(new char[]
            {
                '.'
            })) > -1 && WMSUtils.IsValidDomain(HttpContext.Current.Request.Url.Host))
            {
                httpCookie.Domain = text;
            }
            HttpContext.Current.Response.AppendCookie(httpCookie);
        }
Beispiel #2
0
        // Token: 0x0600004D RID: 77 RVA: 0x00004C10 File Offset: 0x00002E10
        public static long DirSize(string strPath)
        {
            long result;

            try
            {
                DirectoryInfo d = new DirectoryInfo(FPUtils.GetMapPath(strPath));
                result = WMSUtils.DirSize(d);
            }
            catch
            {
                result = 0L;
            }
            return(result);
        }
Beispiel #3
0
        // Token: 0x0600028A RID: 650 RVA: 0x000097D4 File Offset: 0x000079D4
        public static long GetSysSize()
        {
            object obj = FPCache.Get("CACHE_SYSSIZE");
            long   num;

            if (obj == null)
            {
                num = WMSUtils.DirSize(WebConfig.WebPath);
                FPCache.Insert("CACHE_SYSSIZE", num, 10);
            }
            else
            {
                num = (long)obj;
            }
            return(num);
        }
Beispiel #4
0
        // Token: 0x0600004E RID: 78 RVA: 0x00004C50 File Offset: 0x00002E50
        public static long DirSize(DirectoryInfo d)
        {
            long num = 0L;

            FileInfo[] files = d.GetFiles();
            foreach (FileInfo fileInfo in files)
            {
                num += fileInfo.Length;
            }
            DirectoryInfo[] directories = d.GetDirectories();
            foreach (DirectoryInfo d2 in directories)
            {
                num += WMSUtils.DirSize(d2);
            }
            return(num);
        }
Beispiel #5
0
        // Token: 0x06000041 RID: 65 RVA: 0x00004160 File Offset: 0x00002360
        public static void ClearUserCookie(string cookieName)
        {
            HttpCookie httpCookie = new HttpCookie(cookieName);

            httpCookie.Values.Clear();
            httpCookie.Expires = DateTime.Now.AddYears(-1);
            string text = SysConfigs.GetConfig().cookiedomain.Trim();

            if (text != string.Empty && HttpContext.Current.Request.Url.Host.IndexOf(text.TrimStart(new char[]
            {
                '.'
            })) > -1 && WMSUtils.IsValidDomain(HttpContext.Current.Request.Url.Host))
            {
                httpCookie.Domain = text;
            }
            HttpContext.Current.Response.AppendCookie(httpCookie);
        }
Beispiel #6
0
 // Token: 0x06000283 RID: 643 RVA: 0x00009610 File Offset: 0x00007810
 public static void ResetConfig()
 {
     SysConfigs.filename = FPUtils.GetMapPath(WebConfig.WebPath + "config/sys.config");
     if (!File.Exists(SysConfigs.filename))
     {
         if (!Directory.Exists(Path.GetDirectoryName(SysConfigs.filename)))
         {
             Directory.CreateDirectory(Path.GetDirectoryName(SysConfigs.filename));
         }
         SysConfigs.m_configinfo = new SysConfig();
         if (SysConfigs.m_configinfo.passwordkey == "")
         {
             SysConfigs.m_configinfo.passwordkey = WMSUtils.CreateAuthStr(10);
         }
         SysConfigs.SaveConfig(SysConfigs.m_configinfo);
     }
     SysConfigs.m_configinfo = FPSerializer.Load <SysConfig>(SysConfigs.filename);
 }
Beispiel #7
0
 // Token: 0x0600003D RID: 61 RVA: 0x00003F4C File Offset: 0x0000214C
 public static void WriteUserCookie(UserInfo userinfo, int expires, string passwordkey)
 {
     if (userinfo != null && userinfo.id > 0)
     {
         HttpCookie httpCookie = new HttpCookie("wms");
         httpCookie.Values["userid"]   = userinfo.id.ToString();
         httpCookie.Values["password"] = FPUtils.UrlEncode(DES.Encode(userinfo.password, passwordkey));
         httpCookie.Values["expires"]  = expires.ToString();
         if (expires > 0)
         {
             httpCookie.Expires = DateTime.Now.AddMinutes((double)expires);
         }
         string text = SysConfigs.GetConfig().cookiedomain.Trim();
         if (text != string.Empty && HttpContext.Current.Request.Url.Host.IndexOf(text.TrimStart(new char[]
         {
             '.'
         })) > -1 && WMSUtils.IsValidDomain(HttpContext.Current.Request.Url.Host))
         {
             httpCookie.Domain = text;
         }
         HttpContext.Current.Response.AppendCookie(httpCookie);
     }
 }