예제 #1
0
 public static string ExtractTextValues(NamedValues <ZValue> infos, string s)
 {
     // French | PDF | 107 MB -*- French | PDF |  22 Pages | 7 MB -*- PDF | 116 pages | 53 Mb | French -*- Micro Application | 2010 | ISBN: 2300028441 | 221 pages | PDF
     // pb : |I|N|F|O|S|, |S|Y|N|O|P|S|I|S|, |T|E|L|E|C|H|A|R|G|E|R|
     // example http://www.telechargement-plus.com/e-book-magazines/bande-dessines/136846-season-one-100-marvel-syrie-en-cours-10-tomes-comicmulti.html
     if (s.Contains('|'))
     {
         //Trace.CurrentTrace.WriteLine("info \"{0}\"", s);
         foreach (string s2 in zsplit.Split(s, '|', true))
         {
             string s3 = s2;
             NamedValues <ZValue> values = _textInfoRegexList.ExtractTextValues(ref s3);
             infos.SetValues(values);
             s3 = s3.Trim();
             if (s3 != "")
             {
                 infos.SetValue(s3, null);
             }
         }
         return("");
     }
     else
     {
         NamedValues <ZValue> values = _textInfoRegexList.ExtractTextValues(ref s);
         infos.SetValues(values);
         return(s);
     }
 }
예제 #2
0
        public NamedValues <ZValue> ExtractTextValues(ref string text)
        {
            NamedValues <ZValue> values = new NamedValues <ZValue>();

            foreach (RegexValues rv in this.Values)
            {
                MatchValues matchValues = rv.Match(text);
                if (matchValues.Success)
                {
                    values.SetValues(matchValues.GetValues());
                    text = matchValues.Replace("");
                }
            }
            return(values);
        }
예제 #3
0
파일: frboard1.cs 프로젝트: 24/source_04
        //NamedValues1
        private static NamedValues <ZValue> GetTextInfo(ref string text)
        {
            //NamedValues1
            NamedValues <ZValue> values = new NamedValues <ZValue>();

            foreach (RegexValues rv in _textInfoRegexList.Values)
            {
                Match match = rv.Match(text);
                if (match.Success)
                {
                    values.SetValues(rv.GetValues());
                    text = rv.MatchReplace("");
                }
            }
            return(values);
        }
예제 #4
0
파일: frboard1.cs 프로젝트: 24/source_04
        public bool GetTitle()
        {
            if (_root == null)
            {
                return(false);
            }

            //<h2 class="title icon">
            _postTitle = _postNode.zXPathValue(_titleXPath);

            if (_postTitle == null)
            {
                WriteLine("warning post title not found (\"{0}\")  (FrboardPostRead)", _titleXPath);
                return(false);
            }
            _postInfos.SetValues(GetTextInfo(ref _postTitle));
            _postTitle = _postTitle.Trim(_trimAll);
            return(true);
        }
예제 #5
0
파일: Print.cs 프로젝트: 24/source_04
        public virtual bool TrySetValues(NamedValues <ZValue> values)
        {
            //_error = null;
            //_printValues.SetValues(values);

            bool special = _special;

            if (values.ContainsKey("special"))
            {
                special = true;
                _printValues.SetValues(values, "special");
            }

            bool specialMonth = _specialMonth;

            if (values.ContainsKey("special_month"))
            {
                specialMonth = true;
                _printValues.SetValues(values, "special_month");
            }

            Date?    date     = _date;
            DateType dateType = _dateType;

            if (values.ContainsKey("day_near_current_date") || values.ContainsKey("month"))
            {
                Date     date2;
                DateType dateType2;
                if (!zdate.TryCreateDate(values, out date2, out dateType2))
                {
                    //if (values.Error != null)
                    //    _error = values.Error;
                    return(false);
                }
                string error;
                if (!ControlDate(date2, out error))
                {
                    return(false);
                }
                date     = date2;
                dateType = dateType2;
                _printValues.SetValues(values, "day_near_current_date", "day", "month", "year");
            }

            int printNumber = _printNumber;

            if (values.ContainsKey("number"))
            {
                if (!TryGetPrintNumber(values, out printNumber))
                {
                    return(false);
                }
                _printValues.SetValues(values, "number");
            }

            if (date != null && printNumber != 0 && !_print.NoDateAndNumberCalculate && !special && !specialMonth)
            {
                if (_print.Frequency == PrintFrequency.Daily)
                {
                    printNumber = 0;
                }
                else
                {
                    date     = null;
                    dateType = pb.DateType.Unknow;
                }
            }

            string label = _label;

            if (values.ContainsKey("label"))
            {
                label = (string)values["label"];
                _printValues.SetValues(values, "label");
            }

            int index = _index;

            if (values.ContainsKey("index"))
            {
                if (!TryGetIndex(values, out index))
                {
                    return(false);
                }
                _printValues.SetValues(values, "index");
            }

            _error        = null;
            _special      = special;
            _specialMonth = specialMonth;
            _date         = date;
            _dateType     = dateType;
            _printNumber  = printNumber;
            _label        = label;
            _index        = index;
            return(true);
        }
