public override ResourceSet GetResourceSet(CultureInfo culture, bool createIfNotExists, bool tryParents) { DBResourceSet databaseResourceSet; while (true) { if (ResourceSets.Contains(culture.Name) && (DBResourceSet)ResourceSets[culture.Name] != null) { databaseResourceSet = (DBResourceSet)ResourceSets[culture.Name]; } else { databaseResourceSet = new DBResourceSet(_fileName, culture); ResourceSets.Add(culture.Name, databaseResourceSet); } if (databaseResourceSet.TableCount != 0 || culture.Equals(CultureInfo.InvariantCulture)) { break; } culture = culture.Parent; } if (DateTime.UtcNow > _updateDate.AddSeconds(2)) { GetResource.UpdateDBRS(databaseResourceSet, _fileName, culture.Name, _updateDate); _updateDate = DateTime.UtcNow; } return(databaseResourceSet); }
public override ResourceSet GetResourceSet(CultureInfo culture, bool createIfNotExists, bool tryParents) { var baseCulture = culture; DBResourceSet databaseResourceSet; while (true) { if (!ResourceSetsTable.TryGetValue(culture.Name, out databaseResourceSet)) { databaseResourceSet = new DBResourceSet(_fileName, culture); ResourceSetsTable.TryAdd(culture.Name, databaseResourceSet); } if (!databaseResourceSet.DataIsEmpty) { break; } if (culture.Equals(CultureInfo.InvariantCulture)) { return(_resManager.GetResourceSet(baseCulture, createIfNotExists, tryParents)); } culture = culture.Parent; } if (0 < updateSeconds && DateTime.UtcNow > _updateDate.AddSeconds(2)) { GetResource.UpdateDBRS(databaseResourceSet, _fileName, culture.Name, _updateDate); _updateDate = DateTime.UtcNow; } return(databaseResourceSet); }