Esempio n. 1
0
        public FetchPatern FindFetchPaternFor(FetchPatern up)
        {
            FetchPatern fp = DefaultPatern;

            if (Paterns.Count > 0)
            {
                int index = Paterns.FindIndex((ur) => ur.IsSame(up));
                if (index < 0)
                {
                    index = Paterns.FindIndex((ur) => ur.IsLike(up));
                }
                if (index < 0)
                {
                    string bss = MiMFa_StringService.LastFindAndSplit(up.BaseURL.TrimEnd(' ', '/'), "/").First();
                    index = Paterns.FindIndex((ur) => MiMFa_StringService.LastFindAndSplit(ur.BaseURL.TrimEnd(' ', '/'), "/").First() == bss);
                    if (index < 0)
                    {
                        index = Paterns.FindIndex((ur) => MiMFa_StringService.LastFindAndSplit(ur.BaseURL.TrimEnd(' ', '/'), "/").First().StartsWith(bss));
                    }
                }
                if (index > -1)
                {
                    fp = Paterns[index];
                }
            }
            return(new FetchPatern(fp, up.URL, up.Source, up.Extra));
        }
Esempio n. 2
0
        private void AddObject_Click(object sender, EventArgs e)
        {
            this.AllPata.VerticalScroll.Value = 0;
            Pattern p = new Pattern(pers.Vhod_neiron, WhatIsIt.Text, 0);

            p.Location = new System.Drawing.Point(14, 5 + Paterns.Count * 65);
            Paterns.Add(p);
            this.AllPata.Controls.Add(p);
        }
Esempio n. 3
0
        private void AddBaseObject_Click(object sender, EventArgs e)
        {
            Pattern p = new Pattern(stringToDoubleArray("0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"), "Пустое поле", 0);

            p.Location = new System.Drawing.Point(14, 5 + Paterns.Count * 65); Paterns.Add(p);
            this.AllPata.Controls.Add(p);
            p          = new Pattern(stringToDoubleArray("1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1"), "Квадрат", 0.25);
            p.Location = new System.Drawing.Point(14, 5 + Paterns.Count * 65); Paterns.Add(p);
            this.AllPata.Controls.Add(p);
            p          = new Pattern(stringToDoubleArray("0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1"), "Треугольник", 0.5);
            p.Location = new System.Drawing.Point(14, 5 + Paterns.Count * 65); Paterns.Add(p);
            this.AllPata.Controls.Add(p);
            p          = new Pattern(stringToDoubleArray("0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"), "Смайл", 0.75);
            p.Location = new System.Drawing.Point(14, 5 + Paterns.Count * 65); Paterns.Add(p);
            this.AllPata.Controls.Add(p);
            p          = new Pattern(stringToDoubleArray("1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1"), "Линия", 1);
            p.Location = new System.Drawing.Point(14, 5 + Paterns.Count * 65); Paterns.Add(p);
            this.AllPata.Controls.Add(p);
        }
Esempio n. 4
0
        public FetchPatern FindFetchPatern(FetchPatern up)
        {
            FetchPatern fp = DefaultPatern;

            if (Paterns.Count > 0)
            {
                int index = -1;
                if (up.Parent != null)
                {
                    FetchPatern parent = (FetchPatern)up.Parent;
                    try { index = Paterns.FindIndex((ur) => ur.Name == up.Name && ur.Parent != null && ((FetchPatern)ur.Parent).IsDuplicate(parent)); } catch { }
                    if (index < 0)
                    {
                        try { index = Paterns.FindIndex((ur) => ur.IsDuplicate(up) && ur.Parent != null && ((FetchPatern)ur.Parent).IsDuplicate(parent)); } catch { }
                    }
                    if (index < 0)
                    {
                        try { index = Paterns.FindIndex((ur) => ur.IsSame(up) && ur.Parent != null && ((FetchPatern)ur.Parent).IsDuplicate(parent)); } catch { }
                    }
                    if (index < 0)
                    {
                        try { index = Paterns.FindIndex((ur) => ur.IsLike(up) && ur.Parent != null && ((FetchPatern)ur.Parent).IsDuplicate(parent)); } catch { }
                    }
                    if (index < 0)
                    {
                        try { index = Paterns.FindIndex((ur) => ur.Name == up.Name && ur.Parent != null && ((FetchPatern)ur.Parent).IsSame(parent)); } catch { }
                    }
                    if (index < 0)
                    {
                        try { index = Paterns.FindIndex((ur) => ur.IsDuplicate(up) && ur.Parent != null && ((FetchPatern)ur.Parent).IsSame(parent)); } catch { }
                    }
                    if (index < 0)
                    {
                        try { index = Paterns.FindIndex((ur) => ur.IsSame(up) && ur.Parent != null && ((FetchPatern)ur.Parent).IsSame(parent)); } catch { }
                    }
                    if (index < 0)
                    {
                        try { index = Paterns.FindIndex((ur) => ur.IsLike(up) && ur.Parent != null && ((FetchPatern)ur.Parent).IsSame(parent)); } catch { }
                    }
                    if (index < 0)
                    {
                        try { index = Paterns.FindIndex((ur) => ur.Name == up.Name && ur.Parent != null && ((FetchPatern)ur.Parent).IsLike(parent)); } catch { }
                    }
                    if (index < 0)
                    {
                        try { index = Paterns.FindIndex((ur) => ur.IsDuplicate(up) && ur.Parent != null && ((FetchPatern)ur.Parent).IsLike(parent)); } catch { }
                    }
                    if (index < 0)
                    {
                        try { index = Paterns.FindIndex((ur) => ur.IsSame(up) && ur.Parent != null && ((FetchPatern)ur.Parent).IsLike(parent)); } catch { }
                    }
                    if (index < 0)
                    {
                        try { index = Paterns.FindIndex((ur) => ur.IsLike(up) && ur.Parent != null && ((FetchPatern)ur.Parent).IsLike(parent)); } catch { }
                    }
                }
                else
                {
                    try { index = Paterns.FindIndex((ur) => ur.Parent != null && ((FetchPatern)ur.Parent).IsDuplicate(up)); } catch { }
                    if (index < 0)
                    {
                        try { index = Paterns.FindIndex((ur) => ur.Parent != null && ((FetchPatern)ur.Parent).IsSame(up)); } catch { }
                    }
                    if (index < 0)
                    {
                        try { index = Paterns.FindIndex((ur) => ur.Parent != null && ((FetchPatern)ur.Parent).IsLike(up)); } catch { }
                    }
                    if (index < 0)
                    {
                        try { index = Paterns.FindIndex((ur) => ur.Parent == null && ur.Name == up.Name); } catch { }
                    }
                    if (index < 0)
                    {
                        try { index = Paterns.FindIndex((ur) => ur.IsDuplicate(up)); } catch { }
                    }
                    if (index < 0)
                    {
                        try { index = Paterns.FindIndex((ur) => ur.IsSame(up)); } catch { }
                    }
                    if (index < 0)
                    {
                        try { index = Paterns.FindIndex((ur) => ur.IsLike(up)); } catch { }
                    }
                    if (index < 0)
                    {
                        try { index = Paterns.FindIndex((ur) => ur.Name == up.Name); } catch { }
                    }
                }
                if (index > -1)
                {
                    fp = Paterns[index];
                }
                else
                {
                    return(FindFetchPaternFor(up));
                }
            }
            return(new FetchPatern(fp, up.URL, up.Source, up.Extra));
        }