Exemplo n.º 1
0
		static public ArrayList ScanEnvironmentForAssemblies (string env_var, string fallback_path, ForeachDirMethod method)
		{
			ArrayList assemblies = new ArrayList ();

			string path = Environment.GetEnvironmentVariable (env_var);

			if (path == null || path == "")
				path = fallback_path;
			else if (path [path.Length-1] == ':')
				path += fallback_path;

			Hashtable seen = new Hashtable ();

			foreach (string dir in path.Split (':')) {
				if (! seen.Contains (dir)) {
					foreach (Assembly a in ScanDirectoryForAssemblies (dir)) {
						assemblies.Add (a);

						if (method != null)
							method (a);
					}
				}

				seen [dir] = true;
			}

			return assemblies;
		}
Exemplo n.º 2
0
        static public ArrayList ScanEnvironmentForAssemblies(string env_var, string fallback_path, ForeachDirMethod method)
        {
            ArrayList assemblies = new ArrayList();

            string path = Environment.GetEnvironmentVariable(env_var);

            if (path == null || path == "")
            {
                path = fallback_path;
            }
            else if (path [path.Length - 1] == ':')
            {
                path += fallback_path;
            }

            Hashtable seen = new Hashtable();

            foreach (string dir in path.Split(':'))
            {
                if (!seen.Contains(dir))
                {
                    foreach (Assembly a in ScanDirectoryForAssemblies(dir))
                    {
                        assemblies.Add(a);

                        if (method != null)
                        {
                            method(a);
                        }
                    }
                }

                seen [dir] = true;
            }

            return(assemblies);
        }