Ejemplo n.º 1
0
        private void CheckAndAddAssembly(List <LocalizableAssembly> localizableAssemblies, string file, string basePath, LocalizationAppDomain appDomain)
        {
            string fullPathToAssembly = System.IO.Path.Combine(Document.PathToBinaries, file);

            if (!LoadedAssembly.IsNetAssembly(fullPathToAssembly))
            {
                return;
            }

            LoadedAssembly assembly = appDomain.LoadAssembly(fullPathToAssembly);

            if (assembly.WasExceptionOnLoad)
            {
                return;
            }

            if (assembly.NeutralResourceCultureName == "")
            {
                return;
            }

            var assemblyName = System.IO.Path.GetFileNameWithoutExtension(file);
            var resourceFile = System.IO.Path.Combine(
                assembly.NeutralResourceCultureName,
                String.Format("{0}.resources.dll", assemblyName));

            var resourceFullPath = System.IO.Path.Combine(
                Document.PathToBinaries,
                resourceFile);

            if (!File.Exists(resourceFullPath))
            {
                return;
            }

            localizableAssemblies.Add(new LocalizableAssembly(file,
                                                              assembly.NeutralResourceCultureName,
                                                              resourceFile));
            return;
        }