/// <summary> /// Create a new project file or return a reference to one in the project if it already exists /// </summary> /// <param name="szAbsPath">Absolute path to file</param> /// <param name="bAlreadyInProject">Whether the project file already exists in the project</param> /// <param name="project">Project to aid in file creation</param> /// <returns>Project file</returns> public SledProjectFilesFileType CreateFrom(string szAbsPath, SledProjectFilesType project, out bool bAlreadyInProject) { // Check for existing var file = m_projectFilesFinderService.Get.Find(szAbsPath); if (file != null) { bAlreadyInProject = true; return(file); } // Create new file = SledProjectFilesFileType.Create(szAbsPath, project); SetupFile(file); // Check if matching open document ISledDocument sd; if (m_documentService.Get.IsOpen(new Uri(szAbsPath), out sd)) { // Set references SetReferences(file, sd); } bAlreadyInProject = false; return(file); }
/// <summary> /// Create a new project file or return a reference to one in the project if it already exists /// </summary> /// <param name="szAbsPath">Absolute path to file</param> /// <param name="bAlreadyInProject">Whether the project file already exists in the project</param> /// <param name="project">Project to aid in file creation</param> /// <returns>Project file</returns> public SledProjectFilesFileType CreateFrom(string szAbsPath, SledProjectFilesType project, out bool bAlreadyInProject) { // Check for existing var file = m_projectFilesFinderService.Get.Find(szAbsPath); if (file != null) { bAlreadyInProject = true; return file; } // Create new file = SledProjectFilesFileType.Create(szAbsPath, project); SetupFile(file); // Check if matching open document ISledDocument sd; if (m_documentService.Get.IsOpen(new Uri(szAbsPath), out sd)) { // Set references SetReferences(file, sd); } bAlreadyInProject = false; return file; }
/// <summary> /// Constructor /// </summary> /// <param name="project">Project</param> /// <param name="file">File</param> /// <param name="oldPath">Old path (used when file path is changing)</param> /// <param name="newPath">New path (used when file path is changing)</param> public SledProjectServiceFileEventArgs(SledProjectFilesType project, SledProjectFilesFileType file, string oldPath, string newPath) : base(project) { File = file; OldPath = oldPath; NewPath = newPath; }
/// <summary> /// Constructor /// </summary> /// <param name="project">Project</param> /// <param name="folder">Folder</param> /// <param name="oldName">Old name (used when folder name is changed)</param> /// <param name="newName">New name (used when folder name is changed)</param> public SledProjectServiceFolderEventArgs(SledProjectFilesType project, SledProjectFilesFolderType folder, string oldName, string newName) : base(project) { Folder = folder; OldName = oldName; NewName = newName; }
/// <summary> /// Constructor /// </summary> /// <param name="project">Project</param> /// <param name="oldName">Old project name</param> /// <param name="newName">New project name</param> /// <param name="oldProjDir">Old project directory</param> /// <param name="newProjDir">New project directory</param> /// <param name="oldAssetDir">Old asset directory</param> /// <param name="newAssetDir">New asset directory</param> public SledProjectServiceProjectSaveAsEventArgs(SledProjectFilesType project, string oldName, string newName, string oldProjDir, string newProjDir, string oldAssetDir, string newAssetDir) : base(project) { OldName = oldName; NewName = newName; OldProjectDir = oldProjDir; NewProjectDir = newProjDir; OldAssetDir = oldAssetDir; NewAssetDir = newAssetDir; }
/// <summary> /// Constructor /// </summary> /// <param name="project">Project</param> /// <param name="oldName">Old project name</param> /// <param name="newName">New project name</param> /// <param name="oldProjDir">Old project directory</param> /// <param name="newProjDir">New project directory</param> /// <param name="oldAssetDir">Old asset directory</param> /// <param name="newAssetDir">New asset directory</param> public SledProjectServiceProjectSaveAsEventArgs(SledProjectFilesType project, string oldName, string newName, string oldProjDir, string newProjDir, string oldAssetDir, string newAssetDir) : base(project) { OldName = oldName; NewName = newName; OldProjectDir = oldProjDir; NewProjectDir = newProjDir; OldAssetDir = oldAssetDir; NewAssetDir = newAssetDir; }
private static SledLuaCompileSettingsType FindLuaCompileSettingsElement(SledProjectFilesType project) { var settingsElement = project.UserSettings.FirstOrDefault( setting => setting.Is <SledLuaCompileSettingsType>()); return (settingsElement == null ? null : settingsElement.As <SledLuaCompileSettingsType>()); }
private static SledLuaVarFiltersType FindLuaVarFiltersElement(SledProjectFilesType project) { var filtersElement = project.UserSettings.FirstOrDefault( setting => setting.Is <SledLuaVarFiltersType>()); return (filtersElement == null ? null : filtersElement.As <SledLuaVarFiltersType>()); }
private void Enable(SledProjectFilesType project) { if (m_watcher == null) { return; } // Enable watching m_watcher.EnableRaisingEvents = true; // Refresh stats m_fileStats = SledFileSystemFileStats.GetStats(project.AbsolutePath); }
private void SetupCompileAttribute(SledProjectFilesType project) { if (project == null) { return; } foreach (var file in project.AllFiles) { if (file.LanguagePlugin != m_luaLanguagePlugin) { continue; } SetupCompileAttribute(file); } }
/// <summary> /// Create a new project file or return a reference to one in the project if it already exists /// </summary> /// <param name="sd">Open document</param> /// <param name="bAlreadyInProject">Whether the project file already exists in the project</param> /// <param name="project">Project to aid in file creation</param> /// <returns>Project file</returns> public SledProjectFilesFileType CreateFrom(ISledDocument sd, SledProjectFilesType project, out bool bAlreadyInProject) { // Check for existing var file = m_projectFilesFinderService.Get.Find(sd); if (file != null) { bAlreadyInProject = true; return file; } // Create new file = SledProjectFilesFileType.Create(sd.Uri.LocalPath, project); SetupFile(file); // Set references SetReferences(file, sd); bAlreadyInProject = false; return file; }
private void SetupCompileSettings(SledProjectFilesType project) { // Find compile settings m_luaCompileSettings = FindLuaCompileSettingsElement(project); if (m_luaCompileSettings != null) { return; } var domNode = new DomNode(SledLuaSchema.SledLuaCompileSettingsType.Type); // Create compile settings if they don't exist m_luaCompileSettings = domNode.As <SledLuaCompileSettingsType>(); m_luaCompileSettings.Name = "Lua Compile Settings"; // Add compile settings to project project.UserSettings.Add(m_luaCompileSettings); // Write compile settings to disk m_projectService.SaveSettings(); }
/// <summary> /// Create a new project file or return a reference to one in the project if it already exists /// </summary> /// <param name="sd">Open document</param> /// <param name="bAlreadyInProject">Whether the project file already exists in the project</param> /// <param name="project">Project to aid in file creation</param> /// <returns>Project file</returns> public SledProjectFilesFileType CreateFrom(ISledDocument sd, SledProjectFilesType project, out bool bAlreadyInProject) { // Check for existing var file = m_projectFilesFinderService.Get.Find(sd); if (file != null) { bAlreadyInProject = true; return(file); } // Create new file = SledProjectFilesFileType.Create(sd.Uri.LocalPath, project); SetupFile(file); // Set references SetReferences(file, sd); bAlreadyInProject = false; return(file); }
private void Create(SledProjectFilesType project) { Cleanup(); var absPath = project.AbsolutePath; // Create new file watcher for the project m_watcher = new SledFileSystemWatcher { Tag = project, Path = Path.GetDirectoryName(absPath), Filter = Path.GetFileName(absPath), NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.Attributes, SynchronizingObject = m_mainForm }; m_watcher.Changed += WatcherChanged; m_watcher.EnableRaisingEvents = true; // Get initial stats m_fileStats = SledFileSystemFileStats.GetStats(absPath); }
/// <summary> /// Try and find a file with the specified path in the project /// </summary> /// <param name="szAbsPath">Absolute path to file</param> /// <param name="project">Project to look in</param> /// <returns>Reference to file in the project otherwise null</returns> public SledProjectFilesFileType Find(string szAbsPath, SledProjectFilesType project) { if (string.IsNullOrEmpty(szAbsPath)) { return(null); } if (!File.Exists(szAbsPath)) { return(null); } if (project == null) { return(null); } SledProjectFilesFileType projFile; m_dictProjFiles.TryGetValue(szAbsPath, out projFile); return(projFile); }
private void Create(SledProjectFilesType project) { Cleanup(); var absPath = project.AbsolutePath; // Create new file watcher for the project m_watcher = new SledFileSystemWatcher { Tag = project, Path = Path.GetDirectoryName(absPath), Filter = Path.GetFileName(absPath), NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.Attributes, SynchronizingObject = m_mainForm }; m_watcher.Changed += WatcherChanged; m_watcher.EnableRaisingEvents = true; // Get initial stats m_fileStats = SledFileSystemFileStats.GetStats(absPath); }
/// <summary> /// Try and find a file with the specified path in the project /// </summary> /// <param name="szAbsPath">Absolute path to file</param> /// <param name="project">Project to look in</param> /// <returns>Reference to file in the project otherwise null</returns> public SledProjectFilesFileType Find(string szAbsPath, SledProjectFilesType project) { if (string.IsNullOrEmpty(szAbsPath)) return null; if (!File.Exists(szAbsPath)) return null; if (project == null) return null; SledProjectFilesFileType projFile; m_dictProjFiles.TryGetValue(szAbsPath, out projFile); return projFile; }
/// <summary> /// Constructor /// </summary> /// <param name="project">Project</param> /// <param name="oldName">Old project name</param> /// <param name="newName">New project name</param> public SledProjectServiceProjectNameEventArgs(SledProjectFilesType project, string oldName, string newName) : base(project) { OldName = oldName; NewName = newName; }
private static SledLuaCompileSettingsType FindLuaCompileSettingsElement(SledProjectFilesType project) { var settingsElement = project.UserSettings.FirstOrDefault( setting => setting.Is<SledLuaCompileSettingsType>()); return settingsElement == null ? null : settingsElement.As<SledLuaCompileSettingsType>(); }
/// <summary> /// Try and find a matching ISledProjectFilesFileType in the project /// </summary> /// <param name="file">File to look for</param> /// <param name="project">Project to look in</param> /// <returns>Reference to file in the project otherwise null</returns> public SledProjectFilesFileType Find(SledProjectFilesFileType file, SledProjectFilesType project) { return file == null ? null : Find(file.AbsolutePath, project); }
/// <summary> /// Constructor /// </summary> /// <param name="project">Project</param> /// <param name="folder">Folder</param> public SledProjectServiceFolderEventArgs(SledProjectFilesType project, SledProjectFilesFolderType folder) : this(project, folder, string.Empty, string.Empty) { }
private void AddBreakpoints(SledProjectFilesType project) { try { m_bAddingOrRemoving = true; var bpInvalids = new List<SledProjectFilesBreakpointType>(); // Go through files in project adding breakpoints to the GUI // Also add breakpoint indicators to open documents that // correspond to files in the project foreach (var file in project.AllFiles) { var sd = file.SledDocument; foreach (var bp in file.Breakpoints) { var bValid = true; if (sd != null) { // Verify breakpoint not already set on line // and that the line is valid if (!sd.IsBreakpointSet(bp.Line) && !sd.IsValidLine(bp.Line)) { bValid = false; bpInvalids.Add(bp); } } // Breakpoint isn't valid so skip to next if (!bValid) continue; // Breakpoint needs to get added but first lets see // if there's an IBreakpoint we can associate it with // Get breakpoint from the open document IBreakpoint ibp = null; if (sd != null) { if (sd.IsBreakpointSet(bp.Line)) { // Grab existing ibp = sd.Editor.GetBreakpoint(bp.Line); } else { // Create new indicator in the document sd.Editor.Breakpoint(bp.Line, true); if (sd.IsBreakpointSet(bp.Line)) ibp = sd.Editor.GetBreakpoint(bp.Line); } // Couldn't set breakpoint somehow? if (ibp == null) { bpInvalids.Add(bp); continue; } } if (ibp != null) { // Copy over values first ibp.Enabled = bp.Enabled; ibp.Marker = bp.ConditionEnabled; } // Set reference bp.Breakpoint = ibp; // Fire event OnBreakpointAdded(new SledBreakpointServiceBreakpointEventArgs(bp)); } if (sd != null) { AddBreakpoints(sd, sd.Editor.GetBreakpoints()); sd.Control.Refresh(); } } // Remove invalid breakpoints foreach (var bp in bpInvalids) { bp.File.Breakpoints.Remove(bp); } } finally { m_bAddingOrRemoving = false; } }
/// <summary> /// Constructor /// </summary> /// <param name="project">Project</param> /// <param name="oldDirectory">Old project asset directory</param> /// <param name="newDirectory">New project asset directory</param> public SledProjectServiceAssetDirEventArgs(SledProjectFilesType project, string oldDirectory, string newDirectory) : base(project) { OldDirectory = oldDirectory; NewDirectory = newDirectory; }
/// <summary> /// Try and find a file with the specified path in the project /// </summary> /// <param name="uri">Path to file</param> /// <param name="project">Project to look in</param> /// <returns>Reference to file in the project otherwise null</returns> public SledProjectFilesFileType Find(Uri uri, SledProjectFilesType project) { return(Find(uri.LocalPath, project)); }
/// <summary> /// Try and find a SledDocument in the specified project /// </summary> /// <param name="sd">SledDocument to look for</param> /// <param name="project">Project to look in</param> /// <returns>Reference to file in the project otherwise null</returns> public SledProjectFilesFileType Find(ISledDocument sd, SledProjectFilesType project) { return(sd == null ? null : Find(sd.Uri, project)); }
/// <summary> /// Constructor /// </summary> /// <param name="project">Project</param> /// <param name="file">File</param> public SledProjectServiceFileEventArgs(SledProjectFilesType project, SledProjectFilesFileType file) : this(project, file, string.Empty, string.Empty) { }
/// <summary> /// Constructor /// </summary> /// <param name="project">Project</param> /// <param name="oldDirectory">Old project asset directory</param> /// <param name="newDirectory">New project asset directory</param> public SledProjectServiceAssetDirEventArgs(SledProjectFilesType project, string oldDirectory, string newDirectory) : base(project) { OldDirectory = oldDirectory; NewDirectory = newDirectory; }
/// <summary> /// Constructor /// </summary> /// <param name="project">Project</param> /// <param name="oldGuid">Old project GUID</param> /// <param name="newGuid">New project GUID</param> public SledProjectServiceProjectGuidEventArgs(SledProjectFilesType project, Guid oldGuid, Guid newGuid) : base(project) { OldGuid = oldGuid; NewGuid = newGuid; }
/// <summary> /// Try and find a SledDocument in the specified project /// </summary> /// <param name="sd">SledDocument to look for</param> /// <param name="project">Project to look in</param> /// <returns>Reference to file in the project otherwise null</returns> public SledProjectFilesFileType Find(ISledDocument sd, SledProjectFilesType project) { return sd == null ? null : Find(sd.Uri, project); }
private void SubscribeToEvents(SledProjectFilesType project) { project.DomNode.AttributeChanging += CollectionAttributeChanging; project.DomNode.AttributeChanged += CollectionAttributeChanged; project.DomNode.ChildInserted += CollectionChildInserted; project.DomNode.ChildRemoving += CollectionChildRemoving; }
/// <summary> /// Constructor /// </summary> /// <param name="project">Project</param> /// <param name="oldGuid">Old project GUID</param> /// <param name="newGuid">New project GUID</param> public SledProjectServiceProjectGuidEventArgs(SledProjectFilesType project, Guid oldGuid, Guid newGuid) : base(project) { OldGuid = oldGuid; NewGuid = newGuid; }
private static SledLuaVarFiltersType FindLuaVarFiltersElement(SledProjectFilesType project) { var filtersElement = project.UserSettings.FirstOrDefault( setting => setting.Is<SledLuaVarFiltersType>()); return filtersElement == null ? null : filtersElement.As<SledLuaVarFiltersType>(); }
/// <summary> /// Constructor /// </summary> /// <param name="project">Project</param> /// <param name="file">File</param> public SledProjectServiceFileEventArgs(SledProjectFilesType project, SledProjectFilesFileType file) : this(project, file, string.Empty, string.Empty) { }
private void SetupCompileAttribute(SledProjectFilesType project) { if (project == null) return; foreach (var file in project.AllFiles) { if (file.LanguagePlugin != m_luaLanguagePlugin) continue; SetupCompileAttribute(file); } }
/// <summary> /// Constructor /// </summary> /// <param name="project">Project</param> public SledProjectServiceProjectEventArgs(SledProjectFilesType project) { Project = project; }
public ProjectAdapter(SledProjectFilesType project, ISledDocumentService documentService) { m_project = project; m_documentService = documentService; }
/// <summary> /// Try and find a file with the specified path in the project /// </summary> /// <param name="uri">Path to file</param> /// <param name="project">Project to look in</param> /// <returns>Reference to file in the project otherwise null</returns> public SledProjectFilesFileType Find(Uri uri, SledProjectFilesType project) { return Find(uri.LocalPath, project); }
private void Enable(SledProjectFilesType project) { if (m_watcher == null) return; // Enable watching m_watcher.EnableRaisingEvents = true; // Refresh stats m_fileStats = SledFileSystemFileStats.GetStats(project.AbsolutePath); }
/// <summary> /// Constructor /// </summary> /// <param name="project">Project</param> /// <param name="file">File</param> /// <param name="oldPath">Old path (used when file path is changing)</param> /// <param name="newPath">New path (used when file path is changing)</param> public SledProjectServiceFileEventArgs(SledProjectFilesType project, SledProjectFilesFileType file, string oldPath, string newPath) : base(project) { File = file; OldPath = oldPath; NewPath = newPath; }
private void SetupCompileSettings(SledProjectFilesType project) { // Find compile settings m_luaCompileSettings = FindLuaCompileSettingsElement(project); if (m_luaCompileSettings != null) return; var domNode = new DomNode(SledLuaSchema.SledLuaCompileSettingsType.Type); // Create compile settings if they don't exist m_luaCompileSettings = domNode.As<SledLuaCompileSettingsType>(); m_luaCompileSettings.Name = "Lua Compile Settings"; // Add compile settings to project project.UserSettings.Add(m_luaCompileSettings); // Write compile settings to disk m_projectService.SaveSettings(); }
/// <summary> /// Try and find a matching ISledProjectFilesFileType in the project /// </summary> /// <param name="file">File to look for</param> /// <param name="project">Project to look in</param> /// <returns>Reference to file in the project otherwise null</returns> public SledProjectFilesFileType Find(SledProjectFilesFileType file, SledProjectFilesType project) { return(file == null ? null : Find(file.AbsolutePath, project)); }
/// <summary> /// Constructor /// </summary> /// <param name="project">Project</param> public SledProjectServiceProjectEventArgs(SledProjectFilesType project) { Project = project; }
/// <summary> /// Constructor /// </summary> /// <param name="project">Project</param> /// <param name="folder">Folder</param> public SledProjectServiceFolderEventArgs(SledProjectFilesType project, SledProjectFilesFolderType folder) : this(project, folder, string.Empty, string.Empty) { }
/// <summary> /// Constructor /// </summary> /// <param name="project">Project</param> /// <param name="folder">Folder</param> /// <param name="oldName">Old name (used when folder name is changed)</param> /// <param name="newName">New name (used when folder name is changed)</param> public SledProjectServiceFolderEventArgs(SledProjectFilesType project, SledProjectFilesFolderType folder, string oldName, string newName) : base(project) { Folder = folder; OldName = oldName; NewName = newName; }
private void RemoveBreakpoints(SledProjectFilesType project) { try { m_bAddingOrRemoving = true; foreach (var file in project.AllFiles) { var sd = file.SledDocument; foreach (var bp in file.Breakpoints) { // Remove from open document (if any) if ((sd != null) && sd.IsBreakpointSet(bp.Line)) { sd.Editor.Breakpoint(bp.Line, false); } // Fire event OnBreakpointRemoving(new SledBreakpointServiceBreakpointEventArgs(bp)); } } } finally { m_bAddingOrRemoving = false; } }
/// <summary> /// Constructor /// </summary> /// <param name="project">Project</param> /// <param name="oldName">Old project name</param> /// <param name="newName">New project name</param> public SledProjectServiceProjectNameEventArgs(SledProjectFilesType project, string oldName, string newName) : base(project) { OldName = oldName; NewName = newName; }
private void UnsubscribeFromEvents(SledProjectFilesType project) { project.DomNode.ChildInserted -= CollectionChildInserted; project.DomNode.ChildRemoving -= CollectionChildRemoving; }
public ProjectAdapter(SledProjectFilesType project, ISledDocumentService documentService) { m_project = project; m_documentService = documentService; }