Пример #1
0
        /// <summary>
        /// Find satellite assemblies.
        /// </summary>
        /// <param name="directoryName">Directory of the parrent assembly.</param>
        /// <param name="fullPath">Path to the parent assembly.</param>
        /// <param name="reference">The reference to the parent assembly.</param>
        private void FindSatellites
        (
            Reference reference
        )
        {
            try
            {
                // If the directory doesn't exist (which is possible in the situation
                // where we were passed in a pre-resolved reference from a P2P reference
                // that hasn't actually been built yet), then GetDirectories will throw.
                // Avoid that by just short-circuiting here.
                if (!_directoryExists(reference.DirectoryName))
                {
                    return;
                }

                string[] subDirectories = _getDirectories(reference.DirectoryName, "*.");
                string sateliteFilename = reference.FileNameWithoutExtension + ".resources.dll";

                foreach (string subDirectory in subDirectories)
                {
                    // Is there a candidate satellite in that folder?
                    string cultureName = Path.GetFileName(subDirectory);

                    if (CultureStringUtilities.IsValidCultureString(cultureName))
                    {
                        string satelliteAssembly = Path.Combine(subDirectory, sateliteFilename);
                        if (_fileExists(satelliteAssembly))
                        {
                            // This is valid satellite assembly. 
                            reference.AddSatelliteFile(Path.Combine(cultureName, sateliteFilename));
                        }
                    }
                }
            }
            catch (Exception e)
            {
                if (ExceptionHandling.NotExpectedException(e))
                {
                    throw;
                }

                if (_log != null)
                {
                    _log.LogErrorFromResources("ResolveAssemblyReference.ProblemFindingSatelliteAssemblies", reference.FullPath, e.Message);
                }
            }
        }
 private void FindSatellites(Reference reference)
 {
     try
     {
         if (this.directoryExists(reference.DirectoryName))
         {
             string[] strArray = this.getDirectories(reference.DirectoryName, "*.");
             string str = reference.FileNameWithoutExtension + ".resources.dll";
             foreach (string str2 in strArray)
             {
                 string fileName = Path.GetFileName(str2);
                 if (CultureStringUtilities.IsValidCultureString(fileName))
                 {
                     string path = Path.Combine(str2, str);
                     if (this.fileExists(path))
                     {
                         reference.AddSatelliteFile(Path.Combine(fileName, str));
                     }
                 }
             }
         }
     }
     catch (Exception exception)
     {
         if (Microsoft.Build.Shared.ExceptionHandling.NotExpectedException(exception))
         {
             throw;
         }
         if (this.log != null)
         {
             this.log.LogErrorFromResources("ResolveAssemblyReference.ProblemFindingSatelliteAssemblies", new object[] { reference.FullPath, exception.Message });
         }
     }
 }