示例#1
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = 13;
         hashCode = (hashCode * 17) ^ TypeOfFileSearch.GetHashCode();
         hashCode = (hashCode * 17) ^ FileNames?.GetHashCode() ?? 5;
         hashCode = (hashCode * 17) ^ IgnoreFilePattern?.GetHashCode() ?? 5;
         hashCode = (hashCode * 17) ^ TypeOfSearch.GetHashCode();
         hashCode = (hashCode * 17) ^ SearchPattern?.GetHashCode() ?? 5;
         hashCode = (hashCode * 17) ^ ReplacePattern?.GetHashCode() ?? 5;
         hashCode = (hashCode * 17) ^ CaseSensitive.GetHashCode();
         hashCode = (hashCode * 17) ^ WholeWord.GetHashCode();
         hashCode = (hashCode * 17) ^ Multiline.GetHashCode();
         hashCode = (hashCode * 17) ^ Singleline.GetHashCode();
         hashCode = (hashCode * 17) ^ BooleanOperators.GetHashCode();
         hashCode = (hashCode * 17) ^ IncludeSubfolders.GetHashCode();
         hashCode = (hashCode * 17) ^ IncludeHiddenFiles.GetHashCode();
         hashCode = (hashCode * 17) ^ IncludeBinaryFiles.GetHashCode();
         hashCode = (hashCode * 17) ^ MaxSubfolderDepth.GetHashCode();
         hashCode = (hashCode * 17) ^ UseGitignore.GetHashCode();
         hashCode = (hashCode * 17) ^ IncludeArchive.GetHashCode();
         hashCode = (hashCode * 17) ^ FollowSymlinks.GetHashCode();
         hashCode = (hashCode * 17) ^ CodePage.GetHashCode();
         return(hashCode);
     }
 }
示例#2
0
        public static List <Car> AdvancedSearch(List <Car> carList, TypeOfSearch typeOfSearch, string text)
        {
            IEnumerable <Car> result = from Car car in carList
                                       select car;

            switch (typeOfSearch)
            {
            case (TypeOfSearch.Model):
            {
                result = result.Where(x => x.Model == text);
                break;
            }

            case (TypeOfSearch.Mark):
            {
                result = result.Where(x => x.Brand == text);
                break;
            }

            case (TypeOfSearch.Chassis):
            {
                result = result.Where(x => x.Chassis == text);
                break;
            }

            case (TypeOfSearch.Color):
            {
                result = result.Where(x => x.Color == text);
                break;
            }

            case (TypeOfSearch.EngineType):
            {
                result = result.Where(x => x.EngineType == text);
                break;
            }

            case (TypeOfSearch.TransmissionGears):
            {
                result = result.Where(x => x.TransmissionGears.ToString() == text);
                break;
            }

            case (TypeOfSearch.TransmissionModel):
            {
                result = result.Where(x => x.TransmissionModel == text);
                break;
            }

            case (TypeOfSearch.YearProduction):
            {
                result = result.Where(x => x.YearProduction.ToString() == text);
                break;
            }

            default:
                break;
            }
            return(result.ToList());
        }
示例#3
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = 13;
         hashCode = (hashCode * 17) ^ TypeOfFileSearch.GetHashCode();
         hashCode = (hashCode * 17) ^ FilePattern?.GetHashCode() ?? 5;
         hashCode = (hashCode * 17) ^ IgnoreFilePattern?.GetHashCode() ?? 5;
         hashCode = (hashCode * 17) ^ TypeOfSearch.GetHashCode();
         hashCode = (hashCode * 17) ^ SearchFor?.GetHashCode() ?? 5;
         hashCode = (hashCode * 17) ^ ReplaceWith?.GetHashCode() ?? 5;
         hashCode = (hashCode * 17) ^ CaseSensitive.GetHashCode();
         hashCode = (hashCode * 17) ^ WholeWord.GetHashCode();
         hashCode = (hashCode * 17) ^ Multiline.GetHashCode();
         hashCode = (hashCode * 17) ^ Singleline.GetHashCode();
         hashCode = (hashCode * 17) ^ BooleanOperators.GetHashCode();
         hashCode = (hashCode * 17) ^ IncludeSubfolders.GetHashCode();
         hashCode = (hashCode * 17) ^ IncludeHidden.GetHashCode();
         hashCode = (hashCode * 17) ^ IncludeBinary.GetHashCode();
         hashCode = (hashCode * 17) ^ MaxSubfolderDepth.GetHashCode();
         hashCode = (hashCode * 17) ^ UseGitignore.GetHashCode();
         hashCode = (hashCode * 17) ^ SkipRemoteCloudStorageFiles.GetHashCode();
         hashCode = (hashCode * 17) ^ IncludeArchive.GetHashCode();
         hashCode = (hashCode * 17) ^ FollowSymlinks.GetHashCode();
         hashCode = (hashCode * 17) ^ CodePage.GetHashCode();
         hashCode = (hashCode * 17) ^ ApplyFileSourceFilters.GetHashCode();
         hashCode = (hashCode * 17) ^ ApplyFilePropertyFilters.GetHashCode();
         hashCode = (hashCode * 17) ^ ApplyContentSearchFilters.GetHashCode();
         return(hashCode);
     }
 }
