private ResourceSet GetResourceSet(CultureInfo culture, bool custom) { ResourceSet resource; String resourceKey = GetResourceKey(culture, custom); lock (_resourceLock) { // if the resource data for this culture has not yet been loaded, load it if (!ResourceData.TryGetValue(resourceKey, out resource)) { // set the filename according to the cuture String filename = "resources."; if (custom) { filename += "custom."; } if (!culture.Equals(CultureInfo.InvariantCulture)) { filename += culture.Name.ToLowerInvariant() + "."; } filename += "txt"; filename = Path.Combine(_resourcePath, filename); // load the resource set and add it into the resource table resource = new ResourceSet(_resourceReaderFactory(filename)); // Note (arnec): We call GetString to force the lazy loading of the resource stream, thereby making // GetString(), at least theoretically, thread-safe for subsequent calls. resource.GetString("", true); ResourceData.Add(resourceKey, resource); } } return(resource); }