public bool ReloadMissingProject(string fileSystemPath) { if (fileSystemPath == null) { throw new ArgumentNullException("fileSystemPath"); } if (!File.Exists(fileSystemPath)) { return(false); } CrcsProject crcsProject = CrcsProject.OpenProject(fileSystemPath, this); _projects.Add(crcsProject); if (_initialized) { _isDirty = true; } return(true); }
private void LoadSolution() { _projects.Clear(); _missingProjects.Clear(); if (!File.Exists(FileSystemPath)) { return; } XDocument xdoc = XDocument.Load(FileSystemPath); IEnumerable <XElement> projectFilesElements = xdoc.Descendants("Projects").Descendants("Item"); foreach (XElement xnode in projectFilesElements) { string path = FolderUtility.GetRootedPath(SolutionPath, xnode.Value.Replace('\\', Path.DirectorySeparatorChar)); if (File.Exists(path)) { if ( _projects.FirstOrDefault(x => x.FileSystemPath.Equals(path, StringComparison.OrdinalIgnoreCase)) != null) { continue; } CrcsProject crcsProject = CrcsProject.OpenProject(path, this); _projects.Add(crcsProject); XAttribute attr = xnode.Attribute("IncludeInBuild"); if (attr != null && attr.Value.Equals("true", StringComparison.OrdinalIgnoreCase)) { crcsProject.IsIncluded = true; } else { crcsProject.IsIncluded = false; } } else if ((Path.GetExtension(path) ?? "").Equals(".rsproj", StringComparison.OrdinalIgnoreCase)) { _missingProjects.Add(path); } } IEnumerable <XElement> propertiesElements = xdoc.Descendants("Properties").Descendants("Item"); foreach (XElement xnode in propertiesElements) { XAttribute attr = xnode.Attribute("Name"); if (attr == null) { continue; } string propertyName = attr.Value; PropertyInfo propertyInfo = _properties.GetType().GetProperty(propertyName); if (propertyInfo != null && propertyInfo.InProjectFile().StoreInProjectFile&& propertyInfo.CanWrite) { object value = Convert.ChangeType(xnode.Value, propertyInfo.PropertyType); propertyInfo.SetValue(_properties, value, null); } } LoadSolutionSettings(); }