public void CreateHeadOnlyCommits_MessageSet()
        {
            var f1            = new FileInfo("file1").WithBranch("branch1", "1.1.0.2");
            var f2            = new FileInfo("file2").WithBranch("branch1", "1.1.0.2");
            var mainCommit1   = new Commit("c1").WithRevision(f1, "1.1").WithRevision(f2, "1.1");
            var branchCommit1 = new Commit("c2").WithRevision(f1, "1.1.2.1").WithRevision(f2, "1.1.2.1");

            var branchpoints = new Dictionary <string, Commit>()
            {
                { "branch1", mainCommit1 },
            };

            IEnumerable <Commit> commits = new[] { mainCommit1, branchCommit1 };
            var streams = new BranchStreamCollection(commits, branchpoints);

            // rename branch1
            var renamer = new Renamer();

            renamer.AddRule(new RenameRule(@"^MAIN$", "master"));
            renamer.AddRule(new RenameRule(@"^branch(\d)", "BRANCH#$1"));
            m_config.Stub(c => c.BranchRename).Return(renamer);

            m_config.Stub(c => c.IncludeFile("file1")).Return(true);
            m_config.Stub(c => c.IncludeFile("file2")).Return(false);
            m_config.Stub(c => c.IsHeadOnly("file1")).Return(false);
            m_config.Stub(c => c.IsHeadOnly("file2")).Return(true);

            var filter = new ExclusionFilter(m_log, m_config);

            commits = filter.Filter(commits).ToListIfNeeded();

            filter.CreateHeadOnlyCommits(new[] { "MAIN", "branch1" }, streams, AllFiles(f1, f2));
            Assert.AreEqual(streams.Head("MAIN").Message, "Adding head-only files to master");
            Assert.AreEqual(streams.Head("branch1").Message, "Adding head-only files to BRANCH#1");
        }
Пример #2
0
        /// <summary>
        /// Check Element Intersect With Element Selected By BoundingBox
        /// </summary>
        /// <param name="commandData"></param>
        /// <param name="message"></param>
        /// <param name="elements"></param>
        /// <returns></returns>
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
            UIDocument    uidoc = uiapp.ActiveUIDocument;
            Application   app   = uiapp.Application;
            Document      doc   = uidoc.Document;

            Element element = doc.GetElement(uidoc.Selection.PickObject(ObjectType.Element));

            ExclusionFilter excludedFilter = new ExclusionFilter(new List <ElementId>()
            {
                element.Id
            });
            BoundingBoxXYZ bbxyz   = element.get_BoundingBox(doc.ActiveView);
            Outline        outline = new Outline(bbxyz.Min, bbxyz.Max);
            BoundingBoxIntersectsFilter intersectFilter = new BoundingBoxIntersectsFilter(outline);
            IList <Element>             eleIntersect    = new FilteredElementCollector(doc)
                                                          .WhereElementIsNotElementType()
                                                          .WherePasses(excludedFilter)
                                                          .WherePasses(intersectFilter).ToElements()
                                                          .Where(x => x.Category.Name != "Cameras")
                                                          .Where(x => !string.IsNullOrEmpty(x.Name)).ToList();
            StringBuilder sb = new StringBuilder();

            if (eleIntersect.Any())
            {
                foreach (Element e in eleIntersect)
                {
                    sb.AppendLine($"Name:{e.Name}-Category:{e.Category.Name}-Id:{e.Id}");
                }
            }
            MessageBox.Show($"Element Intersect : \n{sb}");
            return(Result.Succeeded);
        }
        public void CreateHeadOnlyCommits_MergeFromBranch()
        {
            var f1            = new FileInfo("file1").WithBranch("branch1", "1.1.0.2");
            var f2            = new FileInfo("file2").WithBranch("branch1", "1.1.0.2");
            var mainCommit1   = new Commit("c1").WithRevision(f1, "1.1").WithRevision(f2, "1.1");
            var branchCommit1 = new Commit("c2").WithRevision(f1, "1.1.2.1").WithRevision(f2, "1.1.2.1");
            var mainCommit2   = new Commit("c3").WithRevision(f1, "1.2", mergepoint: "1.1.2.1").WithRevision(f2, "1.2", mergepoint: "1.1.2.1");

            var branchpoints = new Dictionary <string, Commit>()
            {
                { "branch1", mainCommit2 },
            };

            IEnumerable <Commit> commits = new[] { mainCommit1, branchCommit1, mainCommit2 };
            var streams = new BranchStreamCollection(commits, branchpoints);

            m_config.Stub(c => c.IncludeFile("file1")).Return(true);
            m_config.Stub(c => c.IncludeFile("file2")).Return(false);
            m_config.Stub(c => c.IsHeadOnly("file1")).Return(false);
            m_config.Stub(c => c.IsHeadOnly("file2")).Return(true);
            m_config.Stub(c => c.BranchRename).Return(new Renamer());

            var filter = new ExclusionFilter(m_log, m_config);

            commits = filter.Filter(commits).ToListIfNeeded();

            filter.CreateHeadOnlyCommits(new[] { "MAIN", "branch1" }, streams, AllFiles(f1, f2));
            Assert.AreEqual(streams.Head("MAIN").CommitId, "headonly-MAIN", "Commit created on HEAD");
            Assert.AreEqual(streams.Head("branch1").CommitId, "headonly-branch1", "Commit created on branch1");
            Assert.AreSame(streams.Head("MAIN").MergeFrom, streams.Head("branch1"), "Merge from branch1 to HEAD");
        }
