private void ParseStreets() { foreach (Match m in GetMatch(streetsFile, @"[0-9]*\s*([0-9А-Яа-я\-]*),\s*([А-Яа-я]*)\.")) { Streets.Add($"{m.Groups[1]} {m.Groups[2]}"); } }
private void MakeStreet(CellData crossingPoint, int length, bool vertical, double momentum, int color) { var degrees = vertical ? new[] { 90, 270 } : new[] { 0, 180 }; var angle = degrees[Random.Next(0, 2)]; if (Random.NextDouble() > 0.7) { angle += Random.Next(-10, -10); } var street = GetLine(crossingPoint, GetPointAtDistanceOnAngle(crossingPoint, length, angle)); foreach (var cell in street) { cell.SetTile(Road, color); } Streets.Add(street); momentum *= Random.NextDouble() + 1f; length = (int)((length * Random.NextDouble()) + 1f); if (momentum > 0.1f) { for (int i = (int)Math.Ceiling(length / 3f); i < street.Count; i++) { if (Random.NextDouble() > 0.9) { MakeStreet(street[i], length, !vertical, momentum, color); i += 5; } } } }
void OnSelectedDistrictChanged() { if (_selectedDistrict != null) { var data = core.GetStreetsByDistrict(SelectedDistrict.Id); foreach (var item in data) { Streets.Add(item); } } }
internal static void ParseSitus() { var city_list = @"FRESNO,CLOVIS,COALINGA,KINGSBURG,KERMAN,SELMA,FOWLER,SANGER,PARLIER,BIOLA,REEDLEY,DINKEY CREEK,PIEDRA,PINEDALE,PINEHURST,HIGHWAY CITY,DEL REY,HURON,AUBERRY,ORANGE COVE,SAN JOAQUIN,TRANQUILLITY,FIREBAUGH,DINUBA,DOS PALOS,RIVERDALE,MENDOTA,EASTON,SQUAW VALLEY,CARUTHERS,SHAVER LAKE,LATON,PRATHER,HUME LAKE,MALAGA,FRIANT,FIVE POINTS,TOLLHOUSE,RAISIN CITY,MIRAMONTE,CANTUA CREEK,HERNDON,BURRELL,MINERAL,HELM,BIG CREEK,DUNLAP,DUNBAR,HUNTINGTON LA".Split(','); city_list.ToList().ForEach(p => Cities.Add(p, Cities.Keys.Count + 1)); var situs = File.ReadAllLines(@"Data/situs.txt"); var records = new List <AddressRecord> { }; foreach (var line in situs) { if (line.StartsWith("PAGE:")) { continue; } (string prefix, int city_id, string suffix) = ParseLine(line); if (city_id == 0) { msg($"[!] -- no city in: {line}"); continue; } var parts = suffix.Split(' '); // "W" "E" etc prefixes are after the city name: if (!Char.IsDigit(parts[0][0])) { prefix = $"{parts[0][0]} {prefix}"; parts = parts.Skip(1).ToArray(); } if (!Streets.ContainsKey(prefix)) { Streets.Add(prefix, Streets.Keys.Count + 1); } records.Add(new AddressRecord { cityname_id = city_id, streetname_id = Streets[prefix], street_address = parts[0], apn_code = parts[1] }); } AddressRecords = records.ToArray(); Save(); }
private void CreateStreets() { var mainStreet = GetDiameterLine(Center, Random.Next(30, 90), Random.Next(-10, 10)); mainStreet.ForEach(c => c.SetTile(Road)); Streets.Add(mainStreet); for (int i = 1; i < mainStreet.Count; i++) { if (Random.NextDouble() > 0.8) { MakeStreet(mainStreet[i], Random.Next(15, 25), true, Random.NextDouble() * 2, 6); i += 5; } } }
void OnSelectedCityChanged() { if (_selectedCity != null) { var data = core.GetCityStreets(SelectedCity.Id); foreach (var item in data) { Streets.Add(item); } var rec = core.GetRegionsByCity(SelectedCity.Id); foreach (var item in rec) { Regions.Add(item); } } }
private void LoadStreets() { VoterFileDataContext _voterDB = new mapapp.data.VoterFileDataContext(string.Format(mapapp.data.VoterFileDataContext.DBConnectionString, App.thisApp._settings.DbFileName)); System.Diagnostics.Debug.Assert(_voterDB.DatabaseExists()); if (!(App.thisApp._settings.DbStatus == DbState.Loaded)) { App.Log("Database not ready to load streets yet."); return; } IEnumerable <StreetTableEntry> streets = (from street in _voterDB.Streets select street); foreach (StreetTableEntry street in streets) { App.Log(" Adding street: " + street.Name); StreetPinModel pPin = new StreetPinModel(street); Streets.Add(pPin); } _voterDB.Dispose(); }
public void BuyBuilding() { TileBuyable street = (TileBuyable)CurrentTile; if (Money > street.Price) { Money -= street.Price; street.HasOwner = true; street.Owner = this; Streets.Add(street); CurrentGame.GameInfo.Enqueue(String.Format(Properties.Language.bought, Name, street.Description)); ; if (street is TileCompany) { TotalCompanies++; } else if (street is TileRailRoad) { TotalRailRoads++; } } }
private async void GetAutoCompleteStrings() { var engFirstNamesTask = _apiClient.AutoCompletes_GetEnglishFirstNamesAsync(); var engFatherNamesTask = _apiClient.AutoCompletes_GetEnglishFatherNamesAsync(); var engLastNamesTask = _apiClient.AutoCompletes_GetEnglishLastNamesAsync(); var ArabicFirstNamesTask = _apiClient.AutoCompletes_GetFirstNamesAsync(); var ArabicFatherNamesTask = _apiClient.AutoCompletes_GetFatherNamesAsync(); var ArabicLastNamesTask = _apiClient.AutoCompletes_GetLastNamesAsync(); var BirthPlacesTask = _apiClient.AutoCompletes_GetOrphansPlacesOfBirthAsync(); var SicknessNamesTask = _apiClient.AutoCompletes_GetSicknessNamesAsync(); var MedicensNamesTask = _apiClient.AutoCompletes_GetMedicensAsync(); var EducationReasonsTask = _apiClient.AutoCompletes_GetEducationReasonsAsync(); var EducationSchoolsTask = _apiClient.AutoCompletes_GetEducationSchoolsAsync(); var EducationStagesTask = _apiClient.AutoCompletes_GetEducationStagesAsync(); var CitiesTask = _apiClient.AutoCompletes_GetCitiesAsync(); var TownsTask = _apiClient.AutoCompletes_GetTownsAsync(); var StreetsTask = _apiClient.AutoCompletes_GetStreetsAsync(); var CountriesTask = _apiClient.AutoCompletes_GetCountriesAsync(); var engFirstList = await engFirstNamesTask; foreach (var firstN in engFirstList) { if (!EnglishNameStrings.Contains(firstN) && firstN != null && firstN.Length > 0) { EnglishNameStrings.Add(firstN); } } var engFatherList = await engFatherNamesTask; foreach (var FatherN in engFatherList) { if (!EnglishNameStrings.Contains(FatherN) && FatherN != null && FatherN.Length > 0) { EnglishNameStrings.Add(FatherN); } } var emgLastList = await engLastNamesTask; foreach (var lastN in emgLastList) { if (!EnglishNameStrings.Contains(lastN) && lastN != null && lastN.Length > 0) { EnglishNameStrings.Add(lastN); } } var FirstList = await ArabicFirstNamesTask; foreach (var firstN in FirstList) { if (!ArabicNameStrings.Contains(firstN) && firstN != null && firstN.Length > 0) { ArabicNameStrings.Add(firstN); } } var FatherList = await ArabicFatherNamesTask; foreach (var FatherN in FatherList) { if (!ArabicNameStrings.Contains(FatherN) && FatherN != null && FatherN.Length > 0) { ArabicNameStrings.Add(FatherN); } } var LastList = await ArabicLastNamesTask; foreach (var lastN in LastList) { if (!ArabicNameStrings.Contains(lastN) && lastN != null && lastN.Length > 0) { ArabicNameStrings.Add(lastN); } } NamesLoaded = true; var SicknessList = await SicknessNamesTask; foreach (var sickness in SicknessList) { if (sickness == null) { continue; } var sickNs = sickness.Split(new char[] { ';' }); foreach (var sickname in sickNs) { if (!SicknessNames.Contains(sickname) && sickname != null && sickname.Length > 0) { SicknessNames.Add(sickname); } } } var MedicenList = await MedicensNamesTask; foreach (var medicensString in MedicenList) { if (medicensString == null) { continue; } var medicensArray = medicensString.Split(new char[] { ';' }); foreach (var medicen in medicensArray) { if (!MedicenNames.Contains(medicen) && medicen != null && medicen.Length > 0) { MedicenNames.Add(medicen); } } } HealthLoaded = true; var EducationReasonsList = await EducationReasonsTask; foreach (var reason in EducationReasonsList) { if (!EducationReasons.Contains(reason) && reason != null && reason.Length > 0) { EducationReasons.Add(reason); } } var EducationSchoolsList = await EducationSchoolsTask; foreach (var school in EducationSchoolsList) { if (!EducationSchools.Contains(school) && school != null && school.Length > 0) { EducationSchools.Add(school); } } var EducationStagesList = await EducationStagesTask; foreach (var stage in EducationStagesList) { if (!EducationStages.Contains(stage) && stage != null && stage.Length > 0) { EducationStages.Add(stage); } } EducationLoaded = true; var BirthPlacesList = await BirthPlacesTask; foreach (var birthplace in BirthPlacesList) { if (!BirthPlaces.Contains(birthplace) && birthplace != null && birthplace.Length > 0) { BirthPlaces.Add(birthplace); } } OrphanDataLoaded = true; var countriesList = await CountriesTask; foreach (var country in countriesList) { if (!Countries.Contains(country) && country != null && country.Length > 0) { Countries.Add(country); } } var citiesList = await CitiesTask; foreach (var city in citiesList) { if (!Cities.Contains(city) && city != null && city.Length > 0) { Cities.Add(city); } } var townsList = await TownsTask; foreach (var town in townsList) { if (!Towns.Contains(town) && town != null && town.Length > 0) { Towns.Add(town); } } var streetsList = await StreetsTask; foreach (var street in streetsList) { if (!Streets.Contains(street) && street != null && street.Length > 0) { Streets.Add(street); } } AddressLoaded = true; DataLoaded?.Invoke(this, new EventArgs()); }