public Project GetProject(string path) { int contextId; if (!ProjectContextMapping.TryGetValue(path, out contextId)) { return(null); } return(Projects[contextId]); }
public bool TryAddProject(string projectFile, out int contextId) { contextId = -1; if (ProjectContextMapping.ContainsKey(projectFile)) { return(false); } contextId = ++_contextId; // Create a mapping from path to contextid and back ProjectContextMapping[projectFile] = contextId; Projects[contextId] = new Project { Path = projectFile, ContextId = contextId }; return(true); }
public bool TryAddProject(string projectFile, out Project project) { project = null; if (ProjectContextMapping.ContainsKey(projectFile)) { return(false); } var contextId = ++_contextId; // Create a mapping from path to contextid and back ProjectContextMapping[projectFile] = contextId; project = new Project { Path = projectFile, ContextId = contextId }; Projects[contextId] = project; return(true); }