Пример #4
0
        private static string GenerateExclusionFilter()
        {
            var where = new StringBuilder("1 = 0");

            try
            {
                var filters = ExclusionFilter.Split(',');
                foreach (var filter in filters)
                {
                    var filterTrimmed = filter.Trim();
                    if (filterTrimmed.Length != 0)
                    {
                        where.Append(" OR P.Name LIKE '");
                        where.Append(filterTrimmed.Replace("'", "''"));
                        where.Append("'");
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception("Could not retrieve exclusions from file", e);
            }

            return(where.ToString());
        }
Пример #5
0
        //回傳有碰到ele的BoundingBox的牆或版
        public IList <Element> GetBoundingBoxIntersectsElements(Element ele, String elementType)
        {
            Document doc = ele.Document;
            //--去除ele本身過濾器
            List <ElementId> excludedElementID = new List <ElementId>();

            excludedElementID.Add(ele.Id);
            ExclusionFilter excludedFilter = new ExclusionFilter(excludedElementID);
            //--邊界框相交過濾器
            BoundingBoxXYZ boundingBoxOfEle             = ele.get_BoundingBox(doc.ActiveView);
            Outline        outline                      = ExtendBoundingBox(boundingBoxOfEle);
            BoundingBoxIntersectsFilter intersectFilter = new BoundingBoxIntersectsFilter(outline);

            //--建立圖元過濾器
            FilteredElementCollector collector = new FilteredElementCollector(doc, doc.ActiveView.Id);

            switch (elementType)
            {
            case "floor":
                collector.OfClass(typeof(Floor)).WhereElementIsNotElementType().WherePasses(excludedFilter).WherePasses(intersectFilter);
                break;

            case "wall":
                collector.OfClass(typeof(Wall)).WhereElementIsNotElementType().WherePasses(intersectFilter);
                break;

            default:
                MessageBox.Show("依照設定參數回傳有碰到ele的牆或版錯誤", "錯誤訊息");
                break;
            }

            IList <Element> intersectElement = collector.ToElements();

            return(intersectElement);
        }
Пример #6
0
        public static IList <Element> GetInterferingElements(Document doc, Element element)
        {
            Solid solid = GetSolid(element);

            if (solid == null)
            {
                throw new ArgumentNullException("GetSolid()==null");
            }
            FilteredElementCollector collector =
                new FilteredElementCollector(doc);
            ElementIntersectsSolidFilter intrudingElemsFilter =
                new ElementIntersectsSolidFilter(solid, false);
            ExclusionFilter exclusionFilter =
                new ExclusionFilter(new List <ElementId> {
                element.Id
            });
            ICollection <Element> envadingElements = collector
                                                     .OfClass(typeof(Floor))
                                                     .WherePasses(exclusionFilter)
                                                     .WherePasses(intrudingElemsFilter)
                                                     .WhereElementIsNotElementType()
                                                     .ToElements();

            IList <Element> orderedEnvadingElems =
                envadingElements.OrderBy((Element e) =>
            {
                return(((Level)doc
                        .GetElement(e.LevelId)).Elevation);
            }).ToList();

            return(orderedEnvadingElems);
        }
Пример #7
0
        public bool InstrumentClass(string assemblyName, string className)
        {
            if (string.IsNullOrEmpty(assemblyName) || string.IsNullOrEmpty(className))
            {
                return(false);
            }

            if (ExclusionFilter
                .Any(keyValuePair => Regex.Match(assemblyName, keyValuePair.Key.WrapWithAnchors()).Success&& keyValuePair.Value == ".*"))
            {
                return(false);
            }

            if (ExclusionFilter
                .Where(keyValuePair => Regex.Match(assemblyName, keyValuePair.Key.WrapWithAnchors()).Success&& keyValuePair.Value != ".*")
                .Any(keyValuePair => Regex.Match(className, keyValuePair.Value.WrapWithAnchors()).Success))
            {
                return(false);
            }

            if (InclusionFilter
                .Where(keyValuePair => Regex.Match(assemblyName, keyValuePair.Key.WrapWithAnchors()).Success)
                .Any(keyValuePair => Regex.Match(className, keyValuePair.Value.WrapWithAnchors()).Success))
            {
                return(true);
            }

            return(false);
        }
Пример #8
0
        public static IList <Element> GetWallsIntersectBoundingBox(Document doc, Element elem)
        {
            ExclusionFilter exclusionFilter =
                new ExclusionFilter(new List <ElementId> {
                elem.Id
            });

            ElementParameterFilter elementParameterFilter =
                new ElementParameterFilter(ParameterFilterRuleFactory
                                           .CreateEqualsRule(new ElementId(BuiltInParameter.WALL_BASE_CONSTRAINT), elem.LevelId), true);

            BoundingBoxXYZ bndBx = elem.get_Geometry
                                       (new Options {
                IncludeNonVisibleObjects = true
            }).GetBoundingBox();

            BoundingBoxIntersectsFilter bndBxFlt =
                new BoundingBoxIntersectsFilter(new Outline(bndBx.Min, bndBx.Max), 0.1);

            IList <Element> elements = new FilteredElementCollector(doc)
                                       .WherePasses(exclusionFilter)
                                       .OfClass(typeof(Wall))
                                       .WherePasses(bndBxFlt)
                                       .WherePasses(elementParameterFilter)
                                       .ToElements()
                                       .ToList();

            return(elements);
        }
Пример #9
0
        static IList <Element> GetInterferingFloors(Document doc, Element elem)
        {
            Solid solid = RvtGeometryUtils.GetSolid(elem);

            if (solid == null)
            {
                throw new ArgumentNullException("GetUppermostSolid(elem)==null");
            }
            FilteredElementCollector collector =
                new FilteredElementCollector(doc);
            ElementIntersectsSolidFilter intrudingElemFilter =
                new ElementIntersectsSolidFilter(solid, false);
            ExclusionFilter exclusionFilter =
                new ExclusionFilter(new List <ElementId> {
                elem.Id
            });
            ICollection <Element> envadingFloors = collector
                                                   .OfClass(typeof(Floor))
                                                   .WherePasses(exclusionFilter)
                                                   .WherePasses(intrudingElemFilter)
                                                   .WhereElementIsNotElementType()
                                                   .ToElements();

            IList <Element> envadingFloorsOrderedByLevel =
                envadingFloors.OrderBy((Element e) =>
            {
                return(((Level)doc
                        .GetElement(e.LevelId)).Elevation);
            }).ToList();

            return(envadingFloorsOrderedByLevel);
        }
        public void CreateHeadOnlyCommits_FileDeletedInMerge()
        {
            var f1            = new FileInfo("file1").WithBranch("branch1", "1.1.0.2");
            var f2            = new FileInfo("file2").WithBranch("branch1", "1.1.0.2");
            var mainCommit1   = new Commit("c1").WithRevision(f1, "1.1").WithRevision(f2, "1.1");
            var branchCommit1 = new Commit("c2").WithRevision(f1, "1.1.2.1").WithRevision(f2, "1.1.2.1");
            var mainCommit2   = new Commit("c3").WithRevision(f1, "1.2", mergepoint: "1.1.2.1").WithRevision(f2, "1.2", mergepoint: "1.1.2.1");
            var mainCommit3   = new Commit("c4").WithRevision(f2, "1.3", isDead: true);

            var branchpoints = new Dictionary <string, Commit>()
            {
                { "branch1", mainCommit1 },
            };

            IEnumerable <Commit> commits = new[] { mainCommit1, branchCommit1, mainCommit2, mainCommit3 };
            var streams = new BranchStreamCollection(commits, branchpoints);

            m_config.Stub(c => c.IncludeFile("file1")).Return(false);
            m_config.Stub(c => c.IncludeFile("file2")).Return(false);
            m_config.Stub(c => c.IsHeadOnly("file1")).Return(true);
            m_config.Stub(c => c.IsHeadOnly("file2")).Return(true);
            m_config.Stub(c => c.BranchRename).Return(new Renamer());

            var filter = new ExclusionFilter(m_log, m_config);

            commits = filter.Filter(commits).ToListIfNeeded();

            filter.CreateHeadOnlyCommits(new[] { "MAIN", "branch1" }, streams, AllFiles(f1, f2));

            var mainHead = streams.Head("MAIN");

            Assert.IsTrue(mainHead.CommitId == "headonly-MAIN");
            Assert.IsTrue(mainHead.Where(r => !r.IsDead).Single().File.Name == "file1");
            Assert.IsTrue(mainHead.Where(r => r.IsDead).Single().File.Name == "file2");
        }
Пример #11
0
 public void ValidateFilter()
 {
     if (KCDatabase.Instance.Ships.Count > 0)
     {
         var ships = KCDatabase.Instance.Ships.Keys;
         InclusionFilter = InclusionFilter.Intersect(ships).Distinct().ToList();
         ExclusionFilter = ExclusionFilter.Intersect(ships).Distinct().ToList();
     }
 }
Пример #12
0
		public void Filter_NoMatches_CommitsUnchanged()
		{
			var f1 = new FileInfo("file1");
			var commit = new Commit("c1").WithRevision(f1, "1.1");

			m_config.Stub(c => c.IncludeFile("file1")).Return(true);
			var filter = new ExclusionFilter(m_log, m_config);

			var commits = filter.Filter(new[] { commit });
			Assert.AreSame(commits.Single(), commit);
		}
        public void Filter_NoMatches_CommitsUnchanged()
        {
            var f1     = new FileInfo("file1");
            var commit = new Commit("c1").WithRevision(f1, "1.1");

            m_config.Stub(c => c.IncludeFile("file1")).Return(true);
            var filter = new ExclusionFilter(m_log, m_config);

            var commits = filter.Filter(new[] { commit });

            Assert.AreSame(commits.Single(), commit);
        }
Пример #14
0
		public void Filter_AllFilesMatch_CommitExcluded()
		{
			var f1 = new FileInfo("file1");
			var f2 = new FileInfo("file2");
			var commit = new Commit("c1").WithRevision(f1, "1.1").WithRevision(f2, "1.1");

			m_config.Stub(c => c.IncludeFile("file1")).Return(false);
			m_config.Stub(c => c.IncludeFile("file2")).Return(false);
			var filter = new ExclusionFilter(m_log, m_config);

			var commits = filter.Filter(new[] { commit });
			Assert.IsFalse(commits.Any());
		}
        private void CollectFamilySymbols2()
        {
            try
            {
                FilteredElementCollector collector  = new FilteredElementCollector(doc);
                List <ElementFilter>     filterList = new List <ElementFilter>();
                filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_DetailComponents));
                filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_Fluids));
                filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_ModelText));
                filterList.Add(new ElementCategoryFilter(BuiltInCategory.OST_GenericAnnotation));
                LogicalOrFilter         orFilter = new LogicalOrFilter(filterList);
                ICollection <ElementId> excludes = collector.OfClass(typeof(ElementType)).WherePasses(orFilter).ToElementIds();

                ExclusionFilter excFilter = new ExclusionFilter(excludes);

                collector = new FilteredElementCollector(doc);
                collector = collector.OfClass(typeof(FamilySymbol)).WherePasses(excFilter);
                var query = from element in collector
                            where !element.Category.Name.Contains("Tag") && element.Parameters.Size > 0
                            orderby element.Category.Name
                            select element;

                List <Element> famSymbols = query.ToList <Element>();

                if (famSymbols.Count > 0)
                {
                    foreach (Element element in famSymbols)
                    {
                        ElementType elementType = element as ElementType;
                        if (null != elementType)
                        {
                            ElementTypeProperties etp = new ElementTypeProperties(elementType);
                            string categoryName       = etp.CategoryName;
                            if (elementDictionary.ContainsKey(categoryName))
                            {
                                elementDictionary[categoryName].Add(etp.TypeID, etp);
                            }
                            else
                            {
                                elementDictionary.Add(categoryName, new Dictionary <int, ElementTypeProperties>());
                                elementDictionary[categoryName].Add(etp.TypeID, etp);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to collect FamilySymbols: \n" + ex.Message, "ElementDataCollector Error:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        public void Filter_AllFilesMatch_CommitExcluded()
        {
            var f1     = new FileInfo("file1");
            var f2     = new FileInfo("file2");
            var commit = new Commit("c1").WithRevision(f1, "1.1").WithRevision(f2, "1.1");

            m_config.Stub(c => c.IncludeFile("file1")).Return(false);
            m_config.Stub(c => c.IncludeFile("file2")).Return(false);
            var filter = new ExclusionFilter(m_log, m_config);

            var commits = filter.Filter(new[] { commit });

            Assert.IsFalse(commits.Any());
        }
Пример #17
0
		public void Filter_PartialMatch_NewCommitReturned()
		{
			var f1 = new FileInfo("file1");
			var f2 = new FileInfo("file2");
			var commit = new Commit("c1").WithRevision(f1, "1.1").WithRevision(f2, "1.1");

			m_config.Stub(c => c.IncludeFile("file1")).Return(true);
			m_config.Stub(c => c.IncludeFile("file2")).Return(false);
			var filter = new ExclusionFilter(m_log, m_config);

			var commits = filter.Filter(new[] { commit });
			Assert.AreNotSame(commits.Single(), commit);
			Assert.AreEqual(commits.Single().CommitId, commit.CommitId);
			Assert.AreSame(commits.Single().Single().File, f1);
		}
        public void Filter_PartialMatch_NewCommitReturned()
        {
            var f1     = new FileInfo("file1");
            var f2     = new FileInfo("file2");
            var commit = new Commit("c1").WithRevision(f1, "1.1").WithRevision(f2, "1.1");

            m_config.Stub(c => c.IncludeFile("file1")).Return(true);
            m_config.Stub(c => c.IncludeFile("file2")).Return(false);
            var filter = new ExclusionFilter(m_log, m_config);

            var commits = filter.Filter(new[] { commit });

            Assert.AreNotSame(commits.Single(), commit);
            Assert.AreEqual(commits.Single().CommitId, commit.CommitId);
            Assert.AreSame(commits.Single().Single().File, f1);
        }
Пример #19
0
        /// <summary>
        /// Collects unplaced views by cross-referencing all views against views that are on sheets
        /// </summary>
        /// <param name="doc">The active document</param>
        /// <param name="sheets">List of sheets</param>
        /// <returns>IList</returns>
        public static IList <View> UnplacedViewCollector(Document doc, IList <Element> sheets)
        {
            ICollection <ElementId> placedViewIds = new List <ElementId>(); // initiliaze an empty collection to hold element ids

            foreach (ViewSheet sheet in sheets)
            {
                ISet <ElementId> currentPlacedViewIds = sheet.GetAllPlacedViews();
                foreach (ElementId eId in currentPlacedViewIds)
                {
                    placedViewIds.Add(eId); // add all placed ids of views placed on sheets to element ids collection
                }
            }
            ExclusionFilter placedViewsFilter = new ExclusionFilter(placedViewIds);                                                                                                                      // generate exclusion filter using placed view ids
            IList <View>    unplacedViews     = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Views).WherePasses(placedViewsFilter).Cast <View>().Where(v => !v.IsTemplate).ToList(); // add exclusion filter to filtered element collector of views

            return(unplacedViews);
        }
        public void Filter_HeadOnly_FileTracked()
        {
            var f1      = new FileInfo("file1");
            var f2      = new FileInfo("file2");
            var commit1 = new Commit("c1").WithRevision(f1, "1.1").WithRevision(f2, "1.1");
            var commit2 = new Commit("c2").WithRevision(f1, "1.2");

            m_config.Stub(c => c.IncludeFile("file1")).Return(false);
            m_config.Stub(c => c.IncludeFile("file2")).Return(false);
            m_config.Stub(c => c.IsHeadOnly("file1")).Return(true);
            var filter = new ExclusionFilter(m_log, m_config);

            var commits = filter.Filter(new[] { commit1, commit2 });

            Assert.IsFalse(commits.Any());

            Assert.AreEqual(filter.HeadOnlyState["MAIN"]["file1"].ToString(), "1.2");
        }
Пример #21
0
        IList <Element> GetViewsToDelete(Document doc)
        {
            using (Transaction trans = new Transaction(doc))
            {
                // Collect all Views except ViewTemplates
                // Add one drafting view to project before deleting
                // all views because Revit will shut down when last view
                // is deleted from project.

                // Create a new Drafting view
                ViewFamilyType viewFamilyType = new FilteredElementCollector(doc)
                                                .OfClass(typeof(ViewFamilyType))
                                                .Cast <ViewFamilyType>().First(vft => vft.ViewFamily == ViewFamily.Drafting);

                trans.Start("Delete All Views/Sheets");
                ViewDrafting view = ViewDrafting.Create(doc, viewFamilyType.Id);
                view.ViewName = "TempDraftingView";

                doc.Regenerate();

                // Collect all Views except newly created one
                List <ElementId> exclude = new List <ElementId>();
                exclude.Add(view.Id);

                ExclusionFilter filter = new ExclusionFilter(exclude);
                IList <Element> views  = new FilteredElementCollector(doc)
                                         .OfClass(typeof(View))
                                         .WhereElementIsNotElementType()
                                         .WherePasses(filter)
                                         .ToElements();

                // Remove all ViewTemplates from views to be deleted
                for (var i = 0; i < views.Count; i++)
                {
                    View v = views[i] as View;
                    if (v.IsTemplate)
                    {
                        views.RemoveAt(i);
                    }
                }
                trans.Commit();
                return(views);
            }
        }
        public void Filter_Exclude_NoHeadOnlyRules()
        {
            var f1      = new FileInfo("file1");
            var f2      = new FileInfo("file2");
            var commit1 = new Commit("c1").WithRevision(f1, "1.1").WithRevision(f2, "1.1");
            var commit2 = new Commit("c2").WithRevision(f1, "1.2");

            m_config.Stub(c => c.IncludeFile("file1")).Return(false);
            m_config.Stub(c => c.IncludeFile("file2")).Return(true);
            m_config.Stub(c => c.IsHeadOnly("file1")).Return(false);
            m_config.Stub(c => c.IsHeadOnly("file2")).Return(false);
            var filter = new ExclusionFilter(m_log, m_config);

            var commits = filter.Filter(new[] { commit1, commit2 });

            Assert.AreEqual(commits.Single().CommitId, "c1");

            Assert.IsFalse(filter.HeadOnlyState["MAIN"].LiveFiles.Any(), "No headonly files");
        }
Пример #23
0
        public bool UseAssembly(string assemblyName)
        {
            if (ExclusionFilter.Any(keyValuePair => Regex.Match(assemblyName, keyValuePair.Key.WrapWithAnchors()).Success&& keyValuePair.Value == ".*"))
            {
                return(false);
            }

            if (ExclusionFilter.Any(keyValuePair => Regex.Match(assemblyName, keyValuePair.Key.WrapWithAnchors()).Success&& keyValuePair.Value != ".*"))
            {
                return(true);
            }

            if (InclusionFilter.Any(keyValuePair => Regex.Match(assemblyName, keyValuePair.Key.WrapWithAnchors()).Success))
            {
                return(true);
            }

            return(false);
        }
Пример #24
0
        public void AddFilter(string assemblyClassName)
        {
            string     assemblyName;
            string     className;
            FilterType filterType;

            GetAssemblyClassName(assemblyClassName, out filterType, out assemblyName, out className);

            assemblyName = assemblyName.ValidateAndEscape();
            className    = className.ValidateAndEscape();

            if (filterType == FilterType.Inclusion)
            {
                InclusionFilter.Add(new KeyValuePair <string, string>(assemblyName, className));
            }

            if (filterType == FilterType.Exclusion)
            {
                ExclusionFilter.Add(new KeyValuePair <string, string>(assemblyName, className));
            }
        }
Пример #25
0
        public Watcher(WatcherOptions options, ApplicationOptions applicationOptions, ITerminal terminal, ILogger log)
        {
            if (string.IsNullOrWhiteSpace(options.FolderPath))
            {
                throw new ArgumentNullException(nameof(options.FolderPath));
            }

            this._log                = log;
            this._options            = options;
            this._applicationOptions = applicationOptions;
            this._terminal           = terminal;
            this.Name                = options.GetName();

            this._log.LogTrace("Watcher {Watcher}: checking commands", this.Name);
            this._commands = options.Commands?.Where(c => !string.IsNullOrWhiteSpace(c)) ?? Enumerable.Empty <string>();
            if (!this._commands.Any())
            {
                this._log.LogWarning("Watcher {Watcher}: no commands specified", this.Name);
            }

            this._log.LogTrace("Watcher {Watcher}: building exclusion filters", this.Name);
            this._exclusions = options.Exclusions?.Select(f => ExclusionFilter.Build(f)) ?? Enumerable.Empty <ExclusionFilter>();

            this._log.LogTrace("Watcher {Watcher}: determining working directory", this.Name);
            this._workingDirectory = string.IsNullOrWhiteSpace(this._options.WorkingDirectory) ? this._options.FolderPath : this._options.WorkingDirectory;

            this._log.LogTrace("Watcher {Watcher}: creating {Type}", this.Name, typeof(FileSystemWatcher).Name);
            this._watch = new FileSystemWatcher(options.FolderPath);
            this._watch.NotifyFilter = options.NotifyFilters;
            foreach (string filter in options.FileFilters)
            {
                this._watch.Filters.Add(filter);
            }
            this._watch.IncludeSubdirectories = options.Recursive;
            this._watch.Changed += OnFileChanged;
            this._watch.Created += OnFileChanged;
            this._watch.Renamed += OnFileChanged;
        }
Пример #26
0
        static IList <Element> GetIntersectSolidElems(Document doc, Element elem)
        {
            Solid solid = RvtGeometryUtils.GetSolid(elem);

            if (solid == null)
            {
                throw new System.ArgumentNullException("GetSolid(elem)==null");
            }
            FilteredElementCollector collector =
                new FilteredElementCollector(doc);
            ElementIntersectsSolidFilter intrudingElemFilter =
                new ElementIntersectsSolidFilter(solid, false);
            ExclusionFilter exclusionFilter =
                new ExclusionFilter(new List <ElementId> {
                elem.Id
            });

            IList <ElementFilter> strElemFilters =
                new List <ElementFilter> {
                new ElementCategoryFilter(BuiltInCategory.OST_Columns),
                new ElementCategoryFilter(BuiltInCategory.OST_StructuralFraming),
                new ElementCategoryFilter(BuiltInCategory.OST_Floors),
                new ElementCategoryFilter(BuiltInCategory.OST_Walls)
            };

            LogicalOrFilter anyStrElemFlt =
                new LogicalOrFilter(strElemFilters);

            ICollection <Element> envadingElems = collector
                                                  .WherePasses(exclusionFilter)
                                                  .WherePasses(intrudingElemFilter)
                                                  .WherePasses(anyStrElemFlt)
                                                  .WhereElementIsNotElementType()
                                                  .ToElements();

            return(envadingElems.ToList());
        }
        IList<Element> GetViewsToDelete(Document doc)
        {
            using (Transaction trans = new Transaction(doc))
            {
                // Collect all Views except ViewTemplates
                // Add one drafting view to project before deleting
                // all views because Revit will shut down when last view
                // is deleted from project.

                // Create a new Drafting view
                ViewFamilyType viewFamilyType = new FilteredElementCollector(doc)
                    .OfClass(typeof(ViewFamilyType))
                    .Cast<ViewFamilyType>().First(vft => vft.ViewFamily == ViewFamily.Drafting);

                trans.Start("Delete All Views/Sheets");
                ViewDrafting view = ViewDrafting.Create(doc, viewFamilyType.Id);
                view.ViewName = "TempDraftingView";

                doc.Regenerate();

                // Collect all Views except newly created one
                List<ElementId> exclude = new List<ElementId>();
                exclude.Add(view.Id);

                ExclusionFilter filter = new ExclusionFilter(exclude);
                IList<Element> views = new FilteredElementCollector(doc)
                    .OfClass(typeof(View))
                    .WhereElementIsNotElementType()
                    .WherePasses(filter)
                    .ToElements();

                // Remove all ViewTemplates from views to be deleted
                for (var i = 0; i < views.Count; i++)
                {
                    View v = views[i] as View;
                    if (v.IsTemplate)
                    {
                        views.RemoveAt(i);
                    }
                }
                trans.Commit();
                return views;
            }
        }
Пример #28
0
		public void Filter_Exclude_NoHeadOnlyRules()
		{
			var f1 = new FileInfo("file1");
			var f2 = new FileInfo("file2");
			var commit1 = new Commit("c1").WithRevision(f1, "1.1").WithRevision(f2, "1.1");
			var commit2 = new Commit("c2").WithRevision(f1, "1.2");

			m_config.Stub(c => c.IncludeFile("file1")).Return(false);
			m_config.Stub(c => c.IncludeFile("file2")).Return(true);
			m_config.Stub(c => c.IsHeadOnly("file1")).Return(false);
			m_config.Stub(c => c.IsHeadOnly("file2")).Return(false);
			var filter = new ExclusionFilter(m_log, m_config);

			var commits = filter.Filter(new[] { commit1, commit2 });
			Assert.AreEqual(commits.Single().CommitId, "c1");

			Assert.IsFalse(filter.HeadOnlyState["MAIN"].LiveFiles.Any(), "No headonly files");
		}
Пример #29
0
		public void Filter_HeadOnly_FileTracked()
		{
			var f1 = new FileInfo("file1");
			var f2 = new FileInfo("file2");
			var commit1 = new Commit("c1").WithRevision(f1, "1.1").WithRevision(f2, "1.1");
			var commit2 = new Commit("c2").WithRevision(f1, "1.2");

			m_config.Stub(c => c.IncludeFile("file1")).Return(false);
			m_config.Stub(c => c.IncludeFile("file2")).Return(false);
			m_config.Stub(c => c.IsHeadOnly("file1")).Return(true);
			var filter = new ExclusionFilter(m_log, m_config);

			var commits = filter.Filter(new[] { commit1, commit2 });
			Assert.IsFalse(commits.Any());

			Assert.AreEqual(filter.HeadOnlyState["MAIN"]["file1"].ToString(), "1.2");
		}
Пример #30
0
    public Result Execute(
        ExternalCommandData commandData,
        ref string message,
        ElementSet elements)
    {
        // Get application and document objects
        UIApplication uiApp = commandData.Application;
        Document      doc   = uiApp.ActiveUIDocument.Document;
        UIDocument    uidoc = uiApp.ActiveUIDocument;

        try
        {
            using (Transaction trans = new Transaction(doc, "UpperCase Views on Sheets."))
            {
                trans.Start();
                // Get all Views on sheets and change name to upper case
                int counter = 0;
                List <ElementId> viewsOnSheets = new List <ElementId>();
                foreach (View v in new FilteredElementCollector(doc)
                         .OfClass(typeof(View)))
                {
                    foreach (ViewSheet vs in new FilteredElementCollector(doc)
                             .OfClass(typeof(ViewSheet))
                             .Cast <ViewSheet>())
                    {
                        ICollection <ElementId> viewsIds = vs.GetAllPlacedViews();
                        List <View>             views    = new List <View>();
                        foreach (ElementId id in viewsIds)
                        {
                            View e = doc.GetElement(id) as View;
                            views.Add(e);
                        }
                        foreach (View view in views)
                        {
                            if (view.Id == v.Id)
                            {
                                try
                                {
                                    view.Name = view.Name.ToUpper();
                                    viewsOnSheets.Add(view.Id);
                                    counter++;
                                }
                                catch (Exception x)
                                {
                                    message = x.Message;
                                }
                            }
                        }
                        views.Clear();
                    }
                }
                // get all views not on sheets by using exclusion filter and change names to lowercase
                ExclusionFilter filter           = new ExclusionFilter(viewsOnSheets);
                IList <Element> viewsNotOnSheets = new FilteredElementCollector(doc)
                                                   .OfClass(typeof(View))
                                                   .WhereElementIsNotElementType()
                                                   .WherePasses(filter)
                                                   .ToElements();
                try
                {
                    foreach (View v in viewsNotOnSheets)
                    {
                        v.Name = v.Name.ToLower();
                        counter++;
                    }
                }
                catch (Exception x)
                {
                    message = x.Message;
                }

                // Get all schedules on sheets and change name to upper case
                IList <Element> schInstances = new FilteredElementCollector(doc)
                                               .OfClass(typeof(ScheduleSheetInstance))
                                               .ToElements();
                List <ViewSchedule> masterSchedules  = new List <ViewSchedule>();
                List <ElementId>    schedulesOnSheet = new List <ElementId>();

                foreach (ScheduleSheetInstance ssi in schInstances)
                {
                    ViewSchedule masterSchedule = doc.GetElement(ssi.ScheduleId) as ViewSchedule;
                    masterSchedules.Add(masterSchedule);
                }
                var distinctSchedules = masterSchedules.GroupBy(x => x.Id).Select(y => y.First());
                foreach (ViewSchedule vs in distinctSchedules)
                {
                    try
                    {
                        vs.Name = vs.Name.ToUpper();
                        schedulesOnSheet.Add(vs.Id);
                        counter++;
                    }
                    catch (Exception x)
                    {
                        message = x.Message;
                    }
                }
                // Get all schedules not on sheets and change name to lower case
                ExclusionFilter schFilter           = new ExclusionFilter(schedulesOnSheet);
                IList <Element> schedulesNotOnSheet = new FilteredElementCollector(doc)
                                                      .OfClass(typeof(ViewSchedule))
                                                      .WhereElementIsNotElementType()
                                                      .WherePasses(schFilter)
                                                      .ToElements();

                foreach (ViewSchedule vs in schedulesNotOnSheet)
                {
                    try
                    {
                        vs.Name = vs.Name.ToLower();
                        counter++;
                    }
                    catch (Exception x)
                    {
                        message = x.Message;
                    }
                }
                trans.Commit();
                TaskDialog.Show("Views on Sheets - Uppercase", "You have successfully changed names for " + counter + " views! ");
                return(Result.Succeeded);
            }
        }
        // Catch any Exceptions and display them.
        catch (Autodesk.Revit.Exceptions.OperationCanceledException)
        {
            return(Result.Cancelled);
        }
        catch (Exception ex)
        {
            message = ex.Message;
            return(Result.Failed);
        }
    }
Пример #31
0
		public void CreateHeadOnlyCommits_MessageSet()
		{
			var f1 = new FileInfo("file1").WithBranch("branch1", "1.1.0.2");
			var f2 = new FileInfo("file2").WithBranch("branch1", "1.1.0.2");
			var mainCommit1 = new Commit("c1").WithRevision(f1, "1.1").WithRevision(f2, "1.1");
			var branchCommit1 = new Commit("c2").WithRevision(f1, "1.1.2.1").WithRevision(f2, "1.1.2.1");

			var branchpoints = new Dictionary<string, Commit>()
			{
				{ "branch1", mainCommit1 },
			};

			IEnumerable<Commit> commits = new[] { mainCommit1, branchCommit1 };
			var streams = new BranchStreamCollection(commits, branchpoints);

			// rename branch1
			var renamer = new Renamer();
			renamer.AddRule(new RenameRule(@"^MAIN$", "master"));
			renamer.AddRule(new RenameRule(@"^branch(\d)", "BRANCH#$1"));
			m_config.Stub(c => c.BranchRename).Return(renamer);

			m_config.Stub(c => c.IncludeFile("file1")).Return(true);
			m_config.Stub(c => c.IncludeFile("file2")).Return(false);
			m_config.Stub(c => c.IsHeadOnly("file1")).Return(false);
			m_config.Stub(c => c.IsHeadOnly("file2")).Return(true);

			var filter = new ExclusionFilter(m_log, m_config);
			commits = filter.Filter(commits).ToListIfNeeded();

			filter.CreateHeadOnlyCommits(new[] { "MAIN", "branch1" }, streams, AllFiles(f1, f2));
			Assert.AreEqual(streams.Head("MAIN").Message, "Adding head-only files to master");
			Assert.AreEqual(streams.Head("branch1").Message, "Adding head-only files to BRANCH#1");
		}
        public Result Execute(
          ExternalCommandData commandData,
          ref string message,
          ElementSet elements)
        {
            // Get application and document objects
            UIApplication uiApp = commandData.Application;
            Document doc = uiApp.ActiveUIDocument.Document;
            UIDocument uidoc = uiApp.ActiveUIDocument;

            try
            {
                using (Transaction trans = new Transaction(doc, "UpperCase Views on Sheets."))
                {
                    trans.Start();
                    // Get all Views on sheets and change name to upper case
                    int counter = 0;
                    List<ElementId> viewsOnSheets = new List<ElementId>();
                    foreach (View v in new FilteredElementCollector(doc)
                        .OfClass(typeof(View)))
                    {
                        foreach (ViewSheet vs in new FilteredElementCollector(doc)
                            .OfClass(typeof(ViewSheet))
                            .Cast<ViewSheet>())
                        {
                            ICollection<ElementId> viewsIds = vs.GetAllPlacedViews();
                            List<View> views = new List<View>();
                            foreach (ElementId id in viewsIds)
                            {
                                View e = doc.GetElement(id) as View;
                                views.Add(e);
                            }
                            foreach (View view in views)
                            {
                                if (view.Id == v.Id)
                                {
                                    try
                                    {
                                        view.Name = view.Name.ToUpper();
                                        viewsOnSheets.Add(view.Id);
                                        counter++;
                                    }
                                    catch (Exception x)
                                    {
                                        message = x.Message;
                                    }
                                }
                            }
                            views.Clear();
                        }
                    }
                    // get all views not on sheets by using exclusion filter and change names to lowercase
                    ExclusionFilter filter = new ExclusionFilter(viewsOnSheets);
                    IList<Element> viewsNotOnSheets = new FilteredElementCollector(doc)
                        .OfClass(typeof(View))
                        .WhereElementIsNotElementType()
                        .WherePasses(filter)
                        .ToElements();
                    try
                    {
                        foreach (View v in viewsNotOnSheets)
                        {
                            v.Name = v.Name.ToLower();
                            counter++;
                        }
                    }
                    catch (Exception x)
                    {
                        message = x.Message;
                    }

                    // Get all schedules on sheets and change name to upper case
                    IList<Element> schInstances = new FilteredElementCollector(doc)
                        .OfClass(typeof(ScheduleSheetInstance))
                        .ToElements();
                    List<ViewSchedule> masterSchedules = new List<ViewSchedule>();
                    List<ElementId> schedulesOnSheet = new List<ElementId>();

                    foreach (ScheduleSheetInstance ssi in schInstances)
                    {
                        ViewSchedule masterSchedule = doc.GetElement(ssi.ScheduleId) as ViewSchedule;
                        masterSchedules.Add(masterSchedule);
                    }
                    var distinctSchedules = masterSchedules.GroupBy(x => x.Id).Select(y => y.First());
                    foreach (ViewSchedule vs in distinctSchedules)
                    {
                        try
                        {
                            vs.Name = vs.Name.ToUpper();
                            schedulesOnSheet.Add(vs.Id);
                            counter++;
                        }
                        catch (Exception x)
                        {
                            message = x.Message;
                        }
                    }
                    // Get all schedules not on sheets and change name to lower case
                    ExclusionFilter schFilter = new ExclusionFilter(schedulesOnSheet);
                    IList<Element> schedulesNotOnSheet = new FilteredElementCollector(doc)
                        .OfClass(typeof(ViewSchedule))
                        .WhereElementIsNotElementType()
                        .WherePasses(schFilter)
                        .ToElements();

                    foreach (ViewSchedule vs in schedulesNotOnSheet)
                    {
                        try
                        {
                            vs.Name = vs.Name.ToLower();
                            counter++;
                        }
                        catch (Exception x)
                        {
                            message = x.Message;
                        }
                    }
                    trans.Commit();
                    TaskDialog.Show("Views on Sheets - Uppercase", "You have successfully changed names for " + counter + " views! ");
                    return Result.Succeeded;
                }
            }
            // Catch any Exceptions and display them.
            catch (Autodesk.Revit.Exceptions.OperationCanceledException)
            {
                return Result.Cancelled;
            }
            catch (Exception ex)
            {
                message = ex.Message;
                return Result.Failed;
            }
        }
Пример #33
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
            UIDocument    uidoc = commandData.Application.ActiveUIDocument;
            Document      doc   = uidoc.Document;
            Selection     sel   = uidoc.Selection;

            //选择一个点
            Reference refPoint = sel.PickObject(ObjectType.PointOnElement);
            XYZ       point1   = refPoint.GlobalPoint; //The position on which the reference is hit.???

            //射线方向及工作平面法向量
            XYZ rayDirection = XYZ.BasisZ;
            XYZ skVector     = XYZ.BasisX; //???????????

            //当选择的主体为平面时,射线根据选择的点与此面的法线方向进行放射
            if (refPoint.ElementReferenceType == ElementReferenceType.REFERENCE_TYPE_SURFACE)
            {
                PlanarFace pFace = null;
                //主体是链接的图元时,获取平面的方法
                if (refPoint.LinkedElementId.IntegerValue != -1)
                {
                    RevitLinkInstance linkIIns = doc.GetElement(refPoint) as RevitLinkInstance;
                    Document          linkDoc  = linkIIns.GetLinkDocument();
                    Element           linkElem = linkDoc.GetElement(refPoint.LinkedElementId);
                    Options           opt      = new Options();
                    opt.DetailLevel = ViewDetailLevel.Fine;
                    GeometryElement geoElem = linkElem.get_Geometry(opt);
                    pFace = getTarFace(geoElem, point1); //point1是原始点.
                }
                else
                {
                    //判断是否FamilyInstance类型的族,采用不同的获取方法
                    Element elem = doc.GetElement(refPoint);
                    if (elem is FamilyInstance)
                    {
                        Options opt = new Options();
                        opt.DetailLevel = ViewDetailLevel.Fine;
                        GeometryElement ge = elem.get_Geometry(opt);
                        pFace = getTarFace(ge, point1);
                    }
                    else
                    {
                        pFace = elem.GetGeometryObjectFromReference(refPoint) as PlanarFace;
                    }
                }

                //修正射线方向及工作平面法向量
                if (pFace != null)
                {
                    rayDirection = pFace.FaceNormal;
                    skVector     = pFace.XVector;
                }
            }

            //获得视图
            View3D view3D = doc.ActiveView as View3D;

            //创建射线测量出第二点
            ExclusionFilter filter =
                new ExclusionFilter(new List <ElementId>()
            {
                refPoint.ElementId, refPoint.LinkedElementId
            });

            ReferenceIntersector refIntersector = new ReferenceIntersector(filter, FindReferenceTarget.All, view3D);

            refIntersector.FindReferencesInRevitLinks = true;
            ReferenceWithContext rwc = refIntersector.FindNearest(point1, rayDirection);

            if (rwc != null)
            {
                XYZ point2 = rwc.GetReference().GlobalPoint;
                //创建模型线
                Line line = Line.CreateBound(point1, point2);
                TaskDialog.Show("距离", line.Length.FeetToMm().ToString("0.00"));
                using (Transaction ts = new Transaction(doc, "尺寸"))
                {
                    ts.Start();
                    SketchPlane sk         = SketchPlane.Create(doc, Plane.CreateByNormalAndOrigin(skVector, point1));
                    ModelCurve  modelCurve = doc.Create.NewModelCurve(line, sk);
                    sel.SetElementIds(new List <ElementId>()
                    {
                        modelCurve.Id
                    });
                    ts.Commit();
                }
            }
            else
            {
                TaskDialog.Show("返回结果", "未检测到图元");
            }

            return(Result.Succeeded);
        }
Пример #34
0
 public void AddExclusionFilter(IEnumerable <int> list)
 {
     InclusionFilter = InclusionFilter.Except(list).ToList();
     ExclusionFilter = ExclusionFilter.Union(list).ToList();
 }
Пример #35
0
		public void CreateHeadOnlyCommits_MergeFromBranch()
		{
			var f1 = new FileInfo("file1").WithBranch("branch1", "1.1.0.2");
			var f2 = new FileInfo("file2").WithBranch("branch1", "1.1.0.2");
			var mainCommit1 = new Commit("c1").WithRevision(f1, "1.1").WithRevision(f2, "1.1");
			var branchCommit1 = new Commit("c2").WithRevision(f1, "1.1.2.1").WithRevision(f2, "1.1.2.1");
			var mainCommit2 = new Commit("c3").WithRevision(f1, "1.2", mergepoint: "1.1.2.1").WithRevision(f2, "1.2", mergepoint: "1.1.2.1");

			var branchpoints = new Dictionary<string, Commit>()
			{
				{ "branch1", mainCommit2 },
			};

			IEnumerable<Commit> commits = new[] { mainCommit1, branchCommit1, mainCommit2 };
			var streams = new BranchStreamCollection(commits, branchpoints);

			m_config.Stub(c => c.IncludeFile("file1")).Return(true);
			m_config.Stub(c => c.IncludeFile("file2")).Return(false);
			m_config.Stub(c => c.IsHeadOnly("file1")).Return(false);
			m_config.Stub(c => c.IsHeadOnly("file2")).Return(true);
			m_config.Stub(c => c.BranchRename).Return(new Renamer());

			var filter = new ExclusionFilter(m_log, m_config);
			commits = filter.Filter(commits).ToListIfNeeded();

			filter.CreateHeadOnlyCommits(new[] { "MAIN", "branch1" }, streams, AllFiles(f1, f2));
			Assert.AreEqual(streams.Head("MAIN").CommitId, "headonly-MAIN", "Commit created on HEAD");
			Assert.AreEqual(streams.Head("branch1").CommitId, "headonly-branch1", "Commit created on branch1");
			Assert.AreSame(streams.Head("MAIN").MergeFrom, streams.Head("branch1"), "Merge from branch1 to HEAD");
		}
Пример #36
0
		public void CreateHeadOnlyCommits_FileDeletedInMerge()
		{
			var f1 = new FileInfo("file1").WithBranch("branch1", "1.1.0.2");
			var f2 = new FileInfo("file2").WithBranch("branch1", "1.1.0.2");
			var mainCommit1 = new Commit("c1").WithRevision(f1, "1.1").WithRevision(f2, "1.1");
			var branchCommit1 = new Commit("c2").WithRevision(f1, "1.1.2.1").WithRevision(f2, "1.1.2.1");
			var mainCommit2 = new Commit("c3").WithRevision(f1, "1.2", mergepoint: "1.1.2.1").WithRevision(f2, "1.2", mergepoint: "1.1.2.1");
			var mainCommit3 = new Commit("c4").WithRevision(f2, "1.3", isDead: true);

			var branchpoints = new Dictionary<string, Commit>()
			{
				{ "branch1", mainCommit1 },
			};

			IEnumerable<Commit> commits = new[] { mainCommit1, branchCommit1, mainCommit2, mainCommit3 };
			var streams = new BranchStreamCollection(commits, branchpoints);

			m_config.Stub(c => c.IncludeFile("file1")).Return(false);
			m_config.Stub(c => c.IncludeFile("file2")).Return(false);
			m_config.Stub(c => c.IsHeadOnly("file1")).Return(true);
			m_config.Stub(c => c.IsHeadOnly("file2")).Return(true);
			m_config.Stub(c => c.BranchRename).Return(new Renamer());

			var filter = new ExclusionFilter(m_log, m_config);
			commits = filter.Filter(commits).ToListIfNeeded();

			filter.CreateHeadOnlyCommits(new[] { "MAIN", "branch1" }, streams, AllFiles(f1, f2));

			var mainHead = streams.Head("MAIN");
			Assert.IsTrue(mainHead.CommitId == "headonly-MAIN");
			Assert.IsTrue(mainHead.Where(r => !r.IsDead).Single().File.Name == "file1");
			Assert.IsTrue(mainHead.Where(r => r.IsDead).Single().File.Name == "file2");
		}