private RewriterConfiguration(XmlDocument doc)
        {
            allRules = new RewriterRuleCollection();
            XmlNode root = doc.SelectSingleNode("RewriterConfig/Rules");

            foreach (XmlNode n in root.ChildNodes)
            {
                if (n.NodeType != XmlNodeType.Comment)
                {
                    string       lookFor           = n.SelectSingleNode("LookFor").InnerText;
                    string       sendTo            = n.SelectSingleNode("SendTo").InnerText;
                    bool         redirect          = false;
                    XmlAttribute redirectAttribute = n.Attributes["Redirect"];
                    if (redirectAttribute != null)
                    {
                        redirect = SafeConvert.ToBoolean(redirectAttribute.Value);
                    }
                    Regex        lookForRegex = new Regex("^" + RewriterUtils.ResolveUrl(applicationPath, lookFor) + "$", RegexOptions.IgnoreCase);
                    RewriterRule rewriterRule = new RewriterRule(lookFor, lookForRegex, sendTo, redirect);

                    allRules.Add(rewriterRule);
                    if (IDENTIFY_USER_URL_REGEX.IsMatch(lookFor))
                    {
                        string subDomainLookFor = "~" + IDENTIFY_USER_URL_REGEX.Replace(lookFor, "");
                        rewriterRule.SubDomainLookFor = subDomainLookFor;
                        rewriterRule = new RewriterRule(lookFor, lookForRegex, sendTo, subDomainLookFor, redirect);
                        subDomainRules.Add(rewriterRule);
                    }
                }
            }
        }
Beispiel #2
0
        public static DateProperty GetYearMonthDay(string strdate)
        {
            DateProperty dateProperty = new DateProperty();

            dateProperty.Year  = 0;
            dateProperty.Month = 0;
            dateProperty.Day   = 0;
            string[] arrdate = strdate.Split(new char[] { '-' }, StringSplitOptions.None);
            if (arrdate.Length > 0)
            {
                if (arrdate[0].Length > 0)
                {
                    dateProperty.Year = SafeConvert.ToInt32(arrdate[0]);
                    if (arrdate.Length > 1)
                    {
                        if (arrdate[1].Length > 0)
                        {
                            dateProperty.Month = SafeConvert.ToInt32(arrdate[1]);
                        }
                        if (arrdate.Length > 2)
                        {
                            if (arrdate[2].Length > 0)
                            {
                                dateProperty.Day = SafeConvert.ToInt32(arrdate[2]);
                            }
                        }
                    }
                }
            }
            return(dateProperty);
        }
Beispiel #3
0
        /// <summary>
        /// Loads a float value from the datarecord.
        /// </summary>
        /// <param name="name">Name of the column containing the value.</param>
        /// <param name="field">Field to load.</param>
        public void LoadFloat(string name, ref float field)
        {
            int i = GetOrdinal(name);


            //if (i > -1 && !record.IsDBNull(i)) field = record.GetFloat(i);
            if (i > -1 && !record.IsDBNull(i))
            {
                field = SafeConvert.ToSingle(record.GetValue(i));
            }
            else
            {
                field = 0;
            }
        }