Microsoft.Cci.MetadataHostEnvironment.Probe C# (CSharp) Method

Probe() protected method

Looks in the specified probeDir to see if a file exists, first with the extension "dll" and then with the extensions "winmd" and "exe". Returns null if not found, otherwise constructs a new AssemblyIdentity
protected Probe ( string probeDir, Microsoft.Cci.AssemblyIdentity referencedAssembly ) : Microsoft.Cci.AssemblyIdentity
probeDir string
referencedAssembly Microsoft.Cci.AssemblyIdentity
return Microsoft.Cci.AssemblyIdentity
    protected virtual AssemblyIdentity/*?*/ Probe(string probeDir, AssemblyIdentity referencedAssembly) {
      Contract.Requires(probeDir != null);
      Contract.Requires(referencedAssembly != null);

      string path = Path.Combine(probeDir, referencedAssembly.Name.Value + ".dll");
      if (!File.Exists(path)) path = Path.Combine(probeDir, referencedAssembly.Name.Value + ".winmd");
      if (!File.Exists(path)) path = Path.Combine(probeDir, referencedAssembly.Name.Value + ".exe");
      if (!File.Exists(path)) return null;
      var assembly = this.LoadUnitFrom(path) as IAssembly;
      if (assembly == null) return null;
      if (!assembly.AssemblyIdentity.Equals(referencedAssembly)) return null;
      return assembly.AssemblyIdentity;
    }