private void GetReferences(Roles role, Regex r, string[] ignore = null, string[] allow = null, string defaultExt = null) { var input = !Role.HasFlag(Roles.Description) ? new ScnSyntax.Comment().Replace(Text, "") : Text; foreach (Match m in r.Matches(input)) { if (ignore != null && ignore.Contains(m.Value)) { continue; } var path = ((role == Roles.Description ? BaseDirectory : SceneryDirectory) + "\\" + m.Value).Replace('/', '\\'); var ext = System.IO.Path.GetExtension(m.Value); if (defaultExt != null && ext == "") { ext = defaultExt; path += ext; } if (System.IO.File.Exists(path)) { if (allow != null && !allow.Contains(ext)) { continue; } if (!References.Any(p => p.Path == path)) { var reference = new ProjectFile(path, role); References.Add(reference); reference.GetReferences(); } } } }
internal ProjectPanel(ProjectFile file) { SuspendLayout(); Font = _defaultFont; CloseButton = false; CloseButtonVisible = false; Project = file; Text = Messages.Scenery; Tree = new ProjectTree() { Name = Text, Dock = DockStyle.Fill, LabelEdit = true }; Root = Tree.Nodes.Add(Project.FileName, Project.FileName, 0); Root.Tag = Project; Project.GetReferences(); Project.ReferencesResolved += file_ReferencesResolved; ReloadScheme(); Controls.Add(Tree); DockPanel = Main.DockPanel; DockPanel.DockRightPortion = 300; Show(DockPanel, DockState.DockRightAutoHide); Tree.Sort(); ResumeLayout(); }
private void GetReferences(Roles role, Regex r, string[] ignore = null, string[] allow = null, string defaultExt = null) { var input = !Role.HasFlag(Roles.Description) ? new ScnSyntax.Comment().Replace(Text, "") : Text; foreach (Match m in r.Matches(input)) { if (ignore != null && ignore.Contains(m.Value)) continue; var path = ((role == Roles.Description ? BaseDirectory : SceneryDirectory) + "\\" + m.Value).Replace('/', '\\'); var ext = System.IO.Path.GetExtension(m.Value); if (defaultExt != null && ext == "") { ext = defaultExt; path += ext; } if (System.IO.File.Exists(path)) { if (allow != null && !allow.Contains(ext)) continue; if (!References.Any(p => p.Path == path)) { var reference = new ProjectFile(path, role); References.Add(reference); reference.GetReferences(); } } } }