Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
 // Token: 0x06000091 RID: 145 RVA: 0x00008E68 File Offset: 0x00007068
 public static int GetInt(string strName)
 {
     return(FPRequest.GetInt(strName, 0));
 }
Ejemplo n.º 4
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), "-");
 }