private void LoadCustomArray(string customLocationFile, enLocationNameType locNameType, System.Text.Encoding textEncoding) { string[] locArray = null; if (String.IsNullOrEmpty(customLocationFile) == false) { if (textEncoding == null) { locArray = File.ReadAllLines(customLocationFile); } else { locArray = File.ReadAllLines(customLocationFile, textEncoding); } } switch (locNameType) { case enLocationNameType.enCityName: _cityNames = locArray; _maxCityNamesArrayInx = _cityNames.Length - 1; break; case enLocationNameType.enStateProvinceCode: _stateProvinceCodes = locArray; _maxStateProvinceCodesArrayInx = _stateProvinceCodes.Length - 1; break; case enLocationNameType.enStateProvinceName: _stateProvinceNames = locArray; _maxStateProvinceNamesArrayInx = _stateProvinceNames.Length - 1; break; case enLocationNameType.enStreetName: _streetNames = locArray; _maxStreetNamesArrayInx = _streetNames.Length - 1; break; case enLocationNameType.enNeighborhoodName: _neighborhoodNames = locArray; _maxNeighborhoodNamesArrayInx = _neighborhoodNames.Length - 1; break; default: _cityNames = locArray; _maxCityNamesArrayInx = _cityNames.Length - 1; break; } }
//properties //methods /// <summary> /// Reads custom location names from a file into the array for the enLocationNameType specified. /// </summary> /// <param name="customLocationFile">Full path to file containing the custom names.</param> /// <param name="locNameType">Type of location name contained n the customLocationFile.</param> public void LoadCustomLocation(string customLocationFile, enLocationNameType locNameType) { LoadCustomArray(customLocationFile, locNameType, null); }