示例#4
0
 private int GetSearchHash()
 {
     unchecked
     {
         int hashCode = 13;
         hashCode = (hashCode * 397) ^ SampleText?.GetHashCode() ?? 5;
         hashCode = (hashCode * 397) ^ SearchFor?.GetHashCode() ?? 5;
         hashCode = (hashCode * 397) ^ TypeOfSearch.GetHashCode();
         hashCode = (hashCode * 397) ^ CaseSensitive.GetHashCode();
         hashCode = (hashCode * 397) ^ WholeWord.GetHashCode();
         hashCode = (hashCode * 397) ^ Multiline.GetHashCode();
         hashCode = (hashCode * 397) ^ Singleline.GetHashCode();
         hashCode = (hashCode * 397) ^ BooleanOperators.GetHashCode();
         hashCode = (hashCode * 397) ^ HighlightCaptureGroups.GetHashCode();
         return(hashCode);
     }
 }
示例#5
0
        private void button_StartFetch_Click(object sender, EventArgs e)
        {
            string       url  = textBox_URL.Text;
            TypeOfSearch type = (TypeOfSearch)comboBox_Type.SelectedIndex;

            switch (type)
            {
            case TypeOfSearch.Appartments_For_Sale:

                break;

            case TypeOfSearch.Appartments_For_Rent:
            {
                CreateAppartmentsDataTableColumns();
                for (int page = 0; page < Int32.Parse(textBox_Pages.Text); page++)
                {
                    var web = new HtmlWeb();
                    HtmlAgilityPack.HtmlDocument doc = web.Load(url);

                    for (int i = 0; i < 40; i++)
                    {
                        string query_id = doc.DocumentNode.SelectNodes("//*[@id=\"feed_item_" + i + "\"]")[0].GetAttributeValue("item-id", "aaaaaa");
                        string item_url = "https://www.yad2.co.il/item/" + query_id;
                        var    item_web = new HtmlWeb();
                        HtmlAgilityPack.HtmlDocument item_doc = item_web.Load(item_url);

                        //fetching for main page:
                        string _street_addr     = doc.DocumentNode.SelectNodes("//*[@id=\"feed_item_" + i + "_title\"]/span[1]")[0].InnerText;
                        string street_addr      = Regex.Replace(_street_addr, @"\s+", " ");
                        string city             = doc.DocumentNode.SelectNodes("//*[@id=\"feed_item_" + i + "\"]/div/div[1]/div[2]/span[2]")[0].InnerText;
                        string rooms            = doc.DocumentNode.SelectNodes("//*[@id=\"data_rooms_" + i + "\"]")[0].InnerText;
                        string floor            = doc.DocumentNode.SelectNodes("//*[@id=\"data_floor_" + i + "\"]")[0].InnerText;
                        string sq_meter         = doc.DocumentNode.SelectNodes("//*[@id=\"data_SquareMeter_" + i + "\"]")[0].InnerText;
                        string _price_per_month = doc.DocumentNode.SelectNodes("//*[@id=\"feed_item_" + i + "_price\"]")[0].InnerText;
                        string price_per_month  = Regex.Replace(_price_per_month, @"\s+", " ");

                        table.Rows.Add(query_id, street_addr, city, rooms, floor, sq_meter, price_per_month);
                    }

                    url += "&page=" + (page + 1);
                }
            }
            break;

            case TypeOfSearch.Cars_Yad2:
            {
                CreateCarsDataTableColumns();
                for (int page = 0; page < Int32.Parse(textBox_Pages.Text); page++)
                {
                    var web = new HtmlWeb();
                    HtmlAgilityPack.HtmlDocument doc = web.Load(url);


                    for (int i = 0; i < 40; i++)
                    {
                        string query_id = doc.DocumentNode.SelectNodes("//*[@id=\"feed_item_" + i + "\"]")[0].GetAttributeValue("item-id", "NotExist");

                        string item_url = "https://www.yad2.co.il/item/" + query_id;
                        var    item_web = new HtmlWeb();
                        HtmlAgilityPack.HtmlDocument item_doc = item_web.Load(item_url);
                        string make_and_model = doc.DocumentNode.SelectNodes("//*[@id=\"feed_item_" + i + "_title\"]/span")[0].InnerText;
                        make_and_model.Split(new char[0], StringSplitOptions.RemoveEmptyEntries);
                        string info = doc.DocumentNode.SelectNodes("//*[@id=\"feed_item_" + i + "\"]/div/div[1]/div[2]/span[2]")[0].InnerText;
                        //string query_id = doc.DocumentNode.SelectNodes("//*[@id=\"accordion_wide_0\"]/div/div[3]/div[2]/span")[0].InnerText;
                        string make4            = doc.DocumentNode.SelectNodes("//*[@id=\"feed_item_" + i + "_title\"]/span[1]")[0].InnerText;
                        string model            = doc.DocumentNode.SelectNodes("//*[@id=\"feed_item_" + i + "\"]/div/div[1]/div[2]/span[2]")[0].InnerText;
                        string year             = doc.DocumentNode.SelectNodes("//*[@id=\"data_year_" + i + "\"]")[0].InnerText;
                        string yad              = doc.DocumentNode.SelectNodes("//*[@id=\"data_hand_" + i + "\"]")[0].InnerText;
                        string smk              = doc.DocumentNode.SelectNodes("//*[@id=\"data_engine_size_" + i + "\"]")[0].InnerText;
                        string _price_per_month = doc.DocumentNode.SelectNodes("//*[@id=\"feed_item_" + i + "_price\"]")[0].InnerText;
                        string price_per_month  = Regex.Replace(_price_per_month, @"\s+", " ");

                        table.Rows.Add(query_id, make4, model, year, yad, smk, price_per_month);
                    }

                    url += "&page=" + (page + 1);
                }
            }
            break;

            default:
                break;
            }


            MessageBox.Show("Fetching finished!");
        }