protected static I construct(string cityId, string cityName) { if (string.IsNullOrEmpty(cityId)) { throw new Exception("CITY ID NÃO PODE SER NULO!!!!!"); } I result = new I { cityId = cityId, cityName = cityName }; SettingsFile settingFile = new SettingsFile { pathName = result.thisPathName }; GameSettings.AddSettingsFile(settingFile); if (!settingFile.IsValid() && cityId != GLOBAL_CONFIG_INDEX) { try { I defaultFile = getConfig(GLOBAL_CONFIG_INDEX, GLOBAL_CONFIG_INDEX); foreach (string key in GameSettings.FindSettingsFileByName(defaultFile.thisFileName).ListKeys()) { try { T ci = (T)Enum.Parse(typeof(T), key); switch (ci.ToInt32(CultureInfo.CurrentCulture.NumberFormat) & TYPE_PART) { case TYPE_BOOL: result.setBool(ci, defaultFile.getBool(ci)); break; case TYPE_STRING: case TYPE_LIST: result.setString(ci, defaultFile.getString(ci)); break; case TYPE_INT: result.setInt(ci, defaultFile.getInt(ci)); break; } } catch (Exception e) { KlyteUtils.doErrorLog($"Erro copiando propriedade \"{key}\" para o novo arquivo da classe {typeof(I)}: {e.Message}"); } } } catch { } } return(result); }