コード例 #1
0
ファイル: FPController.cs プロジェクト: Run2948/FangPageExam
 // Token: 0x0600006A RID: 106 RVA: 0x00007D00 File Offset: 0x00005F00
 public FPController()
 {
     if (this.rawurl.IndexOf("/") >= 0)
     {
         this.rawpath  = this.rawurl.Substring(0, this.rawurl.LastIndexOf("/"));
         this.rawpath += "/";
     }
     else
     {
         this.rawpath = this.webpath;
     }
     this.fullurl = this.rawurl.Substring(this.webpath.Length);
     if (this.fullurl.IndexOf("?") >= 0)
     {
         this.cururl = this.fullurl.Substring(0, this.fullurl.IndexOf("?"));
     }
     else
     {
         this.cururl = this.fullurl;
     }
     if (this.cururl.IndexOf("/") > 0)
     {
         this.curpath  = this.cururl.Substring(0, this.cururl.LastIndexOf("/"));
         this.curpath += "/";
     }
     this.adminpath = this.webpath + "admin/";
     this.plupath   = this.webpath + "plugins/";
     string[] array = this.fullurl.Split(new char[]
     {
         '/'
     });
     this.fullname = array[array.Length - 1];
     if (this.cururl.IndexOf("/") >= 0)
     {
         this.sitepath = this.cururl.Substring(0, this.cururl.IndexOf("/"));
     }
     else
     {
         this.sitepath = WebConfig.SitePath;
     }
     this.siteconfig = SiteConfigs.GetSiteInfo(this.sitepath);
     this.pagetitle  = this.siteconfig.sitetitle;
     this.AddMetaSeo(this.siteconfig.keywords, this.siteconfig.description, this.siteconfig.otherhead);
     this.ispost  = FPRequest.IsPost();
     this.isget   = FPRequest.IsGet();
     this.isfile  = FPRequest.IsPostFile();
     this.link    = this.pagename;
     this.action  = FPRequest.GetString("action").ToLower();
     this.browser = this.getBrowserName();
     this.isie    = this.browser.StartsWith("ie");
 }
コード例 #2
0
        // Token: 0x0600009E RID: 158 RVA: 0x000090A0 File Offset: 0x000072A0
        public static double GetDouble(string strName, float defValue)
        {
            double result;

            if ("".Equals(FPRequest.GetFormString(strName)))
            {
                result = FPRequest.GetQueryDouble(strName, (double)defValue);
            }
            else
            {
                result = FPRequest.GetFormDouble(strName, (double)defValue);
            }
            return(result);
        }
コード例 #3
0
        // Token: 0x0600009A RID: 154 RVA: 0x00008FE4 File Offset: 0x000071E4
        public static decimal GetDecimal(string strName, decimal defValue)
        {
            decimal result;

            if ("".Equals(FPRequest.GetFormString(strName)))
            {
                result = FPRequest.GetQueryDecimal(strName, defValue);
            }
            else
            {
                result = FPRequest.GetFormDecimal(strName, defValue);
            }
            return(result);
        }
コード例 #4
0
        // Token: 0x06000096 RID: 150 RVA: 0x00008F28 File Offset: 0x00007128
        public static float GetFloat(string strName, float defValue)
        {
            float result;

            if ("".Equals(FPRequest.GetFormString(strName)))
            {
                result = FPRequest.GetQueryFloat(strName, defValue);
            }
            else
            {
                result = FPRequest.GetFormFloat(strName, defValue);
            }
            return(result);
        }
コード例 #5
0
        // Token: 0x06000090 RID: 144 RVA: 0x00008E2C File Offset: 0x0000702C
        public static int GetInt(string strName, int defValue)
        {
            int result;

            if ("".Equals(FPRequest.GetFormString(strName)))
            {
                result = FPRequest.GetQueryInt(strName, defValue);
            }
            else
            {
                result = FPRequest.GetFormInt(strName, defValue);
            }
            return(result);
        }
コード例 #6
0
        // Token: 0x0600008C RID: 140 RVA: 0x00008D5C File Offset: 0x00006F5C
        public static string GetString(string strName)
        {
            string result;

            if ("".Equals(FPRequest.GetFormString(strName)))
            {
                result = FPRequest.GetQueryString(strName);
            }
            else
            {
                result = FPRequest.GetFormString(strName);
            }
            return(result);
        }
