Beispiel #1
0
        private void init(XElement xelement)
        {
            _directory = xelement.zXPathValue("Directory");

            _regexModels = new Dictionary<string, RegexValuesModel>();
            // zElements("FilenameInfos/FilenameModel")
            foreach (XElement xe in xelement.zXPathElements("FilenameInfos/FilenameModel"))
            {
                RegexValuesModel rvm = new RegexValuesModel(xe);
                _regexModels.Add(rvm.key, rvm);
            }
            // zElements("FilenameInfos/FilenameDate")
            _dateRegexList = new RegexValuesList(xelement.zXPathElements("FilenameInfos/FilenameDate"));

            //XElement xe3 = xelement.zXPathElement("FilenameInfos/FilenameDay");
            //if (xe3 != null)
            //    _dayRegex = new RegexValues(xe3);
            // zElements("FilenameInfos/FilenameDay")
            _dayRegexList = new RegexValuesList(xelement.zXPathElements("FilenameInfos/FilenameDay"));

            // zElements("FilenameInfos/FilenameNumber")
            _numberRegexList = new RegexValuesList(xelement.zXPathElements("FilenameInfos/FilenameNumber"));

            //xe3 = xelement.zXPathElement("FilenameInfos/FilenameSpecial");
            //if (xe3 != null)
            //    _specialRegex = new RegexValues(xe3);
            // zElements("FilenameInfos/FilenameSpecial")
            _specialRegexList = new RegexValuesList(xelement.zXPathElements("FilenameInfos/FilenameSpecial"));

            _printRegexList = new RegexValuesList();
            _prints = new Dictionary<string, Print>();
            // zElements("Prints/Print")
            foreach (XElement xe in xelement.zXPathElements("Prints/Print"))
            {
                Print print = null;
                switch (xe.zXPathValue("Class"))
                {
                    case "LeMonde":
                        print = new PrintLeMonde(xe, _directory, _regexModels);
                        break;
                    case "LeParisien":
                        print = new PrintLeParisien(xe, _directory, _regexModels);
                        break;
                    case "LExpress":
                        print = new PrintLExpress(xe, _directory, _regexModels);
                        break;
                    case "LeVifExpress":
                        print = new PrintLeVifExpress(xe, _directory, _regexModels);
                        break;
                    default:
                        print = new Print(xe, _directory, _regexModels);
                        break;
                }
                string name = print.Name;
                _prints.Add(name, print);
                int n = 1;
                // zElements("Filename")
                foreach (XElement xe2 in xe.zXPathElements("Filename"))
                {
                    string key = name + n++.ToString();
                    string regex = xe2.zExplicitAttribValue("regex");
                    string values = xe2.zAttribValue("values");
                    string options = xe2.zAttribValue("options");
                    _printRegexList.Add(key, new RegexValues(key, name, regex, options, values));
                }
            }
        }
Beispiel #2
0
        private void init(XElement xelement)
        {
            _directory = xelement.zXPathValue("Directory");

            _regexModels = new Dictionary <string, RegexValuesModel>();
            // zElements("FilenameInfos/FilenameModel")
            foreach (XElement xe in xelement.zXPathElements("FilenameInfos/FilenameModel"))
            {
                RegexValuesModel rvm = new RegexValuesModel(xe);
                _regexModels.Add(rvm.key, rvm);
            }
            // zElements("FilenameInfos/FilenameDate")
            _dateRegexList = new RegexValuesList(xelement.zXPathElements("FilenameInfos/FilenameDate"));

            //XElement xe3 = xelement.zXPathElement("FilenameInfos/FilenameDay");
            //if (xe3 != null)
            //    _dayRegex = new RegexValues(xe3);
            // zElements("FilenameInfos/FilenameDay")
            _dayRegexList = new RegexValuesList(xelement.zXPathElements("FilenameInfos/FilenameDay"));

            // zElements("FilenameInfos/FilenameNumber")
            _numberRegexList = new RegexValuesList(xelement.zXPathElements("FilenameInfos/FilenameNumber"));

            //xe3 = xelement.zXPathElement("FilenameInfos/FilenameSpecial");
            //if (xe3 != null)
            //    _specialRegex = new RegexValues(xe3);
            // zElements("FilenameInfos/FilenameSpecial")
            _specialRegexList = new RegexValuesList(xelement.zXPathElements("FilenameInfos/FilenameSpecial"));

            _printRegexList = new RegexValuesList();
            _prints         = new Dictionary <string, Print>();
            // zElements("Prints/Print")
            foreach (XElement xe in xelement.zXPathElements("Prints/Print"))
            {
                Print print = null;
                switch (xe.zXPathValue("Class"))
                {
                case "LeMonde":
                    print = new PrintLeMonde(xe, _directory, _regexModels);
                    break;

                case "LeParisien":
                    print = new PrintLeParisien(xe, _directory, _regexModels);
                    break;

                case "LExpress":
                    print = new PrintLExpress(xe, _directory, _regexModels);
                    break;

                case "LeVifExpress":
                    print = new PrintLeVifExpress(xe, _directory, _regexModels);
                    break;

                default:
                    print = new Print(xe, _directory, _regexModels);
                    break;
                }
                string name = print.Name;
                _prints.Add(name, print);
                int n = 1;
                // zElements("Filename")
                foreach (XElement xe2 in xe.zXPathElements("Filename"))
                {
                    string key     = name + n++.ToString();
                    string regex   = xe2.zExplicitAttribValue("regex");
                    string values  = xe2.zAttribValue("values");
                    string options = xe2.zAttribValue("options");
                    _printRegexList.Add(key, new RegexValues(key, name, regex, options, values));
                }
            }
        }