public static FileName GetAppConfigFile(IProject project, bool createIfNotExists) { FileName appConfigFileName = Core.FileName.Create(Path.Combine(project.Directory, "app.config")); if (!File.Exists(appConfigFileName)) { if (createIfNotExists) { File.WriteAllText(appConfigFileName, "<?xml version=\"1.0\"?>" + Environment.NewLine + "<configuration>" + Environment.NewLine + "</configuration>"); } else { return(null); } } if (!project.IsFileInProject(appConfigFileName)) { FileProjectItem fpi = new FileProjectItem(project, ItemType.None, "app.config"); ProjectService.AddProjectItem(project, fpi); FileService.FireFileCreated(appConfigFileName, false); ProjectBrowserPad.RefreshViewAsync(); } return(appConfigFileName); }
public ProjectBrowserPad() { instance = this; SD.ProjectService.SolutionOpened += ProjectServiceSolutionLoaded; SD.ProjectService.SolutionClosed += ProjectServiceSolutionClosed; SD.Workbench.ActiveContentChanged += ActiveContentChanged; if (ProjectService.OpenSolution != null) { this.LoadSolution(ProjectService.OpenSolution); } ActiveContentChanged(null, null); }
public ProjectBrowserPad() { instance = this; ProjectService.SolutionLoaded += ProjectServiceSolutionLoaded; ProjectService.SolutionClosed += ProjectServiceSolutionClosed; ProjectService.SolutionPreferencesSaving += ProjectServiceSolutionPreferencesSaving; WorkbenchSingleton.Workbench.ActiveContentChanged += ActiveContentChanged; if (ProjectService.OpenSolution != null) { this.LoadSolution(ProjectService.OpenSolution); } ActiveContentChanged(null, null); }
public ProjectBrowserPad() { instance = this; SD.ProjectService.SolutionOpened += ProjectServiceSolutionLoaded; SD.ProjectService.SolutionClosed += ProjectServiceSolutionClosed; SD.Workbench.ActiveContentChanged += ActiveContentChanged; if (ProjectService.OpenSolution != null) { this.LoadSolution(ProjectService.OpenSolution); } ActiveContentChanged(null, null); }
public ProjectBrowserPad() { instance = this; ProjectService.SolutionLoaded += ProjectServiceSolutionLoaded; ProjectService.SolutionClosed += ProjectServiceSolutionClosed; ProjectService.SolutionPreferencesSaving += ProjectServiceSolutionPreferencesSaving; WorkbenchSingleton.Workbench.ActiveWorkbenchWindowChanged += ActiveWindowChanged; if (ProjectService.OpenSolution != null) { ProjectServiceSolutionLoaded(null, new SolutionEventArgs(ProjectService.OpenSolution)); } ActiveWindowChanged(null, null); }
public ProjectBrowserPad() { instance = this; ProjectService.SolutionLoaded += ProjectServiceSolutionLoaded; ProjectService.SolutionClosed += ProjectServiceSolutionClosed; ProjectService.SolutionPreferencesSaving += ProjectServiceSolutionPreferencesSaving; WorkbenchSingleton.Workbench.ActiveWorkbenchWindowChanged += ActiveWindowChanged; if (ProjectService.OpenSolution != null) { ProjectServiceSolutionLoaded(null, new SolutionEventArgs(ProjectService.OpenSolution)); } ActiveWindowChanged(null, null); }
public ProjectBrowserPad() { instance = this; ProjectService.SolutionLoaded += ProjectServiceSolutionLoaded; ProjectService.SolutionClosed += ProjectServiceSolutionClosed; ProjectService.SolutionPreferencesSaving += ProjectServiceSolutionPreferencesSaving; WorkbenchSingleton.Workbench.ActiveContentChanged += ActiveContentChanged; if (ProjectService.OpenSolution != null) { this.LoadSolution(ProjectService.OpenSolution); } ActiveContentChanged(null, null); }
public IProject AddExistingProject(FileName fileName) { if (parentSolution.Projects.Any(p => p.FileName == fileName)) { throw new ProjectLoadException("Project " + fileName + " is already part of this solution."); } ProjectLoadInformation loadInfo = new ProjectLoadInformation(parentSolution, fileName, fileName.GetFileNameWithoutExtension()); IProject project = SD.ProjectService.LoadProject(loadInfo); if (parentSolution.GetItemByGuid(project.IdGuid) != null) { SD.Log.Warn("Added project has duplicate GUID; a new GUID will be generated."); project.IdGuid = Guid.NewGuid(); } this.Items.Add(project); project.ProjectLoaded(); ProjectBrowserPad.RefreshViewAsync(); return(project); }
public FileProjectItem EnsureOutputFileIsInProject(FileProjectItem baseItem, string outputFileName, bool isPrimaryOutput) { if (baseItem == null) { throw new ArgumentNullException("baseItem"); } if (baseItem.Project != project) { throw new ArgumentException("baseItem is not from project this CustomToolContext belongs to"); } SD.MainThread.VerifyAccess(); bool saveProject = false; if (isPrimaryOutput) { if (baseItem.GetEvaluatedMetadata("LastGenOutput") != Path.GetFileName(outputFileName)) { saveProject = true; baseItem.SetEvaluatedMetadata("LastGenOutput", Path.GetFileName(outputFileName)); } } FileProjectItem outputItem = project.FindFile(FileName.Create(outputFileName)); if (outputItem == null) { outputItem = new FileProjectItem(project, ItemType.Compile); outputItem.FileName = FileName.Create(outputFileName); outputItem.DependentUpon = Path.GetFileName(baseItem.FileName); outputItem.SetEvaluatedMetadata("AutoGen", "True"); ProjectService.AddProjectItem(project, outputItem); FileService.FireFileCreated(outputFileName, false); saveProject = true; ProjectBrowserPad.RefreshViewAsync(); } if (saveProject) { project.Save(); } return(outputItem); }