예제 #1
0
 static void initLibrary(Compiler compiler)
 {
     Microsoft.Win32.RegistryKey rk = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\.NETFramework");
     if (rk != null)
     {
         string InstallRoot = (string)rk.GetValue("InstallRoot");
         string Version     = (string)rk.GetValue("Version");
         if (InstallRoot != null)
         {
             if (Version == null)
             {
                 foreach (string dir in Directory.GetDirectories(InstallRoot, "v*"))
                 {
                     if (File.Exists(dir + "\\mscorlib.dll"))
                     {
                         Version = Path.GetFileName(dir);
                         break;
                     }
                 }
             }
             if (!InstallRoot.EndsWith("\\"))
             {
                 InstallRoot += "\\";
             }
         }
         if (InstallRoot != null && Version != null)
         {
             compiler.AddLibraryPath(InstallRoot + Version);
         }
     }
 }
예제 #2
0
    static bool option(string arg, ref int nopts)
    {
        string arg0 = null;
        int    i;

        nopts++;
        if ((i = arg.IndexOf(':')) >= 0)
        {
            arg0 = arg.Substring(i + 1);
        }
        if (arg == "help" || arg == "?")
        {
            help();
            nopts--;
        }
        else if (arg.StartsWith("out:"))
        {
            oname = arg0;
        }
        else if (arg.StartsWith("r:") || arg.StartsWith("reference:"))
        {
            foreach (string f in arg0.Split(','))
            {
                if (!compiler.AddReference(f.Split('=')[0]))
                {
                    compiler.Msg.WriteLine("{0}: can't find \"{1}\"", progname, f);
                }
            }
        }
        else if (arg.StartsWith("lib:"))
        {
            for ( ; (i = arg0.IndexOf(',')) >= 0; arg0 = arg0.Substring(i + 1))
            {
                compiler.AddLibraryPath(arg0.Substring(0, i));
            }
            compiler.AddLibraryPath(arg0);
        }
        else
        {
            return(false);
        }
        return(true);
    }