private static ResourceKeys Open(Type resourceType, CultureInfo culture) { string pathRoot = System.IO.Path.GetDirectoryName(new System.Uri(System.Reflection.Assembly.GetCallingAssembly().CodeBase).LocalPath); ResourceKeys returnValue = ResourceKeys.Open(resourceType); string fileName = GetResourceFileName(resourceType, culture); fileName = System.IO.Path.Combine(pathRoot, fileName); using (ResourceReader reader = new ResourceReader(fileName)) { IDictionaryEnumerator dict = reader.GetEnumerator(); while (dict.MoveNext()) { string resourceKey, resourceValue; resourceKey = dict.Key as string; resourceValue = dict.Value as string; if (resourceKey.IsNullEmptyOrWhiteSpace() || resourceValue.IsNullEmptyOrWhiteSpace()) { continue; } returnValue.Add(resourceKey, resourceValue, culture); } } return(returnValue); }
public static ResourceKeys Open <T>() where T : class { return(ResourceKeys.Open(typeof(T))); }