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); } }
public SimpleCodeCompletionDatabase (string file, ParserDatabase pdb): base (pdb, false) { AddFile (file); this.file = file; string requiredRefUri = "Assembly:" + Runtime.SystemAssemblyService.DefaultRuntime.Id + ":"; requiredRefUri += Runtime.SystemAssemblyService.DefaultAssemblyContext.GetAssemblyForVersion (typeof(object).Assembly.FullName, null, Services.ProjectService.DefaultTargetFramework).Location; AddReference (requiredRefUri); }
public SimpleCodeCompletionDatabase(string file, ParserDatabase pdb) : base(pdb, false) { AddFile(file); this.file = file; string requiredRefUri = "Assembly:" + Runtime.SystemAssemblyService.DefaultRuntime.Id + ":"; requiredRefUri += Runtime.SystemAssemblyService.DefaultAssemblyContext.GetAssemblyForVersion(typeof(object).Assembly.FullName, null, Services.ProjectService.DefaultTargetFramework).Location; AddReference(requiredRefUri); }
public void Add(ClassEntry value) { string name = ParserDatabase.GetDecoratedName(value); contents [name] = value; if (contents_ci != null) { contents_ci [name] = value; } }
public SimpleCodeCompletionDatabase (string file, ParserDatabase pdb): base (pdb, false) { AddFile (file); this.file = file; string requiredRefUri = "Assembly:" + Runtime.SystemAssemblyService.DefaultRuntime.Id + ":"; var assembly = Runtime.SystemAssemblyService.DefaultAssemblyContext.GetAssemblyForVersion ("mscorlib", null, Services.ProjectService.DefaultTargetFramework); if (assembly == null) { LoggingService.LogError ("Can't find runtime directory for :" + Services.ProjectService.DefaultTargetFramework); return; } requiredRefUri += assembly.Location; AddReference (requiredRefUri); }
public ClassEntry GetClass(string name, int genericArgumentCount, bool caseSensitive) { string fullName = ParserDatabase.GetDecoratedName(name, genericArgumentCount); ClassEntry ne = contents[fullName] as ClassEntry; if (ne != null || caseSensitive) { return(ne); } if (contents_ci == null) { BuildCaseInsensitiveTable(); } return(contents_ci[fullName] as ClassEntry); }
public SimpleCodeCompletionDatabase(string file, ParserDatabase pdb) : base(pdb, false) { AddFile(file); this.file = file; string requiredRefUri = "Assembly:" + Runtime.SystemAssemblyService.DefaultRuntime.Id + ":"; var assembly = Runtime.SystemAssemblyService.DefaultAssemblyContext.GetAssemblyForVersion("mscorlib", null, Services.ProjectService.DefaultTargetFramework); if (assembly == null) { LoggingService.LogError("Can't find runtime directory for :" + Services.ProjectService.DefaultTargetFramework); return; } requiredRefUri += assembly.Location; AddReference(requiredRefUri); }
public ProjectCodeCompletionDatabase (Project project, ParserDatabase pdb): base (pdb, true) { Counters.LiveProjectDatabases++; this.project = project; SetLocation (project.BaseDirectory, project.Name); Read (); UpdateFromProject (); project.FileChangedInProject += new ProjectFileEventHandler (OnFileChanged); project.FileAddedToProject += new ProjectFileEventHandler (OnFileAdded); project.FileRemovedFromProject += new ProjectFileEventHandler (OnFileRemoved); project.FileRenamedInProject += new ProjectFileRenamedEventHandler (OnFileRenamed); project.Modified += new SolutionItemModifiedEventHandler (OnProjectModified); initialFileCheck = true; }
public ProjectCodeCompletionDatabase(Project project, ParserDatabase pdb) : base(pdb, true) { Counters.LiveProjectDatabases++; this.project = project; SetLocation(project.BaseDirectory, project.Name); Read(); UpdateFromProject(); project.FileChangedInProject += new ProjectFileEventHandler(OnFileChanged); project.FileAddedToProject += new ProjectFileEventHandler(OnFileAdded); project.FileRemovedFromProject += new ProjectFileEventHandler(OnFileRemoved); project.FileRenamedInProject += new ProjectFileRenamedEventHandler(OnFileRenamed); project.Modified += new SolutionItemModifiedEventHandler(OnProjectModified); initialFileCheck = true; }
public AssemblyCodeCompletionDatabase (TargetRuntime runtime, TargetFramework fx, string assemblyFile, ParserDatabase pdb): this (runtime, fx, assemblyFile, pdb, false) { }
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; } }
public AssemblyCodeCompletionDatabase(TargetRuntime runtime, TargetFramework fx, string assemblyFile, ParserDatabase pdb, bool isTempDatabase) : base(pdb, false) { Counters.LiveAssemblyDatabases++; this.runtime = runtime; this.fx = fx; this.assemblyFile = assemblyFile; if (!File.Exists(assemblyFile)) { loadError = true; return; } string name = assemblyFile.Replace(',', '_').Replace(" ", "").Replace(":", "").Replace(Path.DirectorySeparatorChar, '_'); SystemPackage package = Runtime.SystemAssemblyService.GetPackageFromPath(assemblyFile); if (package != null) { isPackageAssembly = true; packageVersion = package.Name + " " + package.Version; } else { isPackageAssembly = false; } this.baseDir = ProjectDomService.CodeCompletionPath; if (isTempDatabase) { SetFile(Path.GetTempFileName()); } else { SetLocation(baseDir, name); Read(); } ArrayList oldFiles = new ArrayList(); foreach (FileEntry e in GetAllFiles()) { if (e.FileName != assemblyFile) { oldFiles.Add(e); } } foreach (FileEntry e in oldFiles) { RemoveFile(e.FileName); } if (!files.ContainsKey(assemblyFile)) { AddFile(assemblyFile); headers ["CheckFile"] = assemblyFile; } FileEntry fe = GetFile(assemblyFile); if (IsFileModified(fe)) { // Update references to other assemblies Hashtable rs = new Hashtable(); foreach (string uri in ReadAssemblyReferences()) { rs[uri] = null; if (!HasReference(uri)) { AddReference(uri); } } foreach (ReferenceEntry re in References) { if (!rs.Contains(re.Uri)) { RemoveReference(re.Uri); } } } }
public AssemblyCodeCompletionDatabase(TargetRuntime runtime, TargetFramework fx, string assemblyFile, ParserDatabase pdb) : this(runtime, fx, assemblyFile, pdb, false) { }
public void Remove(ClassEntry entry) { contents.Remove(ParserDatabase.GetDecoratedName(entry)); contents_ci = null; }
public AssemblyCodeCompletionDatabase (TargetRuntime runtime, TargetFramework fx, string assemblyFile, ParserDatabase pdb, bool isTempDatabase): base (pdb, false) { Counters.LiveAssemblyDatabases++; this.runtime = runtime; this.fx = fx; this.assemblyFile = assemblyFile; if (!File.Exists (assemblyFile)) { loadError = true; return; } string name = assemblyFile.Replace(',','_').Replace(" ","").Replace (":","").Replace(Path.DirectorySeparatorChar,'_'); SystemPackage package = Runtime.SystemAssemblyService.GetPackageFromPath (assemblyFile); if (package != null) { isPackageAssembly = true; packageVersion = package.Name + " " + package.Version; } else isPackageAssembly = false; this.baseDir = ProjectDomService.CodeCompletionPath; if (isTempDatabase) SetFile (Path.GetTempFileName ()); else { SetLocation (baseDir, name); Read (); } ArrayList oldFiles = new ArrayList (); foreach (FileEntry e in GetAllFiles ()) { if (e.FileName != assemblyFile) oldFiles.Add (e); } foreach (FileEntry e in oldFiles) RemoveFile (e.FileName); if (!files.ContainsKey (assemblyFile)) { AddFile (assemblyFile); headers ["CheckFile"] = assemblyFile; } FileEntry fe = GetFile (assemblyFile); if (IsFileModified (fe)) { // Update references to other assemblies Hashtable rs = new Hashtable (); foreach (string uri in ReadAssemblyReferences ()) { rs[uri] = null; if (!HasReference (uri)) AddReference (uri); } foreach (ReferenceEntry re in References) { if (!rs.Contains (re.Uri)) RemoveReference (re.Uri); } } }
public DatabaseProjectDom (ParserDatabase dbProvider, SerializationCodeCompletionDatabase database) { this.dbProvider = dbProvider; this.database = database; database.SourceProjectDom = this; }
public DatabaseProjectDom(ParserDatabase dbProvider, SerializationCodeCompletionDatabase database) { this.dbProvider = dbProvider; this.database = database; database.SourceProjectDom = this; }