public string GenerateDatabase(string runtimeId, TargetFrameworkMoniker fxId, string baseDir, string assemblyFile)
        {
            try {
                Runtime.Initialize(false);
                ParserDatabase pdb     = new ParserDatabase();
                TargetRuntime  runtime = Runtime.SystemAssemblyService.GetTargetRuntime(runtimeId);
                if (runtime == null)
                {
                    LoggingService.LogError("Runtime '{0}' not found", runtimeId);
                }
                TargetFramework fx = Runtime.SystemAssemblyService.GetTargetFramework(fxId);

                // Generate the new db in a temp file. The main process will move the file if required.
                using (var db = new AssemblyCodeCompletionDatabase(runtime, fx, assemblyFile, pdb, true)) {
                    if (db.LoadError)
                    {
                        throw new InvalidOperationException("Could find assembly: " + assemblyFile);
                    }
                    db.ParseInExternalProcess = false;
                    db.ParseAll();
                    db.Write();
                    return(db.RealDataFile);
                }
            } catch (Exception ex) {
                Console.WriteLine(ex);
                return(null);
            }
        }
Пример #2
0
 void DeleteObsoleteDatabases()
 {
     string[] files = Directory.GetFiles(ProjectDomService.CodeCompletionPath, "*.pidb");
     foreach (string file in files)
     {
         string name    = Path.GetFileNameWithoutExtension(file);
         string baseDir = Path.GetDirectoryName(file);
         AssemblyCodeCompletionDatabase.CleanDatabase(baseDir, name);
     }
 }
		public string GenerateDatabase (string runtimeId, TargetFrameworkMoniker fxId, string baseDir, string assemblyFile)
		{
			try {
				Runtime.Initialize (false);
				ParserDatabase pdb = new ParserDatabase ();
				TargetRuntime runtime = Runtime.SystemAssemblyService.GetTargetRuntime (runtimeId);
				if (runtime == null)
					LoggingService.LogError ("Runtime '{0}' not found", runtimeId);
				TargetFramework fx = Runtime.SystemAssemblyService.GetTargetFramework (fxId);

				// Generate the new db in a temp file. The main process will move the file if required.
				using (var db = new AssemblyCodeCompletionDatabase (runtime, fx, assemblyFile, pdb, true)) {
					if (db.LoadError)
						throw new InvalidOperationException ("Could find assembly: " + assemblyFile);
					db.ParseInExternalProcess = false;
					db.ParseAll ();
					db.Write ();
					return db.RealDataFile;
				}
			} catch (Exception ex) {
				Console.WriteLine (ex);
				return null;
			}
		}