private void SetLocationArrays(enLocation loc) { _location = loc; LocationDataArrays lda = new LocationDataArrays(); switch (loc) { case enLocation.enUS: _cityNames = lda.US_CityNames; _stateProvinceCodes = lda.US_StateCodes; _stateProvinceNames = lda.US_StateNames; _streetNames = lda.US_StreetNames; _neighborhoodNames = new string[] { "" }; break; case enLocation.enCanada: _cityNames = lda.Canada_CityNames; _stateProvinceCodes = lda.Canada_ProvinceCodes; _stateProvinceNames = lda.Canada_ProvinceNames; _streetNames = lda.Canada_StreetNames; _neighborhoodNames = new string[] { "" }; break; case enLocation.enQuebec: _cityNames = lda.Quebec_CityNames; _stateProvinceCodes = new string[] { "QC" }; _stateProvinceNames = new string[] { "Quebec" }; _streetNames = lda.Quebec_StreetNames; _neighborhoodNames = new string[] { "" }; break; case enLocation.enMexico: _cityNames = lda.Mexico_CityNames; _stateProvinceCodes = lda.Mexico_StateCodes; _stateProvinceNames = lda.Mexico_StateNames; _streetNames = lda.Mexico_StreetNames; _neighborhoodNames = lda.Mexico_NeighborhoodNames; break; case enLocation.enCustom: _cityNames = lda.US_CityNames; _stateProvinceCodes = lda.US_StateCodes; _stateProvinceNames = lda.US_StateNames; _streetNames = lda.US_StreetNames; _neighborhoodNames = new string[] { "" }; break; default: break; } _maxCityNamesArrayInx = _cityNames.Length - 1; _maxStateProvinceCodesArrayInx = _stateProvinceCodes.Length - 1; _maxStateProvinceNamesArrayInx = _stateProvinceNames.Length - 1; _maxStreetNamesArrayInx = _streetNames.Length - 1; _maxNeighborhoodNamesArrayInx = _neighborhoodNames.Length - 1; }
/// <summary> /// Option is is [peril x location] unique combination. it binds two attributes of event into single one. /// </summary> /// <param name="p"></param> /// <param name="l"></param> /// <returns></returns> public static string GetOption(enPeril p, enLocation l) { return($"{(int)p}¤{(int)l}"); }
/// <summary> /// Constructor. /// </summary> /// <param name="loc">Enumeration value for the location to be represented by this instance.</param> public RandomLocation(enLocation loc) { SetLocationArrays(loc); }