예제 #6
0
 private string ExtractTextValues(NamedValues<ZValue> infos, string s)
 {
     // French | PDF | 107 MB -*- French | PDF |  22 Pages | 7 MB -*- PDF | 116 pages | 205/148 pages | 53 Mb | French -*- Micro Application | 2010 | ISBN: 2300028441 | 221 pages | PDF
     // pb : |I|N|F|O|S|, |S|Y|N|O|P|S|I|S|, |T|E|L|E|C|H|A|R|G|E|R|
     // example http://www.telechargement-plus.com/e-book-magazines/bande-dessines/136846-season-one-100-marvel-syrie-en-cours-10-tomes-comicmulti.html
     if (s.Contains('|'))
     {
         //Trace.CurrentTrace.WriteLine("info \"{0}\"", s);
         foreach (string s2 in zsplit.Split(s, '|', true))
         {
             string s3 = s2;
             NamedValues<ZValue> values = _textInfoRegexList.ExtractTextValues(ref s3);
             infos.SetValues(values);
             //s3 = s3.Trim();
             s3 = Trim(s3);
             if (s3 != "")
             {
                 string name;
                 string value;
                 if (ExtractTextValues2(s3, out name, out value))
                     infos.SetValue(name, value);
                 else
                     infos.SetValue(s3, null);
             }
         }
         return "";
     }
     else
     //{
     //    NamedValues<ZValue> values = _textInfoRegexList.ExtractTextValues(ref s);
     //    infos.SetValues(values);
     //    return s;
     //}
     return s;
 }
예제 #7
0
파일: Print1.cs 프로젝트: 24/source_04
        //NamedValues1
        public virtual bool TrySetValues(NamedValues <ZValue> values)
        {
            //_special
            //NewIssue();
            //if (values.ContainsKey("special_month"))
            //{
            //    _special_month = true;
            //    _date = date.CreateDate(values);
            //    _printNumber = GetPrintNumber(values);
            //}
            //else
            //{
            //    if (values.ContainsKey("day_near_current_date") || values.ContainsKey("year") || values.ContainsKey("month") || values.ContainsKey("day"))
            //        _date = date.CreateDate(values);
            //    if (values.ContainsKey("number"))
            //    {
            //        _printNumber = GetPrintNumber(values);
            //    }
            //}
            //_printValues = values;
            if (values.ContainsKey("special"))
            {
                _special = true;
            }
            if (values.ContainsKey("special_month"))
            {
                _specialMonth = true;
            }
            //bool setDate = false;
            //if (values.ContainsKey("day_near_current_date") || values.ContainsKey("year") || values.ContainsKey("month") || values.ContainsKey("day"))
            if (values.ContainsKey("day_near_current_date") || values.ContainsKey("month"))
            {
                //_date = date.CreateDate(values);
                //setDate = true;
                Date     date;
                DateType dateType;
                if (!zdate.TryCreateDate(values, out date, out dateType))
                {
                    return(false);
                }
                _date = date;
            }
            if (values.ContainsKey("number"))
            {
                //if (!setDate || _noDateAndNumberCalculate)
                //_printNumber = GetPrintNumber(values);
                if (!TryGetPrintNumber(values, out _printNumber))
                {
                    return(false);
                }
            }
            if (_date != null && _printNumber != 0 && !_noDateAndNumberCalculate && !_special && !_specialMonth)
            {
                if (_frequency == PrintFrequency.Daily)
                {
                    _printNumber = 0;
                }
                else
                {
                    _date = null;
                }
            }

            if (values.ContainsKey("label"))
            {
                _label = (string)values["label"];
            }
            if (values.ContainsKey("index"))
            {
                //_index = GetIndex(values);
                if (!TryGetIndex(values, out _index))
                {
                    return(false);
                }
            }
            _printValues.SetValues(values);
            return(true);
        }