Esempio n. 1
0
        void IFlickrParsable.Load(XmlReader reader)
        {
            if (reader.LocalName != "photocount")
            {
                UtilityMethods.CheckParsingException(reader);
            }

            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                case "count":
                    Count = int.Parse(reader.Value, NumberFormatInfo.InvariantInfo);
                    break;

                case "fromdate":
                    if (Regex.IsMatch(reader.Value, "^\\d+$"))
                    {
                        FromDate = UtilityMethods.UnixTimestampToDate(reader.Value);
                    }
                    else
                    {
                        FromDate = UtilityMethods.MySqlToDate(reader.Value);
                    }
                    break;

                case "todate":
                    if (Regex.IsMatch(reader.Value, "^\\d+$"))
                    {
                        ToDate = UtilityMethods.UnixTimestampToDate(reader.Value);
                    }
                    else
                    {
                        ToDate = UtilityMethods.MySqlToDate(reader.Value);
                    }
                    break;

                default:
                    UtilityMethods.CheckParsingException(reader);
                    break;
                }
            }

            reader.Read();
        }
Esempio n. 2
0
        void IFlickrParsable.Load(System.Xml.XmlReader reader)
        {
            if (reader.LocalName != "photocount")
            {
                UtilityMethods.CheckParsingException(reader);
            }

            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                case "count":
                    Count = int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
                    break;

                case "fromdate":
                    FromDate = System.Text.RegularExpressions.Regex.IsMatch(reader.Value, "^\\d+$") ? UtilityMethods.UnixTimestampToDate(reader.Value) : UtilityMethods.MySqlToDate(reader.Value);
                    break;

                case "todate":
                    ToDate = System.Text.RegularExpressions.Regex.IsMatch(reader.Value, "^\\d+$") ? UtilityMethods.UnixTimestampToDate(reader.Value) : UtilityMethods.MySqlToDate(reader.Value);
                    break;

                default:
                    UtilityMethods.CheckParsingException(reader);
                    break;
                }
            }

            reader.Read();
        }