Dictionary <string, object> GetResources(string fileName)
        {
            Stream     s;
            OpenedFile file = FileService.GetOpenedFile(fileName);

            if (file != null)
            {
                s = file.OpenRead();
            }
            else
            {
                s = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read);
            }
            using (s) {
                using (IResourceReader reader = ResourceStore.CreateResourceReader(s, ResourceStore.GetResourceType(fileName))) {
                    ResXResourceReader resXReader = reader as ResXResourceReader;
                    if (resXReader != null)
                    {
                        resXReader.BasePath = Path.GetDirectoryName(fileName);
                    }

                    var resources = new Dictionary <string, object>();
                    foreach (System.Collections.DictionaryEntry entry in reader)
                    {
                        if (entry.Value == null)
                        {
                            continue;
                        }
                        if (this.requiredResourceType.IsAssignableFrom(entry.Value.GetType()))
                        {
                            resources.Add((string)entry.Key, entry.Value);
                        }
                    }
                    return(resources);
                }
            }
        }