public XmlElement ToXmlElement(XmlDocument document) { XmlElement result = document.CreateElement(ConfigConsts.UserTag); result.SetAttribute(ConfigConsts.UserNameAttr, Name); result.SetAttribute(ConfigConsts.ThreadsCountTag, ThreadsCount.ToString()); // Write feeds var child = document.CreateElement(ConfigConsts.ChannelsListTag); foreach (FeedModel feed in FeedsList) { child.AppendChild(feed.ToXmlElement(document)); } result.AppendChild(child); // Write filters child = document.CreateElement(ConfigConsts.FiltersListTag); child.AppendChild(IncludeFilter.ToXmlElement(document)); child.AppendChild(ExcludeFilter.ToXmlElement(document)); result.AppendChild(child); return(result); }
private void FilterNewsListExecute() { _shownNewsCount = 0; if (IsFiltered) { foreach (NewsViewModel news in NewsList) { bool r = IncludeFilter.Check(news.FullText) && ExcludeFilter.Check(news.FullText); news.IsVisible = r; if (r) { ++_shownNewsCount; } } } else { foreach (NewsViewModel news in NewsList) { news.IsVisible = true; ++_shownNewsCount; } } OnPropertyChanged("ShownNewsCount"); }
public override bool Execute() { if (AttachDebugger) { System.Diagnostics.Debugger.Launch(); } try { Regex excludeFilterRegex = !ExcludeFilter.IsNullOrEmpty() ? new Regex(ExcludeFilter) : null; using (ProjectCollection collection = new ProjectCollection()) { Project sourceProject = collection.LoadProject(ProjectPath); Project targetProject = new Project(collection); AddGeneratedItems(targetProject, GetGeneratedItems(CompileItems, sourceProject.GetItems(CompileItemType), excludeFilterRegex), CompileItemType); targetProject.Save(OutputTargetsPath); } } catch (Exception e) { Log.LogError($"{nameof(WriteGeneratedItemsTask)} - Error reading \"{ProjectPath}\""); Log.LogErrorFromException(e); return(false); } return(true); }
/// <summary> /// Updates the IFCExportOptions with the settings in this configuration. /// </summary> /// <param name="options">The IFCExportOptions to update.</param> /// <param name="filterViewId">The id of the view that will be used to select which elements to export.</param> public void UpdateOptions(IFCExportOptions options, ElementId filterViewId) { options.FileVersion = IFCVersion; options.SpaceBoundaryLevel = SpaceBoundaries; options.ExportBaseQuantities = ExportBaseQuantities; options.WallAndColumnSplitting = SplitWallsAndColumns; options.FilterViewId = VisibleElementsOfCurrentView ? filterViewId : ElementId.InvalidElementId; options.AddOption("ExportInternalRevitPropertySets", ExportInternalRevitPropertySets.ToString()); options.AddOption("ExportIFCCommonPropertySets", ExportIFCCommonPropertySets.ToString()); options.AddOption("ExportAnnotations", Export2DElements.ToString()); options.AddOption("Use2DRoomBoundaryForVolume", Use2DRoomBoundaryForVolume.ToString()); options.AddOption("UseFamilyAndTypeNameForReference", UseFamilyAndTypeNameForReference.ToString()); options.AddOption("ExportVisibleElementsInView", VisibleElementsOfCurrentView.ToString()); options.AddOption("ExportPartsAsBuildingElements", ExportPartsAsBuildingElements.ToString()); options.AddOption("UseActiveViewGeometry", UseActiveViewGeometry.ToString()); options.AddOption("ExportSpecificSchedules", ExportSpecificSchedules.ToString()); options.AddOption("ExportBoundingBox", ExportBoundingBox.ToString()); options.AddOption("ExportSolidModelRep", ExportSolidModelRep.ToString()); options.AddOption("ExportSchedulesAsPsets", ExportSchedulesAsPsets.ToString()); options.AddOption("ExportUserDefinedPsets", ExportUserDefinedPsets.ToString()); options.AddOption("ExportUserDefinedParameterMapping", ExportUserDefinedParameterMapping.ToString()); options.AddOption("ExportLinkedFiles", ExportLinkedFiles.ToString()); options.AddOption("IncludeSiteElevation", IncludeSiteElevation.ToString()); options.AddOption("SitePlacement", SitePlacement.ToString()); options.AddOption("TessellationLevelOfDetail", TessellationLevelOfDetail.ToString()); options.AddOption("UseOnlyTriangulation", UseOnlyTriangulation.ToString()); options.AddOption("ActiveViewId", ActiveViewId.ToString()); options.AddOption("StoreIFCGUID", StoreIFCGUID.ToString()); // The active phase may not be valid if we are exporting multiple projects. However, if projects share a template that defines the phases, // then the ActivePhaseId would likely be valid for all. There is some small chance that the ActivePhaseId would be a valid, but different, phase // in different projects, but that is unlikely enough that it seems worth warning against it but allowing the better functionality in general. if (IFCPhaseAttributes.Validate(ActivePhaseId)) { options.AddOption("ActivePhase", ActivePhaseId.ToString()); } options.AddOption("FileType", IFCFileType.ToString()); string uiVersion = IFCUISettings.GetAssemblyVersion(); options.AddOption("AlternateUIVersion", uiVersion); options.AddOption("ConfigName", Name); // Add config name into the option for use in the exporter options.AddOption("ExportUserDefinedPsetsFileName", ExportUserDefinedPsetsFileName); options.AddOption("ExportUserDefinedParameterMappingFileName", ExportUserDefinedParameterMappingFileName); options.AddOption("ExportRoomsInView", ExportRoomsInView.ToString()); options.AddOption("ExcludeFilter", ExcludeFilter.ToString()); options.AddOption("COBieCompanyInfo", COBieCompanyInfo); options.AddOption("COBieProjectInfo", COBieProjectInfo); options.AddOption("IncludeSteelElements", IncludeSteelElements.ToString()); options.AddOption("UseTypeNameOnlyForIfcType", UseTypeNameOnlyForIfcType.ToString()); options.AddOption("UseVisibleRevitNameAsEntityName", UseVisibleRevitNameAsEntityName.ToString()); }
/// <summary> /// Checks if the crawler should follow an url /// </summary> /// <param name="uri">Url to check</param> /// <param name="referrer"></param> /// <returns>True if the crawler should follow the url, else false</returns> protected virtual bool IsAllowedUrl(Uri uri, CrawlStep referrer) { if (MaximumUrlSize.HasValue && MaximumUrlSize.Value > 10 && uri.ToString().Length > MaximumUrlSize.Value) { return(false); } if (!IncludeFilter.IsNull() && IncludeFilter.Any(f => f.Match(uri, referrer))) { return(true); } if (!ExcludeFilter.IsNull() && ExcludeFilter.Any(f => f.Match(uri, referrer))) { return(false); } if (IsExternalUrl(uri)) { return(false); } return(!AdhereToRobotRules || m_Robot.IsAllowed(UserAgent, uri)); }
public void ExcludeTest() { SetupData("exclude"); var filter = new ExcludeFilter("*\\out\\*", "*testfile"); // These have "/out/" in their path Assert.AreEqual(filter.ShouldExcludeFile(Path.Combine(TestOutput, "testfile")), true); Assert.AreEqual(filter.ShouldExcludeFile(Path.Combine(TestOutput, ".testfile")), true); Assert.AreEqual(filter.ShouldExcludeFile(Path.Combine(TestOutput, "asdf")), true); Assert.AreEqual(filter.ShouldExcludeFile(Path.Combine(TestOutput, "out")), true); Assert.AreEqual(filter.ShouldExcludeFile(Path.Combine(TestOutput, "krout")), true); Assert.AreEqual(filter.ShouldExcludeFile(Path.Combine(TestInput, "out\\")), true); // Matches against second filter Assert.AreEqual(filter.ShouldExcludeFile(Path.Combine(TestInput, "testfile")), true); // Shouldn't match against either filter, unless // test system somewhere has an out in it! D: Assert.AreEqual(filter.ShouldExcludeFile(Path.Combine(TestInput, "false")), false); Assert.AreEqual(filter.ShouldExcludeFile(Path.Combine(TestInput, "out")), false); Assert.AreEqual(filter.ShouldExcludeFile(Path.Combine(TestInput, "fa.lse")), false); Assert.AreEqual(filter.ShouldExcludeFile(Path.Combine(TestInput, "testfile2")), false); }