/**************************************************************************/

        public MacroscopeDataExtractorCssSelectors(int Size)
            : base(Size: Size)
        {
            this.SuppressDebugMsg = true;

            this.ExtractCssSelectors = new List <KeyValuePair <string,  MacroscopeDataExtractorExpression> > (this.GetSize());

            for (int Slot = 0; Slot < this.GetSize(); Slot++)
            {
                this.ExtractActiveInactive.Add(MacroscopeConstants.ActiveInactive.INACTIVE);

                MacroscopeDataExtractorExpression Expression;

                Expression = new MacroscopeDataExtractorExpression(
                    NewLabel: "",
                    NewExpression: "",
                    NewExtractorType: MacroscopeConstants.DataExtractorType.INNERTEXT
                    );

                this.ExtractCssSelectors.Add(
                    new KeyValuePair <string,  MacroscopeDataExtractorExpression> (
                        string.Format("CssSelector{0}", Slot + 1),
                        Expression
                        )
                    );
            }
        }
        /**************************************************************************/

        public void SetCssSelector(
            int Slot,
            string CssSelectorLabel,
            string CssSelectorString,
            MacroscopeConstants.DataExtractorType ExtractorType
            )
        {
            MacroscopeDataExtractorExpression DataExtractorCssSelectorExpression;
            KeyValuePair <string,  MacroscopeDataExtractorExpression> ExpressionSlot;

            if (
                (!string.IsNullOrEmpty(CssSelectorString)) &&
                (SyntaxCheckCssSelector(CssSelectorString: CssSelectorString)))
            {
                DataExtractorCssSelectorExpression = new MacroscopeDataExtractorExpression(
                    NewLabel: CssSelectorLabel,
                    NewExpression: CssSelectorString,
                    NewExtractorType: ExtractorType
                    );

                ExpressionSlot = new KeyValuePair <string, MacroscopeDataExtractorExpression> (
                    CssSelectorLabel,
                    DataExtractorCssSelectorExpression
                    );

                this.ExtractCssSelectors[Slot] = ExpressionSlot;

                this.SetEnabled();
            }
        }
Ejemplo n.º 3
0
        /**************************************************************************/

        public void SetXpath(
            int Slot,
            string XpathLabel,
            string XpathString,
            MacroscopeConstants.DataExtractorType ExtractorType
            )
        {
            MacroscopeDataExtractorExpression DataExtractorXpathsExpression;
            KeyValuePair <string,  MacroscopeDataExtractorExpression> ExpressionSlot;

            if (
                (!string.IsNullOrEmpty(XpathString)) &&
                (SyntaxCheckXpath(XpathString: XpathString)))
            {
                DataExtractorXpathsExpression = new MacroscopeDataExtractorExpression(
                    NewLabel: XpathLabel,
                    NewExpression: XpathString,
                    NewExtractorType: ExtractorType
                    );

                ExpressionSlot = new KeyValuePair <string, MacroscopeDataExtractorExpression> (
                    XpathLabel,
                    DataExtractorXpathsExpression
                    );

                this.ExtractXpaths[Slot] = ExpressionSlot;

                this.SetEnabled();
            }
        }