private static IEnumerable<BuildItem> WalkCircularDependency(BuildItem item, IDictionary<BuildItem, List<BuildItem>> scriptsToDependencies, ISet<BuildItem> visitedItems, out bool isCircularPath) { if(visitedItems.Contains(item)) { isCircularPath = true; return Enumerable.Repeat(item, 1); } if (!scriptsToDependencies.ContainsKey(item)) { isCircularPath = false; return Enumerable.Empty<BuildItem>(); } visitedItems.Add(item); foreach (var d in scriptsToDependencies[item]) { bool currentIsCircular; var currentPath = WalkCircularDependency(d, scriptsToDependencies, visitedItems, out currentIsCircular); if(currentIsCircular) { isCircularPath = true; return Enumerable.Repeat(item, 1).Concat(currentPath); } } isCircularPath = false; return Enumerable.Empty<BuildItem>(); }
internal RenameLocations(ISet<RenameLocation> locations, ISymbol symbol, Solution solution, IEnumerable<ISymbol> referencedSymbols, IEnumerable<ReferenceLocation> implicitLocations, OptionSet options) { _symbol = symbol; _solution = solution; _mergedResult = new SearchResult(locations, implicitLocations, referencedSymbols); Options = options; }
/// <summary> /// Constructor /// </summary> /// <param name="mapFunctionConfiguration">Map function configuration</param> /// <param name="mapInputCodecConfiguration">Map input codec configuration</param> /// <param name="updateFunctionCodecsConfiguration">codec configuration for update /// function. It is union of TMapInput, TMapOutput and TResult configuration</param> /// <param name="reduceFunctionConfiguration">Reduce function configuration</param> /// <param name="updateFunctionConfiguration">Update function configuration</param> /// <param name="mapOutputPipelineDataConverterConfiguration">Configuration of /// PipelineDataConverter for TMapOutput</param> /// <param name="mapInputPipelineDataConverterConfiguration">Configuration of /// PipelineDataConverter for TMapInput</param> /// <param name="partitionedDatasetConfiguration">Configuration of partitioned /// dataset</param> /// <param name="perMapConfigGeneratorConfig">Per mapper configuration</param> /// <param name="numberOfMappers">Number of mappers</param> /// <param name="memoryPerMapper">Per Mapper memory.</param> /// <param name="jobName">Job name</param> internal IMRUJobDefinition( IConfiguration mapFunctionConfiguration, IConfiguration mapInputCodecConfiguration, IConfiguration updateFunctionCodecsConfiguration, IConfiguration reduceFunctionConfiguration, IConfiguration updateFunctionConfiguration, IConfiguration mapOutputPipelineDataConverterConfiguration, IConfiguration mapInputPipelineDataConverterConfiguration, IConfiguration partitionedDatasetConfiguration, ISet<IConfiguration> perMapConfigGeneratorConfig, int numberOfMappers, int memoryPerMapper, int updateTaskMemory, string jobName) { _mapFunctionConfiguration = mapFunctionConfiguration; _mapInputCodecConfiguration = mapInputCodecConfiguration; _updateFunctionCodecsConfiguration = updateFunctionCodecsConfiguration; _reduceFunctionConfiguration = reduceFunctionConfiguration; _updateFunctionConfiguration = updateFunctionConfiguration; _mapOutputPipelineDataConverterConfiguration = mapOutputPipelineDataConverterConfiguration; _mapInputPipelineDataConverterConfiguration = mapInputPipelineDataConverterConfiguration; _partitionedDatasetConfiguration = partitionedDatasetConfiguration; _numberOfMappers = numberOfMappers; _jobName = jobName; _memoryPerMapper = memoryPerMapper; _updateTaskMemory = updateTaskMemory; _perMapConfigGeneratorConfig = perMapConfigGeneratorConfig; }
private void Verify(ISet<EmailToken> tokens, string type1, string prop1, string type2, string prop2) { if (tokens.Count >= 0) { int i = 0; foreach (var token in tokens) { switch (i) { case 0: Assert.AreEqual(type1, token.TypeName); Assert.AreEqual(prop1, token.PropertyName); break; case 1: Assert.AreEqual(type2, token.TypeName); Assert.AreEqual(prop2, token.PropertyName); break; default: break; } i++; } } }
/// <summary> /// Initializes a new instance of the <see cref="FactsListFormatter"/> class. /// </summary> /// <param name="user">The user to create this formatter for</param> /// <param name="enumerator">The enumerator for the directory listing to format</param> /// <param name="activeFacts">The active facts to return for the entries</param> /// <param name="absoluteName">Returns an absolute entry name</param> public FactsListFormatter(FtpUser user, DirectoryListingEnumerator enumerator, ISet<string> activeFacts, bool absoluteName) { _user = user; _enumerator = enumerator; _activeFacts = activeFacts; _absoluteName = absoluteName; }
public CriteriaJoinWalker(IOuterJoinLoadable persister,CriteriaQueryTranslator translator, ISessionFactoryImplementor factory, CriteriaImpl criteria, string rootEntityName, IDictionary<string, IFilter> enabledFilters) : base(translator.RootSQLAlias, persister, factory, enabledFilters) { this.translator = translator; querySpaces = translator.GetQuerySpaces(); if (translator.HasProjection) { resultTypes = translator.ProjectedTypes; InitProjection( translator.GetSelect(enabledFilters), translator.GetWhereCondition(enabledFilters), translator.GetOrderBy(), translator.GetGroupBy().ToString(), LockMode.None ); } else { resultTypes = new IType[] {TypeFactory.ManyToOne(persister.EntityName)}; InitAll(translator.GetWhereCondition(enabledFilters), translator.GetOrderBy(), LockMode.None); } userAliasList.Add(criteria.Alias); //root entity comes *last* userAliases = ArrayHelper.ToStringArray(userAliasList); }
/// <summary> /// Constructs a thread-safe <see cref="ISet" /> wrapper. /// </summary> /// <param name="basisSet">The <see cref="ISet" /> object that this object will wrap.</param> public SynchronizedSet(ISet basisSet) { mBasisSet = basisSet; mSyncRoot = basisSet.SyncRoot; if (mSyncRoot == null) throw new NullReferenceException("The Set you specified returned a null SyncRoot."); }
public Binding() { locals = new Dictionary<string, Expression>(); cache = new Dictionary<string, ReturnValue>(); consts = new SortedSet<string>(); }
public TotalStatistics() { syncRoot = new object(); childs = new HashSet<ThreadStatistics>(); start = DateTime.Now; processedInFolders = 0; }
public static bool IsGlobalMemberDeclarationContext( this SyntaxTree syntaxTree, int position, ISet<SyntaxKind> validModifiers, CancellationToken cancellationToken) { if (!syntaxTree.IsInteractiveOrScript()) { return false; } var tokenOnLeftOfPosition = syntaxTree.FindTokenOnLeftOfPosition(position, cancellationToken); var token = tokenOnLeftOfPosition.GetPreviousTokenIfTouchingWord(position); var modifierTokens = syntaxTree.GetPrecedingModifiers(position, tokenOnLeftOfPosition, cancellationToken); if (modifierTokens.IsEmpty()) { return false; } if (modifierTokens.IsSubsetOf(validModifiers)) { // the parent is the member // the grandparent is the container of the member // in interactive, it's possible that there might be an intervening "incomplete" member for partially // typed declarations that parse ambiguously. For example, "internal e". if (token.Parent.IsKind(SyntaxKind.CompilationUnit) || (token.Parent.IsKind(SyntaxKind.IncompleteMember) && token.Parent.IsParentKind(SyntaxKind.CompilationUnit))) { return true; } } return false; }
public FileSystemCompletionHelper( CompletionListProvider completionProvider, TextSpan textChangeSpan, ICurrentWorkingDirectoryDiscoveryService fileSystemDiscoveryService, Glyph folderGlyph, Glyph fileGlyph, ImmutableArray<string> searchPaths, IEnumerable<string> allowableExtensions, Func<string, bool> exclude = null, CompletionItemRules itemRules = null) { Debug.Assert(searchPaths.All(path => PathUtilities.IsAbsolute(path))); _completionProvider = completionProvider; _textChangeSpan = textChangeSpan; _searchPaths = searchPaths; _allowableExtensions = allowableExtensions.Select(e => e.ToLowerInvariant()).ToSet(); _fileSystemDiscoveryService = fileSystemDiscoveryService; _folderGlyph = folderGlyph; _fileGlyph = fileGlyph; _exclude = exclude; _itemRules = itemRules; _lazyGetDrives = new Lazy<string[]>(() => IOUtilities.PerformIO(Directory.GetLogicalDrives, SpecializedCollections.EmptyArray<string>())); }
/// <summary> /// Initializes a new instance of the ModelTemplateModel class. /// </summary> /// <param name="source">The object to create model from.</param> /// <param name="allTypes">The list of all model types; Used to implement polymorphism.</param> public ModelTemplateModel(CompositeType source, ISet<CompositeType> allTypes) { this.LoadFrom(source); PropertyTemplateModels = new List<PropertyTemplateModel>(); source.Properties.ForEach(p => PropertyTemplateModels.Add(new PropertyTemplateModel(p))); if (!string.IsNullOrEmpty(source.PolymorphicDiscriminator)) { if (!source.Properties.Any(p => p.Name == source.PolymorphicDiscriminator)) { var polymorphicProperty = new Property { IsRequired = true, Name = source.PolymorphicDiscriminator, SerializedName = source.PolymorphicDiscriminator, Documentation = "Polymorhpic Discriminator", Type = new PrimaryType(KnownPrimaryType.String) }; source.Properties.Add(polymorphicProperty); } } if (source.BaseModelType != null) { this.parent = new ModelTemplateModel(source.BaseModelType, allTypes); } this.allTypes = allTypes; }
public void Draw(ISet<State> states, SpriteBatch spriteBatch, XnaRectangle position, XnaColor color) { int rowTopHeight = _centerTop.Height; int rowBottomHeight = _centerBottom.Height; int rowCenterHeight = position.Height - rowTopHeight - rowBottomHeight; int startY = position.Top; int rowCenterTop = startY + rowTopHeight; int rowBottomTop = startY + position.Height - rowBottomHeight; int colLeftWidth = _leftCenter.Width; int colRightWidth = _rightCenter.Width; int colCenterWidth = position.Width - colLeftWidth - colRightWidth; int startX = position.Left; int colCenterLeft = startX + colLeftWidth; int colRightLeft = startX + position.Width - colRightWidth; spriteBatch.Draw(_texture, new XnaRectangle(startX, startY, colLeftWidth, rowTopHeight), _leftTop, color); spriteBatch.Draw(_texture, new XnaRectangle(startX, rowCenterTop, colLeftWidth, rowCenterHeight), _leftCenter, color); spriteBatch.Draw(_texture, new XnaRectangle(startX, rowBottomTop, colLeftWidth, rowBottomHeight), _leftBottom, color); spriteBatch.Draw(_texture, new XnaRectangle(colCenterLeft, startY, colCenterWidth, rowTopHeight), _centerTop, color); spriteBatch.Draw(_texture, new XnaRectangle(colCenterLeft, rowCenterTop, colCenterWidth, rowCenterHeight), _center, color); spriteBatch.Draw(_texture, new XnaRectangle(colCenterLeft, rowBottomTop, colCenterWidth, rowBottomHeight), _centerBottom, color); spriteBatch.Draw(_texture, new XnaRectangle(colRightLeft, startY, colRightWidth, rowTopHeight), _rightTop, color); spriteBatch.Draw(_texture, new XnaRectangle(colRightLeft, rowCenterTop, colRightWidth, rowCenterHeight), _rightCenter, color); spriteBatch.Draw(_texture, new XnaRectangle(colRightLeft, rowBottomTop, colRightWidth, rowBottomHeight), _rightBottom, color); }
/// <summary> /// Creates a new Construct Context /// </summary> /// <param name="g">Graph to construct Triples in</param> /// <param name="s">Set to construct from</param> /// <param name="preserveBNodes">Whether Blank Nodes bound to variables should be preserved as-is</param> /// <remarks> /// <para> /// Either the <paramref name="s">Set</paramref> or <paramref name="g">Graph</paramref> parameters may be null if required /// </para> /// </remarks> public ConstructContext(IGraph g, ISet s, bool preserveBNodes) { this._g = g; this._factory = (this._g != null ? (INodeFactory)this._g : _globalFactory.Value); this._s = s; this._preserveBNodes = preserveBNodes; }
public ReplaceCapturedVariablesVisitor(IEnumerable<string> locals, IEnumerable<string> formalParams, IEnumerable<string> classFields, IEnumerable<string> classMethods, IEnumerable<string> classProperties, IEnumerable<string> unitGlobals, IDictionary<string, string> localsMap, IDictionary<string, string> formalParamsMap, bool isInClassMethod) { CollectedLocals = new HashSet<string>(locals); CollectedFormalParams = new HashSet<string>(formalParams); CollectedClassFields = new HashSet<string>(classFields); CollectedUnitGlobals = new HashSet<string>(unitGlobals); CapturedLocalsMap = new Dictionary<string, string>(localsMap); CapturedFormalParamsMap = new Dictionary<string, string>(formalParamsMap); IsInClassMethod = isInClassMethod; // Methods hack CollectedClassFields.UnionWith(classMethods); // Properties hack CollectedClassFields.UnionWith(classProperties); }
public BetfairServerResponse<ClearedOrderSummaryReport> ListClearedOrders( BetStatus betStatus, ISet<string> eventTypeIds = null, ISet<string> eventIds = null, ISet<string> marketIds = null, ISet<RunnerId> runnerIds = null, ISet<string> betIds = null, Side? side = null, TimeRange settledDateRange = null, GroupBy? groupBy = null, bool? includeItemDescription = null, int? fromRecord = null, int? recordCount = null) { return client.ListClearedOrders( betStatus, eventTypeIds, eventIds, marketIds, runnerIds, betIds, side, settledDateRange, groupBy, includeItemDescription, fromRecord, recordCount).Result; }
private void CheckPermittedDN(ISet permitted, Asn1Sequence dns) //throws PkixNameConstraintValidatorException { if (permitted == null) { return; } if ((permitted.Count == 0) && dns.Count == 0) { return; } IEnumerator it = permitted.GetEnumerator(); while (it.MoveNext()) { Asn1Sequence subtree = (Asn1Sequence)it.Current; if (WithinDNSubtree(dns, subtree)) { return; } } throw new PkixNameConstraintValidatorException( "Subject distinguished name is not from a permitted subtree"); }
private void init() { table = new List<Link>[100]; starts = new HashSet<int>(); Action<int, int> register = (int kind, int num) => { if (1000 <= num && num < 10000) { int head = num / 100; int tail = num % 100; var list = table[head]; if (list == null) { list = new List<Link>(); table[head] = list; } list.Add(new Link(kind, tail)); } }; for (int n = 0;; n++) { int num3 = n * (1 * n + 1) / 2; if (num3 >= 10000) break; register(3, num3); register(4, n * (2 * n + 0) / 2); register(5, n * (3 * n - 1) / 2); register(6, n * (4 * n - 2) / 2); register(7, n * (5 * n - 3) / 2); int num8 = n * (6 * n - 4) / 2; register(8, num8); starts.Add(num8 / 100); } }
private bool DerivesFromController(TypeInfo typeInfo, ISet<Assembly> candidateAssemblies) { while (typeInfo != ObjectTypeInfo) { var baseTypeInfo = typeInfo.BaseType.GetTypeInfo(); // A base type will be treated as a controller if // a) it ends in the term "Controller" and // b) it's assembly is one of the candidate assemblies we're considering. This ensures that the assembly // the base type is declared in references Mvc. if (baseTypeInfo.Name.EndsWith(ControllerTypeName, StringComparison.Ordinal) && candidateAssemblies.Contains(baseTypeInfo.Assembly)) { return true; } // c). The base type is called 'Controller. if (string.Equals(baseTypeInfo.Name, ControllerTypeName, StringComparison.Ordinal)) { return true; } typeInfo = baseTypeInfo; } return false; }
/// <summary> /// Eliminate rules with nonsolitary terminals /// </summary> /// <param name="productions"></param> private void StepTerm(ISet<Production> productions) { var newProductions = new List<Production>(); var lookup = new Dictionary<Terminal, Nonterminal>(); foreach (var production in productions) { if (production.Rhs.Count < 2) { continue; } for (int i = 0; i < production.Rhs.Count; i++) { var word = production.Rhs[i]; if (word.IsNonterminal) { continue; } Terminal terminal = (Terminal)word; Nonterminal fresh; if (!lookup.TryGetValue(terminal, out fresh)) { fresh = GetFresh(); lookup[terminal] = fresh; newProductions.Add( new Production(fresh, new Sentence { terminal }) ); } production.Rhs[i] = fresh; } } productions.UnionWith(newProductions); }
private static void FindIndirectCircularReferences(ISet<Node> childList) { var toIgnore = new HashSet<Node>(); foreach (var node in childList.ToHashSet()) { if(toIgnore.Contains(node)) continue; var path = new HashSet<Node>(); if (IndirectlyDependsOnItself(node, node, ref path)) { path.Add(node); toIgnore.UnionWith(path); childList.ExceptWith(path); var dependantOnCircularDependencies = childList.Where(x => path.Any(x.DependsOn)); var cirularHolder = new CircularDependencyHolderNode(path); foreach (var dependantOnCircularDependency in dependantOnCircularDependencies) { //Remove all dependencies on nodes in the path dependantOnCircularDependency.SiblingDependencies.RemoveWhere(x => path.Contains(x)); //Add dependency on circular holder dependantOnCircularDependency.SiblingDependencies.Add(cirularHolder); } //Add all dependencies in the path to the new node cirularHolder.SiblingDependencies.UnionWith(path.SiblingDependencies().Except(path)); //Should not be dependant on themselves childList.Add(cirularHolder); } } }
public Project( string name, ISet<ProjectType> projectTypes, string info, ProjectStatus projectStatus, Image landingImage, AccessLevel accessLevel, VersionControlSystemInfo versionControlSystemInfo, RedmineProjectInfo redmineProjectInfo, ISet<Issue> issues, ISet<ProjectMembership> projectDevelopers, ISet<Image> screenshots) { Require.NotEmpty(name, nameof(name)); Require.NotNull(info, nameof(info)); Require.NotNull(versionControlSystemInfo, nameof(versionControlSystemInfo)); Require.NotNull(redmineProjectInfo, nameof(redmineProjectInfo)); Require.NotEmpty(projectTypes, nameof(projectTypes)); Name = name; ProjectTypes = projectTypes; AccessLevel = accessLevel; Info = info; ProjectStatus = projectStatus; LandingImage = landingImage; VersionControlSystemInfo = versionControlSystemInfo; RedmineProjectInfo = redmineProjectInfo; Issues = issues ?? new HashSet<Issue>(); ProjectMemberships = projectDevelopers ?? new HashSet<ProjectMembership>(); Screenshots = screenshots ?? new HashSet<Image>(); }
public Glue(TwitchBot twitchBot, SteamBot steamBot) { myLock = new Object(); this.twitchBot = twitchBot; this.steamBot = steamBot; subscriptionsUsersMap = new Dictionary<String, HashSet<SteamID>>(); usersSubscriptionsMap = new Dictionary<SteamID, ISet<String>>(); adminList = LoadAdmins(); twitchBot.OnPublicMessage += delegate (UserInfo user, String channel, String message) { log.Debug($"{user.Nick}: {message}"); }; twitchBot.OnPublicMessage += OnTwitchPublicMessage; steamBot.OnFriendMessage += OnSteamFriendMessage; steamBot.OnOfflineMessage += steamBot_OnOfflineMessage; //TODO: Put into config file? smileyTranslater = new StringMapper(new Dictionary<String, String>() { { "BibleThump", ":steamsad:" }, { "Kappa", ":steammocking:" }, { "FailFish", ":steamfacepalm:" }, { "PJSalt", ":steamsalty:" }, { "ResidentSleeper", ":steambored:" } }); }
private static IList<XElement> GenerateXmlElements(IEnumerable<PageReference> pages, ISet<string> urlSet, SitemapData sitemapData, ISitemapXmlGenerator sitemapGenerator) { IList<XElement> sitemapXmlElements = new List<XElement>(); var baseUrl = string.IsNullOrEmpty(sitemapData.SiteUrl) ? Settings.Instance.SiteUrl.ToString() : sitemapData.SiteUrl; foreach (PageReference pageReference in pages) { var languagePages = DataFactory.Instance.GetLanguageBranches(pageReference); foreach (var page in languagePages) { if (urlSet.Count >= MaxSitemapEntryCount) { sitemapData.ExceedsMaximumEntryCount = true; return sitemapXmlElements; } AddFilteredPageElement(page, baseUrl, urlSet, sitemapData, sitemapGenerator, sitemapXmlElements); } } return sitemapXmlElements; }
private static void _MatchRecursive(Node node, ISet<string> rtn, string letters, string prefix, int? maxMatches) { if (maxMatches != null && rtn.Count == maxMatches) return; if (node == null) { if (!rtn.Contains(letters)) rtn.Add(letters); return; } letters += node.Letter.ToString(); if (prefix.Length > 0) { if (node.ContainsKey(prefix[0])) { _MatchRecursive(node[prefix[0]], rtn, letters, prefix.Remove(0, 1), maxMatches); } } else { foreach (char key in node.Keys) { _MatchRecursive(node[key], rtn, letters, prefix, maxMatches); } } }
/// <summary> /// Creates a shape representation and register it to shape representation layer. /// </summary> /// <param name="exporterIFC">The ExporterIFC object.</param> /// <param name="contextOfItems">The context for which the different subtypes of representation are valid.</param> /// <param name="identifier">The identifier for the representation.</param> /// <param name="representationType">The type handle for the representation.</param> /// <param name="items">Collection of geometric representation items that are defined for this representation.</param> /// <returns>The handle.</returns> public static IFCAnyHandle CreateBaseShapeRepresentation(ExporterIFC exporterIFC, IFCAnyHandle contextOfItems, string identifier, string representationType, ISet<IFCAnyHandle> items) { IFCFile file = exporterIFC.GetFile(); IFCAnyHandle newShapeRepresentation = IFCInstanceExporter.CreateShapeRepresentation(file, contextOfItems, identifier, representationType, items); return newShapeRepresentation; }
public ComplexDataQuerySelectionGroupImpl(ISet<IComplexDataQuerySelection> complexSelections, ISdmxDate dateFrom, OrderedOperator dateFromOperator, ISdmxDate dateTo, OrderedOperator dateToOperator, ISet<IComplexComponentValue> primaryMeasureValues) { //check if the operator to be applied on the time has not the 'NOT_EQUAL' value if (dateFromOperator.Equals(OrderedOperatorEnumType.NotEqual) || dateToOperator.Equals(OrderedOperatorEnumType.NotEqual)) throw new SdmxSemmanticException(ExceptionCode.QuerySelectionIllegalOperator); if (complexSelections == null) { return; } this._dateFrom = dateFrom; this._dateFromOperator = dateFromOperator; this._dateTo = dateTo; this._dateToOperator = dateToOperator; this._complexSelections = complexSelections; this._primaryMeasureValues = primaryMeasureValues; // Add each of the Component Selections to the selection concept map. foreach (IComplexDataQuerySelection compSel in _complexSelections) { if (_complexSelectionForConcept.ContainsKey(compSel.ComponentId)) { //TODO Does this require a exception, or can the code selections be merged? throw new ArgumentException("Duplicate concept"); } _complexSelectionForConcept.Add(compSel.ComponentId, compSel); } }
public UnitOfWork() { this.unitsByType = new Dictionary<string, SortedSet<Unit>>(); this.unitNames = new HashSet<string>(); this.unitsByAttack = new SortedDictionary<int, SortedSet<Unit>>(); this.allAttacks = new SortedSet<int>(); }
private void Test(string word, ISet<string> dict, bool expectedResult) { WordBreakSolution wordBreak = new WordBreakSolution(); bool result = wordBreak.WordBreak(word, dict); Assert.AreEqual(expectedResult, result); }
/// <summary>Initializes a new instance of the <see cref="StateProvince"/> class.</summary> public StateProvince() : base() { _addresses = new HashSet<Address>(); _salesTaxRates = new HashSet<SalesTaxRate>(); _stateProvinceId = default(System.Int32); OnCreated(); }
private void PopulateDependenciesInternal(IDictionary <string, FileNode> allFiles, bool preferNativeImage, ILog log, Stack <FileNode> stack) { if (stack == null) { stack = new Stack <FileNode>(); } stack.Push(this); if (dependencies != null) { // re-entrant call indicates a cycle, bail log.LogMessage($"Cycle detected: {String.Join(" -> ", stack)}"); stack.Pop(); return; } dependencies = new HashSet <FileNode>(); try { using (var peReader = new PEReader(new FileStream(SourceFile, FileMode.Open, FileAccess.Read, FileShare.Delete | FileShare.Read))) { if (peReader.HasMetadata) { var reader = peReader.GetMetadataReader(); var includeDependencies = true; // map of facade handles to enable quickly getting to FileNode without repeatedly looking up by name var facadeHandles = new Dictionary <AssemblyReferenceHandle, FileNode>(); if (IsFullFacade(reader)) { // don't include dependencies in full facades. We'll instead follow their typeforwards and promote the dependencies to the parent. includeDependencies = false; // follow typeforwards in any full facade. followTypeForwards = true; } foreach (var handle in reader.AssemblyReferences) { var reference = reader.GetAssemblyReference(handle); var referenceName = reader.GetString(reference.Name); FileNode referencedFile = TryGetFileForReference(referenceName, allFiles, preferNativeImage); if (referencedFile != null) { if (includeDependencies) { dependencies.Add(referencedFile); } // populate dependencies of child referencedFile.PopulateDependenciesInternal(allFiles, preferNativeImage, log, stack); // if we're following type-forwards out of any dependency make sure to look at typerefs from this assembly. // and populate the type-forwards in the dependency if (referencedFile.followTypeForwards || followTypeForwards) { facadeHandles.Add(handle, referencedFile); } } else { // static dependency that wasn't satisfied, this can happen if folks use // lightup code to guard the static dependency. // this can also happen when referencing a package that isn't implemented // on this platform but don't fail the build here log.LogMessage(LogImportance.Low, $"Could not locate assembly dependency {referenceName} of {SourceFile}."); } } if (followTypeForwards) { // if following typeforwards out of this assembly, capture all type forwards foreach (var exportedTypeHandle in reader.ExportedTypes) { var exportedType = reader.GetExportedType(exportedTypeHandle); if (exportedType.IsForwarder) { var assemblyReferenceHandle = (AssemblyReferenceHandle)exportedType.Implementation; FileNode assemblyReferenceNode; if (facadeHandles.TryGetValue(assemblyReferenceHandle, out assemblyReferenceNode)) { var typeName = exportedType.Namespace.IsNil ? reader.GetString(exportedType.Name) : reader.GetString(exportedType.Namespace) + reader.GetString(exportedType.Name); typeForwards.Add(typeName, assemblyReferenceNode); } } } } else if (facadeHandles.Count > 0) { // if examining type forwards in some dependency, enumerate type-refs // for any that point at a facade assembly. foreach (var typeReferenceHandle in reader.TypeReferences) { var typeReference = reader.GetTypeReference(typeReferenceHandle); var resolutionScope = typeReference.ResolutionScope; if (resolutionScope.Kind == HandleKind.AssemblyReference) { var assemblyReferenceHandle = (AssemblyReferenceHandle)resolutionScope; FileNode assemblyReferenceNode; if (facadeHandles.TryGetValue(assemblyReferenceHandle, out assemblyReferenceNode)) { var typeName = typeReference.Namespace.IsNil ? reader.GetString(typeReference.Name) : reader.GetString(typeReference.Namespace) + reader.GetString(typeReference.Name); FileNode typeForwardedToNode = null; var forwardAssemblies = new Stack <FileNode>(); // while assembly forwarded to is also a facade, add a dependency on the target while (assemblyReferenceNode.followTypeForwards) { if (!assemblyReferenceNode.typeForwards.TryGetValue(typeName, out typeForwardedToNode)) { break; } dependencies.Add(typeForwardedToNode); forwardAssemblies.Push(assemblyReferenceNode); // look at the target in case it is also a facade assemblyReferenceNode = typeForwardedToNode; if (forwardAssemblies.Contains(assemblyReferenceNode)) { // type-forward cycle, bail log.LogMessage($"Cycle detected involving type-forwards: {String.Join(" -> ", forwardAssemblies)}"); break; } } } } } } // examine native module dependencies for (int i = 1, count = reader.GetTableRowCount(TableIndex.ModuleRef); i <= count; i++) { var moduleRef = reader.GetModuleReference(MetadataTokens.ModuleReferenceHandle(i)); var moduleName = reader.GetString(moduleRef.Name); var moduleRefCandidates = new[] { moduleName, moduleName + ".dll", moduleName + ".so", moduleName + ".dylib" }; FileNode referencedNativeFile = null; foreach (var moduleRefCandidate in moduleRefCandidates) { if (allFiles.TryGetValue(moduleRefCandidate, out referencedNativeFile)) { break; } } if (referencedNativeFile != null) { dependencies.Add(referencedNativeFile); } else { // DLLImport that wasn't satisfied } } } } } catch (BadImageFormatException) { // not a PE } // allow for components to specify their dependencies themselves, by placing a file next to their source file. var additionalDependenciesFile = SourceFile + AdditionalDependenciesFileSuffix; if (File.Exists(additionalDependenciesFile)) { foreach (var additionalDependency in File.ReadAllLines(additionalDependenciesFile)) { if (additionalDependency.Length == 0 || additionalDependency[0] == '#') { continue; } FileNode additionalDependencyFile; if (allFiles.TryGetValue(additionalDependency, out additionalDependencyFile)) { dependencies.Add(additionalDependencyFile); } else { log.LogMessage(LogImportance.Low, $"Could not locate explicit dependency {additionalDependency} of {SourceFile} specified in {additionalDependenciesFile}."); } } } stack.Pop(); }
public override void MergeClasses(ISet <Type> classes) { MergeClassesExpressions(classes, parameters); }
/// <summary> /// Traverses graph from this Vertex to a target Vertex using Breadth-first search like in Dijkstra's algorithm /// </summary> /// <param name="maxHops">maximum number of hops from this Vertex</param> /// <param name="all">find or not find all paths to goal Vertex</param> /// <param name="dir">Direction to traverse edges</param> /// <param name="toVertex">the goal Vertex. If null, finds all paths</param> /// <param name="edgeTypesToTraverse">the type of edges to follow, by default null which means follow all edge types</param> /// <param name="includedVertexTypes">the type of vertices's to follow, by default null which means follow all vertex types</param> /// <param name="excludedVertexTypes">the type of vertices's not to follow, by default null</param> /// <param name="includedVertices">one or more Vertex instances that MUST be in the path for the path to be traversed i.e. if a path does exist /// to the specified toVertex, but does not include all the instances in includedVertices set, the Traverse method will exclude that path</param> /// <param name="excludedVertices">one or more Vertex instances that MUST NOT be in the path for the path to be traversed i.e. if a path does exist /// to the specified toVertex, but does include any of the instances in includedVertices set, the Traverse method will exclude that path</param> /// <param name="includedEdges">one or more Edge instances that MUST be in the path for the path to be traversed i.e. if a path does exist /// to the specified toVertex, but does not include all the instances in includedEdges set, the Traverse method will exclude that path</param> /// <param name="excludedEdges">one or more Edge instances that MUST NOT be in the path for the path to be traversed i.e. if a path does exist /// to the specified toVertex, but does include any of the instances in includedEdges set, the Traverse method will exclude that path</param> /// <param name="includedVertexProperty">One or more Vertex property types that MUST be in the path for the path to be accepted i.e. if a path does exist /// to the specified toVertex, but does not include all of the Vertex properties in the set, the Traverse method will exclude that path</param> /// <param name="excludedVertexProperty">One or more Vertex property types that MUST NOT be in the path for the path to be accepted i.e. if a path does exist /// to the specified toVertex, but does include any of the Vertex properties in the set, the Traverse method will exclude that path</param> /// <param name="includedEdgeProperty">One or more Vertex property types that MUST be in the path for the path to be accepted i.e. if a path does exist /// to the specified toVertex, but does not include all of the Vertex properties in the set, the Traverse method will exclude that path</param> /// <param name="excludedEdgeProperty">One or more Edge property types that MUST NOT be in the path for the path to be accepted i.e. if a path does exist /// to the specified toVertex, but does include any of the Edge properties in the set, the Traverse method will exclude that path</param> /// <param name="validateVertex">A function that will be called before accepting a Vertex in path to toVertex. If function returns true then this vertex is accepted in path; otherwise vertex is rejected</param> /// <param name="validateEdge">A function that will be called before accepting an Edge in path to toVertex. If function returns true then this Edge is accepted in path; otherwise edge is rejected</param> /// <param name="validateEdges">A function that will be called before accepting a candidate Edges list in path to toVertex. If function returns true then this Edge list is accepted in path; otherwise edge list is rejected</param> /// <returns>List of paths to goal Vertex</returns> public List <List <Edge> > Traverse(int maxHops, bool all = true, Direction dir = Direction.Both, Vertex toVertex = null, ISet <EdgeType> edgeTypesToTraverse = null, ISet <VertexType> includedVertexTypes = null, ISet <VertexType> excludedVertexTypes = null, ISet <Vertex> includedVertices = null, ISet <Vertex> excludedVertices = null, ISet <Edge> includedEdges = null, ISet <Edge> excludedEdges = null, ISet <PropertyType> includedVertexProperty = null, ISet <PropertyType> excludedVertexProperty = null, ISet <PropertyType> includedEdgeProperty = null, ISet <PropertyType> excludedEdgeProperty = null, Func <Vertex, bool> validateVertex = null, Func <Edge, bool> validateEdge = null, Func <List <Edge>, bool> validateEdges = null) { Queue <PathInfo> q = new Queue <PathInfo>(); HashSet <PropertyType> vertexPropertyTypesToFind = null; HashSet <PropertyType> edgePropertyTypesToFind = null; HashSet <Edge> edgeSet; List <Edge> path = new List <Edge>(); List <List <Edge> > resultPaths = new List <List <Edge> >(); var visited = new HashSet <Vertex>(); if (excludedVertexProperty != null) { foreach (PropertyType pt in excludedVertexProperty) { if (pt.HasPropertyValue(VertexId)) { return(resultPaths); } if (pt.HasPropertyValue(toVertex.VertexId)) { return(resultPaths); } } } int includedVerticesSize; if (includedVertices != null) { // these will always be included so remove from list includedVertices.Remove(this); includedVertices.Remove(toVertex); includedVerticesSize = includedVertices.Count; } else { includedVerticesSize = 0; } int includedVertexPropertySize; if (includedVertexProperty != null) { vertexPropertyTypesToFind = new HashSet <PropertyType>(includedVertexProperty); foreach (PropertyType pt in vertexPropertyTypesToFind.ToArray()) { if (pt.HasPropertyValue(VertexId)) { vertexPropertyTypesToFind.Remove(pt); } else if (pt.HasPropertyValue(toVertex.VertexId)) { vertexPropertyTypesToFind.Remove(pt); } } includedVertexPropertySize = vertexPropertyTypesToFind.Count; } else { includedVertexPropertySize = 0; } int includedEdgePropertySize; if (includedEdgeProperty != null) { edgePropertyTypesToFind = new HashSet <PropertyType>(includedEdgeProperty); includedEdgePropertySize = edgePropertyTypesToFind.Count; } else { includedEdgePropertySize = 0; } PathInfo pathInfo = new PathInfo(this, path, null); if (excludedVertices != null) { pathInfo.Visited.UnionWith(excludedVertices); if (toVertex == null) { visited.UnionWith(excludedVertices); } } pathInfo.Visited.Add(this); if (toVertex == null) { visited.Add(this); } else { pathInfo.Visited.Add(toVertex); } q.Enqueue(pathInfo); while (q.Count > 0) { pathInfo = q.Dequeue(); Dictionary <Vertex, HashSet <Edge> > friends = pathInfo.Node.Traverse(dir, edgeTypesToTraverse); if (toVertex != null && friends.TryGetValue(toVertex, out edgeSet)) { foreach (Edge edge in edgeSet) { if ((excludedEdges == null || excludedEdges.Contains(edge) == false) && (validateEdge == null || validateEdge(edge))) { //Console.WriteLine(this + " and " + toVertex + " have a friendship link"); List <Edge> edgePath = pathInfo.EdgePath; edgePath.Add(edge); if (validateEdges == null || validateEdges(edgePath)) { bool foundVerticesToInclude = includedVerticesSize == 0; if (includedVerticesSize > 0) { HashSet <Vertex> verticesToFind = new HashSet <Vertex>(includedVertices); foreach (Edge edgeInPath in edgePath) { if (verticesToFind.Contains(edgeInPath.Tail)) { verticesToFind.Remove(edgeInPath.Tail); if (verticesToFind.Count == 0) { break; } } } foundVerticesToInclude = verticesToFind.Count == 0; } bool foundVertexPropertyTypesToInclude = includedVertexPropertySize == 0; if (includedVertexPropertySize > 0) { var vertexPropertyTypesToFindClone = new HashSet <PropertyType>(vertexPropertyTypesToFind); foreach (Edge edgeInPath in edgePath) { foreach (PropertyType pt in vertexPropertyTypesToFind) { if (pt.HasPropertyValue(edgeInPath.Tail.VertexId)) { vertexPropertyTypesToFindClone.Remove(pt); } } if (vertexPropertyTypesToFindClone.Count == 0) { break; } } foundVertexPropertyTypesToInclude = vertexPropertyTypesToFindClone.Count == 0; } bool foundEdgePropertyTypesToInclude = includedEdgePropertySize == 0; if (includedEdgePropertySize > 0) { var edgePropertyTypesToFindClone = new HashSet <PropertyType>(edgePropertyTypesToFind); foreach (Edge edgeInPath in edgePath) { foreach (PropertyType pt in edgePropertyTypesToFind) { if (pt.HasPropertyValue(edgeInPath.EdgeId)) { edgePropertyTypesToFindClone.Remove(pt); } } if (edgePropertyTypesToFindClone.Count == 0) { break; } } foundEdgePropertyTypesToInclude = edgePropertyTypesToFind.Count == 0; } if (foundVerticesToInclude && foundVertexPropertyTypesToInclude && foundEdgePropertyTypesToInclude) { if (includedEdges == null || includedEdges.IsSubsetOf(edgePath)) { resultPaths.Add(edgePath); if (!all) { return(resultPaths); } } } } } } } if (pathInfo.EdgePath.Count < maxHops || friends.Count == 0) { foreach (KeyValuePair <Vertex, HashSet <Edge> > v in friends) { if (pathInfo.Visited.Contains(v.Key) == false && (all || toVertex != null || visited.Contains(v.Key) == false)) { foreach (Edge edge in v.Value) { if (excludedEdges == null || excludedEdges.Contains(edge) == false) { bool doExclude = false; if (excludedVertexProperty != null) { foreach (PropertyType pt in excludedVertexProperty) { if (pt.HasPropertyValue(v.Key.VertexId)) { pathInfo.Visited.Add(v.Key); if (!all && toVertex == null) { visited.Add(v.Key); } doExclude = true; break; } } } if (excludedEdgeProperty != null) { foreach (PropertyType pt in excludedEdgeProperty) { if (pt.HasPropertyValue(edge.EdgeId)) { doExclude = true; break; } } } if (!doExclude) { path = new List <Edge>(pathInfo.EdgePath); path.Add(edge); PathInfo newPath = new PathInfo(v.Key, path, pathInfo.Visited); newPath.Visited.Add(v.Key); if (!all && toVertex == null) { visited.Add(v.Key); } if (validateEdges == null || validateEdges(path)) { bool vertexTypeIncluded = includedVertexTypes == null || includedVertexTypes.Contains(v.Key.VertexType); bool vertexTypeExcluded = excludedVertexTypes != null && excludedVertexTypes.Contains(v.Key.VertexType); bool validVertex = validateVertex == null || validateVertex(v.Key); if (vertexTypeIncluded && validVertex && !vertexTypeExcluded) { q.Enqueue(newPath); if (toVertex == null && newPath.EdgePath.Count <= maxHops) { resultPaths.Add(newPath.EdgePath); } } } } } } } } } } //if (all && resultPaths.Count == 0) // Console.WriteLine(this + " and " + toVertex + " may not be connected by indirect frienship"); return(resultPaths); }
/// <summary> /// Selects all neighbor Vertices from or to this vertex and for the given edge types. /// </summary> /// <param name="dir">Direction to traverse edges</param> /// <param name="edgeTypesToTraverse">the type of edges to follow, by default null which means follow all edge types</param> /// <returns>All paths to neighbor vertices </returns> public Dictionary <Vertex, HashSet <Edge> > Traverse(Direction dir, ISet <EdgeType> edgeTypesToTraverse = null) { return(m_vertexType.Traverse(this, dir, edgeTypesToTraverse)); }
internal virtual void AddNumericField(FieldInfo field, IEnumerable <long?> values, bool optimizeStorage) { meta.WriteVInt32(field.Number); meta.WriteByte(MemoryDocValuesProducer.NUMBER); meta.WriteInt64(data.Position); // LUCENENET specific: Renamed from getFilePointer() to match FileStream long minValue = long.MaxValue; long maxValue = long.MinValue; long gcd = 0; bool missing = false; // TODO: more efficient? ISet <long?> uniqueValues = null; if (optimizeStorage) { uniqueValues = new JCG.HashSet <long?>(); long count = 0; foreach (var nv in values) { long v; if (nv == null) { v = 0; missing = true; } else { v = nv.Value; } if (gcd != 1) { if (v < long.MinValue / 2 || v > long.MaxValue / 2) { // in that case v - minValue might overflow and make the GCD computation return // wrong results. Since these extreme values are unlikely, we just discard // GCD computation for them gcd = 1; } // minValue needs to be set first else if (count != 0) { gcd = MathUtil.Gcd(gcd, v - minValue); } } minValue = Math.Min(minValue, v); maxValue = Math.Max(maxValue, v); if (uniqueValues != null) { if (uniqueValues.Add(v)) { if (uniqueValues.Count > 256) { uniqueValues = null; } } } ++count; } if (Debugging.AssertsEnabled) { Debugging.Assert(count == maxDoc); } } if (missing) { long start = data.Position; // LUCENENET specific: Renamed from getFilePointer() to match FileStream WriteMissingBitset(values); meta.WriteInt64(start); meta.WriteInt64(data.Position - start); // LUCENENET specific: Renamed from getFilePointer() to match FileStream } else { meta.WriteInt64(-1L); } if (uniqueValues != null) { // small number of unique values int bitsPerValue = PackedInt32s.BitsRequired(uniqueValues.Count - 1); FormatAndBits formatAndBits = PackedInt32s.FastestFormatAndBits(maxDoc, bitsPerValue, acceptableOverheadRatio); if (formatAndBits.BitsPerValue == 8 && minValue >= sbyte.MinValue && maxValue <= sbyte.MaxValue) { meta.WriteByte(MemoryDocValuesProducer.UNCOMPRESSED); // uncompressed foreach (var nv in values) { data.WriteByte((byte)nv.GetValueOrDefault()); } } else { meta.WriteByte(MemoryDocValuesProducer.TABLE_COMPRESSED); // table-compressed long?[] decode = new long?[uniqueValues.Count]; uniqueValues.CopyTo(decode, 0); var encode = new Dictionary <long?, int?>(); data.WriteVInt32(decode.Length); for (int i = 0; i < decode.Length; i++) { data.WriteInt64(decode[i].Value); encode[decode[i]] = i; } meta.WriteVInt32(PackedInt32s.VERSION_CURRENT); data.WriteVInt32(formatAndBits.Format.Id); data.WriteVInt32(formatAndBits.BitsPerValue); PackedInt32s.Writer writer = PackedInt32s.GetWriterNoHeader(data, formatAndBits.Format, maxDoc, formatAndBits.BitsPerValue, PackedInt32s.DEFAULT_BUFFER_SIZE); foreach (var nv in values) { var v = encode[nv.GetValueOrDefault()]; writer.Add((long)v); } writer.Finish(); } } else if (gcd != 0 && gcd != 1) { meta.WriteByte(MemoryDocValuesProducer.GCD_COMPRESSED); meta.WriteVInt32(PackedInt32s.VERSION_CURRENT); data.WriteInt64(minValue); data.WriteInt64(gcd); data.WriteVInt32(MemoryDocValuesProducer.BLOCK_SIZE); var writer = new BlockPackedWriter(data, MemoryDocValuesProducer.BLOCK_SIZE); foreach (var nv in values) { writer.Add((nv.GetValueOrDefault() - minValue) / gcd); } writer.Finish(); } else { meta.WriteByte(MemoryDocValuesProducer.DELTA_COMPRESSED); // delta-compressed meta.WriteVInt32(PackedInt32s.VERSION_CURRENT); data.WriteVInt32(MemoryDocValuesProducer.BLOCK_SIZE); var writer = new BlockPackedWriter(data, MemoryDocValuesProducer.BLOCK_SIZE); foreach (var nv in values) { writer.Add(nv.GetValueOrDefault()); } writer.Finish(); } }
public override Taxonomy GetEntityById(string id, ISet <Uri> namedGraphs) { throw new NotImplementedException(); }
public override IList <Taxonomy> GetEntities(EntitySearch entitySearch, IList <string> types, ISet <Uri> namedGraphs) { throw new NotImplementedException(); }
/// <summary> /// Represents a Facebook marketplace. Inherits `Thread` /// </summary> /// <param name="uid"></param> /// <param name="session"></param> /// <param name="photo"></param> /// <param name="name"></param> /// <param name="message_count"></param> /// <param name="last_message_timestamp"></param> /// <param name="plan"></param> /// <param name="participants"></param> /// <param name="nicknames"></param> /// <param name="color"></param> /// <param name="emoji"></param> /// <param name="admins"></param> /// <param name="approval_mode"></param> /// <param name="approval_requests"></param> /// <param name="join_link"></param> public FB_Marketplace(string uid, Session session, FB_Image photo = null, string name = null, int message_count = 0, string last_message_timestamp = null, FB_Plan plan = null, ISet <string> participants = null, Dictionary <string, string> nicknames = null, string color = null, JToken emoji = null, ISet <string> admins = null, bool approval_mode = false, ISet <string> approval_requests = null, string join_link = null) : base(uid, session, photo, name, message_count: message_count, last_message_timestamp: last_message_timestamp, plan: plan) { this.participants = participants ?? new HashSet <string>(); this.nicknames = nicknames ?? new Dictionary <string, string>(); this.color = color ?? ThreadColor.MESSENGER_BLUE; this.emoji = emoji; this.admins = admins ?? new HashSet <string>(); this.approval_mode = approval_mode; this.approval_requests = approval_requests ?? new HashSet <string>(); this.join_link = join_link; }
/// <summary> /// Load all stored fields. </summary> public DocumentStoredFieldVisitor() { this.fieldsToAdd = null; }
//public int calculateSize(bool nameTable) //{ // return Integer.BYTES + this.Count * Byte.BYTES; //} public void CollectNames(ISet <string> nameTable) { }
internal static void ProcessCertD1ii(int index, global::System.Collections.IList[] policyNodes, DerObjectIdentifier _poid, ISet _pq) { global::System.Collections.IList list = policyNodes[index - 1]; for (int i = 0; i < ((global::System.Collections.ICollection)list).get_Count(); i++) { PkixPolicyNode pkixPolicyNode = (PkixPolicyNode)list.get_Item(i); if (ANY_POLICY.Equals(pkixPolicyNode.ValidPolicy)) { ISet set = new HashSet(); set.Add(_poid.Id); PkixPolicyNode pkixPolicyNode2 = new PkixPolicyNode(Platform.CreateArrayList(), index, set, pkixPolicyNode, _pq, _poid.Id, critical: false); pkixPolicyNode.AddChild(pkixPolicyNode2); policyNodes[index].Add((object)pkixPolicyNode2); break; } } }
public AnalyzerAnonymousInnerClassHelper(TestKeepWordFilter outerInstance, ISet <string> words) { this.outerInstance = outerInstance; this.words = words; }
private static bool isDeltaCrl(X509Crl crl) { ISet criticalExtensionOids = crl.GetCriticalExtensionOids(); return(criticalExtensionOids.Contains(X509Extensions.DeltaCrlIndicator.Id)); }
/// <summary> /// Load only fields named in the provided <see cref="ISet{String}"/>. </summary> /// <param name="fieldsToAdd"> Set of fields to load, or <c>null</c> (all fields). </param> public DocumentStoredFieldVisitor(ISet <string> fieldsToAdd) { this.fieldsToAdd = fieldsToAdd; }
internal static TrustAnchor FindTrustAnchor(X509Certificate cert, ISet trustAnchors) { //IL_0028: Expected O, but got Unknown global::System.Collections.IEnumerator enumerator = ((global::System.Collections.IEnumerable)trustAnchors).GetEnumerator(); TrustAnchor trustAnchor = null; AsymmetricKeyParameter asymmetricKeyParameter = null; global::System.Exception ex = null; X509CertStoreSelector x509CertStoreSelector = new X509CertStoreSelector(); try { x509CertStoreSelector.Subject = GetIssuerPrincipal(cert); } catch (IOException val) { IOException val2 = val; throw new global::System.Exception("Cannot set subject search criteria for trust anchor.", (global::System.Exception)(object) val2); } while (enumerator.MoveNext() && trustAnchor == null) { trustAnchor = (TrustAnchor)enumerator.get_Current(); if (trustAnchor.TrustedCert != null) { if (x509CertStoreSelector.Match(trustAnchor.TrustedCert)) { asymmetricKeyParameter = trustAnchor.TrustedCert.GetPublicKey(); } else { trustAnchor = null; } } else if (trustAnchor.CAName != null && trustAnchor.CAPublicKey != null) { try { X509Name issuerPrincipal = GetIssuerPrincipal(cert); X509Name other = new X509Name(trustAnchor.CAName); if (issuerPrincipal.Equivalent(other, inOrder: true)) { asymmetricKeyParameter = trustAnchor.CAPublicKey; } else { trustAnchor = null; } } catch (InvalidParameterException) { trustAnchor = null; } } else { trustAnchor = null; } if (asymmetricKeyParameter != null) { try { cert.Verify(asymmetricKeyParameter); } catch (global::System.Exception ex3) { ex = ex3; trustAnchor = null; } } } if (trustAnchor == null && ex != null) { throw new global::System.Exception("TrustAnchor found but certificate validation failed.", ex); } return(trustAnchor); }
internal static bool ProcessCertD1i(int index, global::System.Collections.IList[] policyNodes, DerObjectIdentifier pOid, ISet pq) { global::System.Collections.IList list = policyNodes[index - 1]; for (int i = 0; i < ((global::System.Collections.ICollection)list).get_Count(); i++) { PkixPolicyNode pkixPolicyNode = (PkixPolicyNode)list.get_Item(i); ISet expectedPolicies = pkixPolicyNode.ExpectedPolicies; if (expectedPolicies.Contains(pOid.Id)) { ISet set = new HashSet(); set.Add(pOid.Id); PkixPolicyNode pkixPolicyNode2 = new PkixPolicyNode(Platform.CreateArrayList(), index, set, pkixPolicyNode, pq, pOid.Id, critical: false); pkixPolicyNode.AddChild(pkixPolicyNode2); policyNodes[index].Add((object)pkixPolicyNode2); return(true); } } return(false); }
/// <summary> /// Special delegating constructor that accepts storage backend (e.g. <see cref="JetBrains.Collections.Synchronized.SynchronizedSet{T}"/>) /// </summary> /// <param name="storage"></param> [PublicAPI] public ViewableSet([NotNull] #if !NET35 ISet <T> storage
internal static ISet GetDeltaCrls(global::System.DateTime currentDate, PkixParameters paramsPKIX, X509Crl completeCRL) { //IL_0023: Expected O, but got Unknown X509CrlStoreSelector x509CrlStoreSelector = new X509CrlStoreSelector(); try { global::System.Collections.IList list = Platform.CreateArrayList(); list.Add((object)completeCRL.IssuerDN); x509CrlStoreSelector.Issuers = (global::System.Collections.ICollection)list; } catch (IOException val) { IOException val2 = val; throw new global::System.Exception("Cannot extract issuer from CRL.", (global::System.Exception)(object) val2); } BigInteger bigInteger = null; try { Asn1Object extensionValue = GetExtensionValue(completeCRL, X509Extensions.CrlNumber); if (extensionValue != null) { bigInteger = DerInteger.GetInstance(extensionValue).PositiveValue; } } catch (global::System.Exception ex) { throw new global::System.Exception("CRL number extension could not be extracted from CRL.", ex); } byte[] issuingDistributionPoint = null; try { Asn1Object extensionValue2 = GetExtensionValue(completeCRL, X509Extensions.IssuingDistributionPoint); if (extensionValue2 != null) { issuingDistributionPoint = extensionValue2.GetDerEncoded(); } } catch (global::System.Exception ex2) { throw new global::System.Exception("Issuing distribution point extension value could not be read.", ex2); } x509CrlStoreSelector.MinCrlNumber = bigInteger?.Add(BigInteger.One); x509CrlStoreSelector.IssuingDistributionPoint = issuingDistributionPoint; x509CrlStoreSelector.IssuingDistributionPointEnabled = true; x509CrlStoreSelector.MaxBaseCrlNumber = bigInteger; ISet set = CrlUtilities.FindCrls(x509CrlStoreSelector, paramsPKIX, currentDate); ISet set2 = new HashSet(); global::System.Collections.IEnumerator enumerator = ((global::System.Collections.IEnumerable)set).GetEnumerator(); try { while (enumerator.MoveNext()) { X509Crl x509Crl = (X509Crl)enumerator.get_Current(); if (isDeltaCrl(x509Crl)) { set2.Add(x509Crl); } } return(set2); } finally { global::System.IDisposable disposable = enumerator as global::System.IDisposable; if (disposable != null) { disposable.Dispose(); } } }
public void CreateCalendar(string tenantId, string name, string description, string ownerId, ISet <string> participantsToShareWith, ICalendarCommandResult calendarCommandResult) { var tenant = new Tenant(tenantId); var owner = _collaboratorService.GetOwnerFrom(tenant, ownerId); var sharers = GetSharersFrom(tenant, participantsToShareWith); var calendar = new Calendar(tenant, _calendarRepository.GetNextIdentity(), name, description, owner, sharers); _calendarRepository.Save(calendar); calendarCommandResult.SetResultingCalendarId(calendar.CalendarId.Id); }
internal static void PrepareNextCertB1(int i, global::System.Collections.IList[] policyNodes, string id_p, IDictionary m_idp, X509Certificate cert) { bool flag = false; global::System.Collections.IEnumerator enumerator = ((global::System.Collections.IEnumerable)policyNodes[i]).GetEnumerator(); while (enumerator.MoveNext()) { PkixPolicyNode pkixPolicyNode = (PkixPolicyNode)enumerator.get_Current(); if (pkixPolicyNode.ValidPolicy.Equals(id_p)) { flag = true; pkixPolicyNode.ExpectedPolicies = (ISet)m_idp.get_Item((object)id_p); break; } } if (flag) { return; } enumerator = ((global::System.Collections.IEnumerable)policyNodes[i]).GetEnumerator(); while (enumerator.MoveNext()) { PkixPolicyNode pkixPolicyNode2 = (PkixPolicyNode)enumerator.get_Current(); if (!ANY_POLICY.Equals(pkixPolicyNode2.ValidPolicy)) { continue; } ISet policyQualifiers = null; Asn1Sequence asn1Sequence = null; try { asn1Sequence = Asn1Sequence.GetInstance(GetExtensionValue(cert, X509Extensions.CertificatePolicies)); } catch (global::System.Exception ex) { throw new global::System.Exception("Certificate policies cannot be decoded.", ex); } global::System.Collections.IEnumerator enumerator2 = asn1Sequence.GetEnumerator(); while (enumerator2.MoveNext()) { PolicyInformation policyInformation = null; try { policyInformation = PolicyInformation.GetInstance(enumerator2.get_Current()); } catch (global::System.Exception ex2) { throw new global::System.Exception("Policy information cannot be decoded.", ex2); } if (ANY_POLICY.Equals(policyInformation.PolicyIdentifier.Id)) { try { policyQualifiers = GetQualifierSet(policyInformation.PolicyQualifiers); } catch (PkixCertPathValidatorException cause) { throw new PkixCertPathValidatorException("Policy qualifier info set could not be built.", cause); } break; } } bool critical = false; ISet criticalExtensionOids = cert.GetCriticalExtensionOids(); if (criticalExtensionOids != null) { critical = criticalExtensionOids.Contains(X509Extensions.CertificatePolicies.Id); } PkixPolicyNode parent = pkixPolicyNode2.Parent; if (ANY_POLICY.Equals(parent.ValidPolicy)) { PkixPolicyNode pkixPolicyNode3 = new PkixPolicyNode(Platform.CreateArrayList(), i, (ISet)m_idp.get_Item((object)id_p), parent, policyQualifiers, id_p, critical); parent.AddChild(pkixPolicyNode3); policyNodes[i].Add((object)pkixPolicyNode3); } break; } }
public CommandLineOptions(string[] args) { // Defaults Mode = ExecutionMode.Game; Backend = GraphicsBackend.Vulkan; for (int i = 0; i < args.Length; i++) { var arg = args[i].ToUpperInvariant(); // Mode if (arg == "--GAME") { Mode = ExecutionMode.Game; } if (arg is "--DUMP" or "-D") { Mode = ExecutionMode.DumpData; } if (arg is "--ISO" or "-ISO") { Mode = ExecutionMode.BakeIsometric; } if (arg is "--CONVERT" or "--BUILD" or "-B") { if (i + 2 >= args.Length) { throw new FormatException("\"--convert\" requires two parameters: the mod to convert from and the mod to convert to"); } ConvertFrom = args[++i]; ConvertTo = args[++i]; Mode = ExecutionMode.ConvertAssets; } if (arg is "-H" or "--HELP" or "/?" or "HELP") { DisplayUsage(); Mode = ExecutionMode.Exit; return; } // Options if (arg is "-GL" or "--OPENGL") { Backend = GraphicsBackend.OpenGL; } if (arg is "-GLES" or "--OPENGLES") { Backend = GraphicsBackend.OpenGLES; } if (arg is "-VK" or "--VULKAN") { Backend = GraphicsBackend.Vulkan; } if (arg is "-METAL" or "--METAL") { Backend = GraphicsBackend.Metal; } if (arg is "-D3D" or "--DIRECT3D") { Backend = GraphicsBackend.Direct3D11; } if (arg == "--MENUS") { DebugMenus = true; } if (arg is "--NO-AUDIO" or "-MUTE" or "--MUTE") { Mute = true; } if (arg is "--STARTUPONlY" or "-S") { StartupOnly = true; } if (arg is "--RENDERDOC" or "-RD") { UseRenderDoc = true; } if (arg is "--COMMANDS" or "-C") { i++; if (i == args.Length) { Console.WriteLine("\"-c\" requires an argument specifying the commands to run"); Mode = ExecutionMode.Exit; return; } Commands = args[i].Split(';').Select(x => x.Trim()).ToArray(); } if (arg is "--TYPE" or "-T") { i++; if (i == args.Length) { Console.WriteLine("\"-type\" requires an argument specifying the asset types to process"); Mode = ExecutionMode.Exit; return; } DumpAssetTypes = new HashSet <AssetType>(); foreach (var type in args[i].Split(' ', StringSplitOptions.RemoveEmptyEntries)) { DumpAssetTypes.Add(Enum.Parse <AssetType>(type, true)); } } if (arg is "--ID" or "-ID" or "-IDS" or "--IDS") { i++; if (i == args.Length) { Console.WriteLine("\"-id\" requires an argument specifying the ids to process"); Mode = ExecutionMode.Exit; return; } DumpIds = args[i].Split(' ', StringSplitOptions.RemoveEmptyEntries); } if (arg is "--FILES" or "-F") { i++; if (i == args.Length) { Console.WriteLine("\"--files\" requires an argument specifying the regex to match against"); Mode = ExecutionMode.Exit; return; } ConvertFilePattern = new Regex(args[i]); } if (arg is "--FORMATS" or "--FORMAT") { i++; if (i == args.Length) { Console.WriteLine("\"--formats\" requires an argument specifying the formats to process"); Mode = ExecutionMode.Exit; return; } DumpFormats = 0; foreach (var type in args[i].Split(' ', StringSplitOptions.RemoveEmptyEntries)) { DumpFormats |= Enum.Parse <DumpFormats>(type, true); } } } }
public void ScheduleCalendarEntry(string tenantId, string calendarId, string description, string location, string ownerId, DateTime timeSpanBegins, DateTime timeSpanEnds, string repeatType, DateTime repeatEndsOn, string alarmType, int alarmUnits, ISet <string> participantsToInvite, ICalendarCommandResult calendarCommandResult) { var tenant = new Tenant(tenantId); var calendar = _calendarRepository.Get(tenant, new CalendarId(calendarId)); var calendarEntry = calendar.ScheduleCalendarEntry( _calendarIdentityService, description, location, _collaboratorService.GetOwnerFrom(tenant, ownerId), new DateRange(timeSpanBegins, timeSpanEnds), new Repetition((RepeatType)Enum.Parse(typeof(RepeatType), repeatType), repeatEndsOn), new Alarm((AlarmUnitsType)Enum.Parse(typeof(AlarmUnitsType), alarmType), alarmUnits), GetInviteesFrom(tenant, participantsToInvite)); _calendarEntryRepository.Save(calendarEntry); calendarCommandResult.SetResultingCalendarId(calendar.CalendarId.Id); calendarCommandResult.SetResultingCalendarEntryId(calendarEntry.CalendarEntryId.Id); }
public IfcDerivedUnit(IfcDerivedUnitElement[] __Elements, IfcDerivedUnitEnum __UnitType, IfcLabel?__UserDefinedType) { this._Elements = new HashSet <IfcDerivedUnitElement>(__Elements); this._UnitType = __UnitType; this._UserDefinedType = __UserDefinedType; }
public ThreadAnonymousInnerClassHelper(ThreadedIndexingAndSearchingTestCase outerInstance, LineFileDocs docs, long stopTime, ISet <string> delIDs, ISet <string> delPackIDs, IList <SubDocs> allSubDocs) { this.outerInstance = outerInstance; this.docs = docs; this.stopTime = stopTime; this.delIDs = delIDs; this.delPackIDs = delPackIDs; this.allSubDocs = allSubDocs; }
static bool TryDetermineOverridableProtocolMembers(SemanticModel semanticModel, SyntaxToken startToken, Accessibility seenAccessibility, out ISet <ISymbol> overridableMembers, CancellationToken cancellationToken) { var result = new HashSet <ISymbol> (); var containingType = semanticModel.GetEnclosingSymbolMD <INamedTypeSymbol> (startToken.SpanStart, cancellationToken); if (containingType != null && !containingType.IsScriptClass && !containingType.IsImplicitClass) { if (containingType.TypeKind == TypeKind.Class || containingType.TypeKind == TypeKind.Struct) { var baseTypes = containingType.GetBaseTypesMD().Reverse().Concat(containingType.AllInterfaces); foreach (var type in baseTypes) { if (cancellationToken.IsCancellationRequested) { overridableMembers = null; return(false); } // Prefer overrides in derived classes // RemoveOverriddenMembers (result, type, cancellationToken); // Retain overridable methods AddProtocolMembers(semanticModel, result, type, cancellationToken); } // Don't suggest already overridden members // RemoveOverriddenMembers (result, containingType, cancellationToken); } } // Filter based on accessibility if (seenAccessibility != Accessibility.NotApplicable) { result.RemoveWhere(m => m.DeclaredAccessibility != seenAccessibility); } // Filter members that are already overriden - they're already part of 'override completion' //ISet<ISymbol> realOverridableMembers; //if (OverrideContextHandler.TryDetermineOverridableMembers (semanticModel, startToken, seenAccessibility, out realOverridableMembers, cancellationToken)) { // result.RemoveWhere (m => realOverridableMembers.Any (m2 => IsEqualMember (m, m2))); //} overridableMembers = result; return(overridableMembers.Count > 0); }
/// <summary> /// Initializes a new instance of the <see cref="T:EventRaisingSet{TItem}"/> class. /// </summary> /// <param name='source'>The source collection that this instance wraps.</param> public EventRaisingSet(ISet <TItem> source) : base(source) { }
public Blog() { _posts = new HashedSet <Post>(); _users = new HashedSet <User>(); }
public TestAggregateState() { PingIds = new HashSet <PingId>(); }
public User() { _blogs = new HashedSet <Blog>(); }
internal void MergeClasses(ISet<Type> classes) { classes.AddToSet(Ex); Block.MergeClasses(classes); }