Beispiel #1
0
 public Element(string tag, string prop, string value, EDistance whichOne = EDistance.First, ELocation where = ELocation.In)
 {
     Tag = tag;
     Data.Add(new Data(prop, value));
     WhichOne = whichOne;
     Where    = where;
 }
Beispiel #2
0
 public Element(string tag, List <Data> data, EDistance whichOne = EDistance.First, ELocation where = ELocation.In)
 {
     Tag      = tag;
     Data     = data;
     WhichOne = whichOne;
     Where    = where;
 }
Beispiel #3
0
 public Element(string tag, Data data, EDistance whichOne = EDistance.First, ELocation where = ELocation.In)
 {
     Tag = tag;
     Data.Add(data);
     WhichOne = whichOne;
     Where    = where;
 }
Beispiel #4
0
        int EDistanceToInt(EDistance ed)
        {
            int i = (int)ed;

            if (i <= 0)
            {
                i = -i;
            }
            else
            {
                i++;
            }
            return(i);
        }
Beispiel #5
0
        public static List <HtmlElement> GetElementByDistance(List <HtmlElement> elements, EDistance whichOne)
        {
            if (elements.Count == 0)
            {
                return(null);
            }

            List <HtmlElement> r = new List <HtmlElement>(1);

            switch (whichOne)
            {
            case EDistance.First:
                r.Add(elements.First());
                break;

            case EDistance.Last:
                r.Add(elements.Last());
                break;

            case EDistance.Any:
                r = elements;
                break;

            default:
                int n = (int)whichOne - 1;
                if (n > 0 && elements.Count > n)
                {
                    r.Add(elements[n]);
                }
                else
                {
                    return(null);
                }
                break;
            }
            return(r);
        }
Beispiel #6
0
 public Element(string tag, EDistance whichOne = EDistance.First, ELocation where = ELocation.In)
 {
     Tag      = tag;
     WhichOne = whichOne;
     Where    = where;
 }