Пример #1
0
        protected override IProjectContent LoadProjectContent(string itemInclude, string itemFileName)
        {
            if (File.Exists(itemFileName))
            {
                return(ParserService.DefaultProjectContentRegistry.GetProjectContentForReference(itemInclude, itemFileName));
            }
            MonoAssemblyName assemblyName = MonoGlobalAssemblyCache.FindAssemblyName(itemInclude);

            if (assemblyName != null && assemblyName.FileName != null)
            {
                return(CecilReader.LoadAssembly(assemblyName.FileName, this));
            }
            else
            {
                if (MonoToolLocationHelper.IsMonoInstalled)
                {
                    HostCallback.ShowAssemblyLoadError(itemFileName, itemInclude, "Could not find assembly in Mono's GAC.");
                }
                else
                {
                    HostCallback.ShowAssemblyLoadError(itemFileName, itemInclude, "Could not find assembly in Mono's GAC - Mono is not installed.");
                }
                return(null);
            }
        }
        string GetAssemblyLocation(string name)
        {
            MonoAssemblyName assemblyName = MonoGlobalAssemblyCache.FindAssemblyName(name);

            if (assemblyName != null)
            {
                return(assemblyName.FileName);
            }
            return(String.Empty);
        }
Пример #3
0
    public MonoAssemblyEnum()
    {
        string binDir = MonoGACHelpers.GetGACDir();

        binDir = Path.GetDirectoryName(binDir);
        binDir = Path.GetDirectoryName(binDir);
        binDir = Path.GetDirectoryName(binDir);

        // Run gacutil to get the list.
        ProcessStartInfo info = new ProcessStartInfo();

        info.UseShellExecute        = false;
        info.RedirectStandardOutput = true;

        if ((int)Environment.OSVersion.Platform == 4 || (int)Environment.OSVersion.Platform == 128)
        {
            // Running under Unix.
            info.FileName  = "gacutil";
            info.Arguments = "-l";
        }
        else
        {
            // Running under Windows.
            info.FileName  = "cmd.exe";
            info.Arguments = "/C \"" + Path.Combine(Path.Combine(binDir, "bin"), "gacutil.bat") + "\" -l";
        }

        Process p       = Process.Start(info);
        string  sOutput = p.StandardOutput.ReadToEnd();

        p.Close();

        string [] lines = sOutput.Split(new char[] { '\n' });
        m_Names = new MonoAssemblyName[lines.Length - 3];
        for (int i = 1; i < lines.Length - 2; i++)
        {
            string    sLine           = lines[i].Replace("\r", "");
            string [] parts           = sLine.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries);
            string    sAssemblyName   = parts[0];
            string    sVersion        = parts[1].Split(new char[] { '=' })[1];
            string    sCulture        = parts[2].Split(new char[] { '=' })[1];
            string    sPublicKeyToken = parts[3].Split(new char[] { '=' })[1];

            m_Names[i - 1] = new MonoAssemblyName(sAssemblyName, sVersion, sCulture, sPublicKeyToken, sLine);
        }

        m_nCurrentName = 0;
    }
Пример #4
0
 static extern bool ParseAssemblyName(IntPtr name, out MonoAssemblyName aname, out bool is_version_definited, out bool is_token_defined);
Пример #5
0
		public MonoAssemblyEnum()
		{
			string binDir = MonoGACHelpers.GetGACDir();
			binDir = Path.GetDirectoryName( binDir ); 
			binDir = Path.GetDirectoryName( binDir ); 
			binDir = Path.GetDirectoryName( binDir ); 
			
			// Run gacutil to get the list.
			ProcessStartInfo info = new ProcessStartInfo();
			info.UseShellExecute = false;
			info.RedirectStandardOutput = true;
			
			if ( (int)Environment.OSVersion.Platform == 4 || (int)Environment.OSVersion.Platform == 128 )
			{
				// Running under Unix.
				info.FileName = "gacutil";
				info.Arguments = "-l";
			}
			else
			{
				// Running under Windows.
				info.FileName = "cmd.exe";
				info.Arguments = "/C \"" + Path.Combine( Path.Combine(binDir, "bin"), "gacutil.bat" ) + "\" -l";
			}
			
			Process p = Process.Start( info );
			string sOutput = p.StandardOutput.ReadToEnd();
			p.Close();
			
			string [] lines = sOutput.Split( new char[] { '\n' } );
			m_Names = new MonoAssemblyName[lines.Length - 3];
			for ( int i=1; i < lines.Length-2; i++ )
			{
				string sLine = lines[i].Replace( "\r", "" );
				string [] parts = sLine.Split( new string[] {", "}, StringSplitOptions.RemoveEmptyEntries );
				string sAssemblyName = parts[0];
				string sVersion = parts[1].Split( new char[] {'='} )[1];
				string sCulture = parts[2].Split( new char[] {'='} )[1];
				string sPublicKeyToken = parts[3].Split( new char[] {'='} )[1];
				
				m_Names[i-1] = new MonoAssemblyName( sAssemblyName, sVersion, sCulture, sPublicKeyToken, sLine );
			}
			
			m_nCurrentName = 0;
		}