Ejemplo n.º 1
0
        private AssemblyLocationProvider GetOrCreateAssemblyLocationProvider(string mvid)
        {
            if (assemblies.ContainsKey(mvid))
            {
                return(assemblies[mvid]);
            }

            var mvidDir = Path.Combine(msymDir, mvid);

            if (!Directory.Exists(mvidDir))
            {
                logger.LogWarning("MVID directory does not exist: {0}", mvidDir);
                return(null);
            }

            string assemblyPath = null;
            var    exeFiles     = Directory.GetFiles(mvidDir, "*.exe");
            var    dllFiles     = Directory.GetFiles(mvidDir, "*.dll");

            if (exeFiles.Length + dllFiles.Length != 1)
            {
                logger.LogError("MVID directory should include one assembly: {0}", mvidDir);
                return(null);
            }

            assemblyPath = exeFiles.Length > 0 ? exeFiles[0] : dllFiles[0];

            var locProvider = new AssemblyLocationProvider(assemblyPath, logger);

            assemblies.Add(mvid, locProvider);

            return(locProvider);
        }
Ejemplo n.º 2
0
		private AssemblyLocationProvider GetOrCreateAssemblyLocationProvider (string mvid)
		{
			if (assemblies.ContainsKey (mvid))
				return assemblies[mvid];

			var mvidDir = Path.Combine (msymDir, mvid);
			if (!Directory.Exists (mvidDir)) {
				logger.LogWarning ("MVID directory does not exist: {0}", mvidDir);
				return  null;
			}

			string assemblyPath = null;
			var exeFiles = Directory.GetFiles (mvidDir, "*.exe");
			var dllFiles = Directory.GetFiles (mvidDir, "*.dll");

			if (exeFiles.Length + dllFiles.Length != 1) {
				logger.LogError ("MVID directory should include one assembly: {0}", mvidDir);
				return null;
			}

			assemblyPath = (exeFiles.Length > 0)? exeFiles[0] : dllFiles[0];

			var locProvider = new AssemblyLocationProvider (assemblyPath, logger);

			assemblies.Add (mvid, locProvider);

			return locProvider;
		}