Esempio n. 1
0
        public virtual void Remove([NotNull] IProjectItem projectItem)
        {
            lock (this)
            {
                GuidIndex.Remove(projectItem);
                UriIndex.Remove(projectItem);
                QualifiedNameIndex.Remove(projectItem);
                ShortNameIndex.Remove(projectItem);

                foreach (var snapshot in projectItem.GetSnapshots())
                {
                    SourceFileIndex.Remove(snapshot.SourceFile.GetDirectoryAndFileNameWithoutExtensions());
                }

                var databaseProjectItem = projectItem as DatabaseProjectItem;
                if (databaseProjectItem != null)
                {
                    GuidDatabaseIndex.Remove(databaseProjectItem);
                    QualifiedNameDatabaseIndex.Remove(databaseProjectItem);
                    ShortNameDatabaseIndex.Remove(databaseProjectItem);
                }

                var item = projectItem as Item;
                if (item != null && !item.IsImport)
                {
                    Items.Remove(item);
                }

                if (item != null)
                {
                    ChildrenIndex.Remove(item);
                }

                var template = projectItem as Template;
                if (template != null && !template.IsImport)
                {
                    Templates.Remove(template);
                }
            }
        }
Esempio n. 2
0
        public virtual void Add([NotNull] IProjectItem projectItem)
        {
            lock (this)
            {
                GuidIndex.Add(projectItem);
                UriIndex.Add(projectItem);
                QualifiedNameIndex.Add(projectItem);
                ShortNameIndex.Add(projectItem);

                foreach (var snapshot in projectItem.GetSnapshots())
                {
                    SourceFileIndex.Add(snapshot.SourceFile.GetDirectoryAndFileNameWithoutExtensions(), projectItem);
                }

                if (projectItem is DatabaseProjectItem databaseProjectItem)
                {
                    GuidDatabaseIndex.Add(databaseProjectItem);
                    QualifiedNameDatabaseIndex.Add(databaseProjectItem);
                    ShortNameDatabaseIndex.Add(databaseProjectItem);
                }

                if (projectItem is Item item)
                {
                    ChildrenIndex.Add(item);

                    if (!item.IsImport)
                    {
                        Items.Add(item);
                    }
                }

                if (projectItem is Template template && !template.IsImport)
                {
                    Templates.Add(template);
                }
            }
        }
Esempio n. 3
0
 public virtual IEnumerable <T> GetBySourceFile <T>([NotNull] ISourceFile sourceFile) where T : class, IProjectItem
 {
     return(SourceFileIndex.Where <T>(sourceFile.GetDirectoryAndFileNameWithoutExtensions()));
 }