コード例 #7
0
        // Token: 0x060000A2 RID: 162 RVA: 0x0000913C File Offset: 0x0000733C
        public static T GetModel <T>(string prefix) where T : new()
        {
            T    t = (default(T) == null) ? Activator.CreateInstance <T>() : default(T);
            Type typeFromHandle = typeof(T);

            foreach (PropertyInfo propertyInfo in typeFromHandle.GetProperties())
            {
                if (propertyInfo != null && propertyInfo.CanWrite)
                {
                    string text = prefix + propertyInfo.Name;
                    if (text.ToLower() == prefix + "pageurl")
                    {
                        propertyInfo.SetValue(t, FPRequest.GetRawUrl(), null);
                    }
                    else if (HttpContext.Current.Request.QueryString[text] != null || HttpContext.Current.Request.Form[text] != null)
                    {
                        if (propertyInfo.PropertyType == typeof(string))
                        {
                            propertyInfo.SetValue(t, FPRequest.GetString(text), null);
                        }
                        else if (propertyInfo.PropertyType == typeof(int))
                        {
                            propertyInfo.SetValue(t, FPRequest.GetInt(text), null);
                        }
                        else if (propertyInfo.PropertyType == typeof(short))
                        {
                            propertyInfo.SetValue(t, short.Parse(FPRequest.GetInt(text).ToString()), null);
                        }
                        else if (propertyInfo.PropertyType == typeof(DateTime))
                        {
                            propertyInfo.SetValue(t, FPRequest.GetDateTime(text), null);
                        }
                        else if (propertyInfo.PropertyType == typeof(decimal))
                        {
                            propertyInfo.SetValue(t, FPRequest.GetDecimal(text), null);
                        }
                        else if (propertyInfo.PropertyType == typeof(float))
                        {
                            propertyInfo.SetValue(t, FPRequest.GetFloat(text), null);
                        }
                        else if (propertyInfo.PropertyType == typeof(double))
                        {
                            propertyInfo.SetValue(t, FPRequest.GetDouble(text), null);
                        }
                    }
                }
            }
            return(t);
        }
コード例 #8
0
        // Token: 0x0600008D RID: 141 RVA: 0x00008D98 File Offset: 0x00006F98
        public static string GetString(string strName, string defValue)
        {
            string @string = FPRequest.GetString(strName);
            string result;

            if (@string == "")
            {
                result = defValue;
            }
            else
            {
                result = @string;
            }
            return(result);
        }
コード例 #9
0
        // Token: 0x060000A3 RID: 163 RVA: 0x000093EC File Offset: 0x000075EC
        public static T GetModel <T>(T model, string prefix)
        {
            Type type = model.GetType();

            foreach (PropertyInfo propertyInfo in type.GetProperties())
            {
                if (propertyInfo != null && propertyInfo.CanWrite)
                {
                    string text = prefix + propertyInfo.Name;
                    if (text.ToLower() == prefix + "pageurl")
                    {
                        propertyInfo.SetValue(model, FPRequest.GetRawUrl(), null);
                    }
                    else if (HttpContext.Current.Request.QueryString[text] != null || HttpContext.Current.Request.Form[text] != null)
                    {
                        if (propertyInfo.PropertyType == typeof(string))
                        {
                            propertyInfo.SetValue(model, FPRequest.GetString(text), null);
                        }
                        else if (propertyInfo.PropertyType == typeof(int))
                        {
                            propertyInfo.SetValue(model, FPRequest.GetInt(text), null);
                        }
                        else if (propertyInfo.PropertyType == typeof(DateTime))
                        {
                            propertyInfo.SetValue(model, FPRequest.GetDateTime(text), null);
                        }
                        else if (propertyInfo.PropertyType == typeof(decimal))
                        {
                            propertyInfo.SetValue(model, FPRequest.GetDecimal(text), null);
                        }
                        else if (propertyInfo.PropertyType == typeof(float))
                        {
                            propertyInfo.SetValue(model, FPRequest.GetFloat(text), null);
                        }
                        else if (propertyInfo.PropertyType == typeof(double))
                        {
                            propertyInfo.SetValue(model, FPRequest.GetDouble(text), null);
                        }
                    }
                }
            }
            return(model);
        }
