Esempio n. 1
0
            private HashSet<string> FindCsRelativeResourcesFiles()
            {
                var list = new List<string>();
                var md = iAsm.ModuleDefinition;
                foreach (var x in md.Resources.OfType<EmbeddedResource>().Where(x => x.Name.EndsWith(".resources", StringComparison.OrdinalIgnoreCase)))
                {
                    if (x.Name.EndsWith(".g.resources", StringComparison.OrdinalIgnoreCase))
                    {
                        IEnumerable<DictionaryEntry> rscSet = null;
                        var rs = x.GetResourceStream();
                        try
                        {
                            rscSet = new ResourceSet(rs).Cast<DictionaryEntry>();
                        }
                        catch (ArgumentException)
                        {
                        }
                        if (rscSet == null || rscSet.Any(y => !(y.Value is Stream))) continue;

                        foreach (var y in rscSet)
                        {
                            var relativePath = GetRelativePath((string)y.Key, '/');
                            if (relativePath.EndsWith(".baml", StringComparison.OrdinalIgnoreCase))
                            {
                                list.Add(Path.ChangeExtension(relativePath, ".xaml"));
                            }
                        }
                    }
                    else
                    {
                        var relativePath = GetRelativePath(x.Name, '.');
                        list.Add(Path.ChangeExtension(relativePath, ".resx"));
                    }
                }
                return new HashSet<string>(list, StringComparer.InvariantCultureIgnoreCase);
            }