コード例 #10
0
 // Token: 0x060000A1 RID: 161 RVA: 0x0000911C File Offset: 0x0000731C
 public static T GetModel <T>(T model)
 {
     return(FPRequest.GetModel <T>(model, ""));
 }
コード例 #11
0
 // Token: 0x060000A0 RID: 160 RVA: 0x00009100 File Offset: 0x00007300
 public static T GetModel <T>() where T : new()
 {
     return(FPRequest.GetModel <T>(""));
 }
コード例 #12
0
 // Token: 0x0600009F RID: 159 RVA: 0x000090E0 File Offset: 0x000072E0
 public static double GetDouble(string strName)
 {
     return(FPRequest.GetDouble(strName, 0f));
 }
コード例 #13
0
 // Token: 0x0600009B RID: 155 RVA: 0x00009020 File Offset: 0x00007220
 public static decimal GetDecimal(string strName)
 {
     return(FPRequest.GetDecimal(strName, 0m));
 }
コード例 #14
0
        // Token: 0x06000092 RID: 146 RVA: 0x00008E84 File Offset: 0x00007084
        public static DateTime GetDateTime(string strName)
        {
            string dateTime = FPUtils.GetDateTime(FPRequest.GetString(strName));

            return(Convert.ToDateTime(dateTime));
        }
コード例 #15
0
 // Token: 0x06000091 RID: 145 RVA: 0x00008E68 File Offset: 0x00007068
 public static int GetInt(string strName)
 {
     return(FPRequest.GetInt(strName, 0));
 }
コード例 #16
0
 // Token: 0x06000097 RID: 151 RVA: 0x00008F64 File Offset: 0x00007164
 public static float GetFloat(string strName)
 {
     return(FPRequest.GetFloat(strName, 0f));
 }
コード例 #17
0
 public FPController()
 {
     port = FPArray.SplitInt(domain, ":", 2)[1];
     if (rawurl.IndexOf("/") >= 0)
     {
         if (rawurl.IndexOf("?") >= 0)
         {
             rawpath = rawurl.Substring(0, rawurl.IndexOf("?"));
             rawpath = rawpath.Substring(0, rawpath.LastIndexOf("/")) + "/";
         }
         else
         {
             rawpath = rawurl.Substring(0, rawurl.LastIndexOf("/")) + "/";
         }
     }
     else
     {
         rawpath = webpath;
     }
     cururl  = rawurl.Substring(webpath.Length);
     pageurl = pagename;
     if (cururl.Contains("?"))
     {
         curname = cururl.Substring(0, cururl.IndexOf("?"));
         query   = cururl.Substring(cururl.IndexOf("?") + 1);
         pageurl = pagename + "?" + query;
     }
     else
     {
         curname = cururl;
     }
     if (curname.IndexOf("/") > 0)
     {
         curpath = curname.Substring(0, curname.LastIndexOf("/")) + "/";
     }
     if (curname.IndexOf("/") >= 0)
     {
         sitepath = curname.Substring(0, curname.IndexOf("/"));
     }
     else
     {
         sitepath = WebConfig.SitePath;
     }
     if (sitepath == "sites")
     {
         sitepath = curpath.Substring(curpath.IndexOf("/") + 1).TrimEnd('/');
     }
     if (!Directory.Exists(FPFile.GetMapPath(webpath + sitepath)))
     {
         sitepath = WebConfig.SitePath;
     }
     pagepath  = webpath + sitepath + "/";
     siteinfo  = SiteConfigs.GetSiteInfo(sitepath);
     adminpath = webpath + "admin/";
     plupath   = webpath + "plugins/";
     apppath   = webpath + "app/";
     sitetitle = siteinfo.sitetitle;
     pagetitle = siteinfo.sitetitle;
     CreateSeoInfo(siteinfo.keywords, siteinfo.description, siteinfo.otherhead);
     ispost = FPRequest.IsPost();
     isget  = FPRequest.IsGet();
     isfile = FPRequest.IsPostFile();
     action = FPRequest.GetString("action");
     op     = FPRequest.GetInt("op");
     try
     {
         ua = HttpContext.Current.Request.UserAgent.ToLower();
     }
     catch
     {
     }
     browser = getBrowserName(ua, out isie);
     args    = FPArray.SplitString(Path.GetFileNameWithoutExtension(pagename), "-");
 }