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>(); }
static void ParseInput() { //string[] inputStr = { "9", // "1 2 1", // "1 4 4", // "1 5 3", // "2 4 4", // "2 5 2", // "4 5 4", // "5 3 4", // "5 6 7", // "3 6 5" }; int N = int.Parse(Console.ReadLine()); paths = new Tuple<int, int, int>[N]; houses = new HashSet<int>(); for (int i = 1; i <= N; i++) { var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); paths[i-1] = new Tuple<int, int, int>(input[0], input[1], input[2]); houses.Add(input[0]); houses.Add(input[1]); } }
public SimpleFixedCityLayer(ISet<ICity> cities, ICityFactory<City> cityFactory) { Cities = cities; Cities.Add(cityFactory.Create(RedCityTile, Red)); Cities.Add(cityFactory.Create(BlueCityTile, Blue)); }
private TModel InvokeFactory(Func <TModel> factory) { var val = factory(); toWrite?.Add(val); return(val); }
/// <summary> /// Creates a new instance of <see cref="DocumentTitleMatchClassifier"/> /// </summary> /// <param name="title">the title to match.</param> public DocumentTitleMatchClassifier(string title) { if (title == null) { _potentialTitles = null; } else { title = title.Trim(); if (title.Length == 0) { _potentialTitles = null; } else { _potentialTitles = new HashSet<String> { title }; string p = GetLongestPart(title, "[ ]*[\\|»|:][ ]*"); if (p != null) { _potentialTitles.Add(p); } p = GetLongestPart(title, "[ ]*[\\|»|:\\(\\)][ ]*"); if (p != null) { _potentialTitles.Add(p); } p = GetLongestPart(title, "[ ]*[\\|»|:\\(\\)\\-][ ]*"); if (p != null) { _potentialTitles.Add(p); } p = GetLongestPart(title, "[ ]*[\\|»|,|:\\(\\)\\-][ ]*"); if (p != null) { _potentialTitles.Add(p); } } } }
internal WhitespaceScanner(TextReader reader, ErrorReporter reporter) : base(reader, reporter) { whitespace = new HashSet<char>(); whitespace.Add(' '); whitespace.Add('\t'); whitespace.Add('\n'); }
public SimpleFixedUnitLayer(ISet<IUnit> units, IUnitFactory<Archer> archerFactory, IUnitFactory<Legion> legionFactory, IUnitFactory<Settler> settlerFactory) { Units = units; Units.Add(archerFactory.Create(RedArcherTile, Red)); Units.Add(legionFactory.Create(BlueLegionTile, Blue)); Units.Add(settlerFactory.Create(RedSettlerTile, Red)); }
private static void ParseInput() { int N = int.Parse(Console.ReadLine()); paths = new Tuple<int, int, int>[N]; houses = new HashSet<int>(); for (int i = 0; i < N; i++) { var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); paths[i] = new Tuple<int, int, int>(input[0], input[1], input[2]); houses.Add(input[0]); houses.Add(input[1]); } }
static Window() { EmptyKeyMap = new KeyMap(); IgnoreKeys = new HashSet<Gdk.Key>(); IgnoreKeys.Add(Gdk.Key.Shift_L); IgnoreKeys.Add(Gdk.Key.Shift_R); IgnoreKeys.Add(Gdk.Key.Shift_Lock); IgnoreKeys.Add(Gdk.Key.Meta_L); IgnoreKeys.Add(Gdk.Key.Meta_R); IgnoreKeys.Add(Gdk.Key.Control_L); IgnoreKeys.Add(Gdk.Key.Control_R); IgnoreKeys.Add(Gdk.Key.Super_L); IgnoreKeys.Add(Gdk.Key.Super_R); IgnoreKeys.Add(Gdk.Key.Menu); }
public SimpleFixedTerrainLayer(ISet<ITerrain> terrains, ITerrainFactory<Hills> hillsFactory, ITerrainFactory<Mountains> mountainsFactory, ITerrainFactory<Oceans> oceansFactory, ITerrainFactory<Plains> plainsFactory) { Terrains = terrains; this.plainsFactory = plainsFactory; Terrains.Add(hillsFactory.Create(HillsTile)); Terrains.Add(mountainsFactory.Create(MountainsTile)); Terrains.Add(oceansFactory.Create(OceansTile)); AddRemainingPlains(); }
static void LoadGroup(IList<string> source, ISet<string> target) { foreach (string buffer in source) { target.Add(buffer); } }
private static void GetAllChildIdsUnix(int parentId, ISet<int> children, TimeSpan timeout) { string stdout; var exitCode = RunProcessAndWaitForExit( "pgrep", $"-P {parentId}", timeout, out stdout); if (exitCode == 0 && !string.IsNullOrEmpty(stdout)) { using (var reader = new StringReader(stdout)) { while (true) { var text = reader.ReadLine(); if (text == null) { return; } int id; if (int.TryParse(text, out id)) { children.Add(id); // Recursively get the children GetAllChildIdsUnix(id, children, timeout); } } } } }
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); } } }
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); } }
public static void AddAll(ISet<object> target, IEnumerable source) { foreach (object entry in source) { target.Add(entry); } }
public int LadderLength(string start, string end, ISet<string> dict) { var queue = new Queue<string>(); queue.Enqueue(start); dict.Add(end); int step = 0; while (queue.Count != 0) { var level = new Queue<string>(); step++; while (queue.Count != 0) { String q = queue.Dequeue(); if (q.Equals(end)) return step; for (int i = 0; i < start.Length; i++) { for (char c = 'a'; c <= 'z'; c++) { String s = q.Substring(0, i) + c + q.Substring(i + 1, start.Length - 1 - i); if (dict.Contains(s)) { level.Enqueue(s); dict.Remove(s); } } } } queue = level; } return 0; }
private static void FindRecursive(TrieNode node, ISet<string> results, string letters, string prefix, int? maxResults) { if (maxResults != null && results.Count == maxResults) { return; } if (node == null) { if (!results.Contains(letters)) { results.Add(letters); return; } } letters += node.Letter.ToString(); if (prefix.Length > 0) { if (node.ContainsKey(prefix[0])) { FindRecursive(node[prefix[0]], results, letters, prefix.Remove(0, 1), maxResults); } } else { foreach (char key in node.Keys) { FindRecursive(node[key], results, letters, prefix, maxResults); } } }
private static void AddState(RegexState state, ISet<RegexState> stateSet) { stateSet.Add(state); foreach (var eps in state.Epsilon) { AddState(eps, stateSet); } }
public override void ExtractTerms(ISet<Term> terms) { foreach (string val in _sel.Values) { terms.Add(new Term(_name, val)); } }
static EmptyGrammar() { BaseGrammar = Grammar.EmptyGrammar; RestrictedGrammar = new RestrictedStartSymbolGrammar(BaseGrammar); ExtendedGrammar = new ExtendedGrammar(RestrictedGrammar); EpsilonGrammaticals = new HashSet<GrammaticalSymbol>(); EpsilonGrammaticals.Add(BaseGrammar.StartSymbol); FirstSets = new Dictionary<GrammaticalSymbol, ISet<TerminalSymbol>>(); // S: #,Eps FirstSets[BaseGrammar.StartSymbol] = new HashSet<TerminalSymbol>( new TerminalSymbol[] { ExtendedGrammar.EndOfSourceSymbol, EpsilonSymbol.Instance }); FollowSets = new Dictionary<GrammaticalSymbol, ISet<TerminalSymbol>>(); // S: - FollowSets[BaseGrammar.StartSymbol] = new HashSet<TerminalSymbol>(); LR0CanonicalSets = new Syntan.SyntacticAnalysis.LR.LR0CanonicalSets(); LR0CanonicalSets.Add(new HashSet<Syntan.SyntacticAnalysis.LR.LR0Item>( new Syntan.SyntacticAnalysis.LR.LR0Item[] { new Syntan.SyntacticAnalysis.LR.LR0Item(BaseGrammar.Rules[0], 0) })); // SLR1ParserTable SLR1ParserTable = new Syntan.SyntacticAnalysis.LR.ParserTable(1, 1, 1); SLR1ParserTable.SetAction(0, 0, Syntan.SyntacticAnalysis.LR.ParserTable.Action.Accept()); }
protected override void AddMods( ISet<AttributeMod> mods, ISet<StatMod> statMods ) { int music, peace, provo, disco; GetSkillBonus( out music, out peace, out provo, out disco ); int statBonus = 2 + music + provo + peace + disco; statMods.Add( new StatMod( StatType.Str, "Invigorate Str", statBonus ) ); statMods.Add( new StatMod( StatType.Dex, "Invigorate Dex", statBonus ) ); statMods.Add( new StatMod( StatType.Int, "Invigorate Int", statBonus ) ); int hitsBonus = 5 + ( 2 * music ) + ( 3 * provo ) + peace + disco; mods.Add( new AttributeMod( MagicalAttribute.BonusHits, hitsBonus ) ); this.BuffInfo = new BuffInfo( this.BuffIcon, 1115613, 1115730, String.Format( "{0}\t{1}\t{1}\t{1}", hitsBonus, statBonus ), false ); }
/// <summary> /// Creates the local events and returns the creationEvents, the other Events are stored in the eventMap, handled objects are removed from storedObjects. /// </summary> /// <returns> /// The remote events. /// </returns> /// <param name='storedObjects'> /// Stored objects. /// </param> /// <param name='remoteTree'> /// Remote tree. /// </param> /// <param name='eventMap'> /// Event map. /// </param> public List<AbstractFolderEvent> CreateEvents( List<IMappedObject> storedObjects, IObjectTree<IFileableCmisObject> remoteTree, Dictionary<string, Tuple<AbstractFolderEvent, AbstractFolderEvent>> eventMap, ISet<IMappedObject> handledStoredObjects) { List<AbstractFolderEvent> createdEvents = new List<AbstractFolderEvent>(); var storedParent = storedObjects.Find(o => o.RemoteObjectId == remoteTree.Item.Id); foreach (var child in remoteTree.Children) { var storedMappedChild = storedObjects.Find(o => o.RemoteObjectId == child.Item.Id); if (storedMappedChild != null) { AbstractFolderEvent newEvent = this.CreateRemoteEventBasedOnStorage(child.Item, storedParent, storedMappedChild); eventMap[child.Item.Id] = new Tuple<AbstractFolderEvent, AbstractFolderEvent>(null, newEvent); } else { // Added AbstractFolderEvent addEvent = FileOrFolderEventFactory.CreateEvent(child.Item, null, MetaDataChangeType.CREATED, src: this); createdEvents.Add(addEvent); } createdEvents.AddRange(this.CreateEvents(storedObjects, child, eventMap, handledStoredObjects)); if (storedMappedChild != null) { handledStoredObjects.Add(storedMappedChild); } } return createdEvents; }
public override ISet<TokenGrammarElement> GetFirstSet(ISet<GrammarElement> alreadyTraversedItems) { var firstSet = new HashSet<TokenGrammarElement>(); if (alreadyTraversedItems.Add(this)) { foreach (var sequence in Switch) { if (!sequence.Any()) { firstSet.Add(Grammar.Epsilon); } else { for (int index = 0; index < sequence.Count; index++) { var subset = sequence[index].GetFirstSet(alreadyTraversedItems); bool containsEpsilon = subset.Remove(Grammar.Epsilon); firstSet.UnionWith(subset); if (!containsEpsilon) break; } } } } return firstSet; }
private void CheckRecursion(Spreadsheet spreadsheet, Cell current, ISet<CellAddress> stack) { try { var dependencies = PooledHashSet<CellAddress>.GetInstance(); try { GetDependencies(current.Expression, dependencies); if (dependencies.Overlaps(stack)) throw new CircularCellRefereceException(Resources.CircularReference); stack.Add(current.Address); foreach (var address in dependencies) { CheckRecursion(spreadsheet, spreadsheet[address], stack); } stack.Remove(current.Address); } finally { dependencies.Free(); } } catch (CircularCellRefereceException ex) { throw SpreadsheetException.AddCellAddressToErrorStack(ex, current.Address); } }
private static int MakeParametersUnique(ScriptAction action, ISet<Tuple<string, string>> properties, int sequence) { if (action.ConfigurationVariables == null) { return sequence; } foreach (var configVar in action.ConfigurationVariables) { var tuple = Tuple.Create(CleanInvalidCharacters(configVar.OriginalName), configVar.Value); if (!properties.Contains(tuple)) { if (properties.Any(p => p.Item1 == tuple.Item1 && p.Item2 != tuple.Item2)) { var newVariableName = configVar.RemappedName + sequence; sequence++; action.Arguments = action.Arguments?.Replace(configVar.RemappedName, newVariableName); configVar.RemappedName = newVariableName; } } properties.Add(tuple); } return sequence; }
public HierarchicalCodelistObjectBaseCore(IHierarchicalCodelistObject hcl, IList<ICodelistObject> referencedCodelists) : base(hcl) { this.hierarchies = new HashSet<IHierarchyObjectBase<IHierarchicalCodelistObjectBase>>(); /* foreach */ foreach (IHierarchy Ih in hcl.Hierarchies) { hierarchies.Add(new HierarchyObjectBaseCore(Ih, this, referencedCodelists)); } }
/// <summary> /// Eliminate the start symbol from right-hand sides /// </summary> /// <param name="productions"></param> private void StepStart(ISet<Production> productions) { var fresh = GetFresh(); productions.Add( // new Production(fresh, new Sentence { Nonterminal.Of("S") }) new Production(fresh, new Sentence { _grammar.Start }) ); _startSymbol = fresh; }
protected override void AddMods( ISet<AttributeMod> mods, ISet<StatMod> statMods ) { int music, peace, provo, disco; GetSkillBonus( out music, out peace, out provo, out disco ); int regenBonus = ( 1 + music ) * ( 1 + peace ) + provo + disco; mods.Add( new AttributeMod( MagicalAttribute.RegenHits, regenBonus ) ); mods.Add( new AttributeMod( MagicalAttribute.RegenStam, regenBonus ) ); mods.Add( new AttributeMod( MagicalAttribute.RegenMana, regenBonus ) ); int curseReduction = ( Math.Min( 1 + music, 1 + peace ) + ( disco / 3 ) + ( peace / 3 ) ) * 10; CurseReduction = curseReduction; // Resilience / +~1_HPR~ Hit Point Regeneration.<br>+~2_SR~ Stamina Regeneration.<br>+~3_MR~ Mana Regeneration.<br>Curse Durations Reduced.<br>Resistance to Poison.<br>Bleed Duration Reduced.<br>Mortal Wound Duration Reduced. this.BuffInfo = new BuffInfo( this.BuffIcon, 1115614, 1115731, String.Format( "{0}\t{0}\t{0}", regenBonus ), false ); }
/// <summary> /// Load only fields named in the provided fields. </summary> public DocumentStoredFieldVisitor(params string[] fields) { FieldsToAdd = new HashSet<string>(); foreach (string field in fields) { FieldsToAdd.Add(field); } }
/// <summary> /// Get the element ids created for this entity, for summary logging. /// </summary> /// <param name="createdElementIds">The creation list.</param> /// <remarks>May contain InvalidElementId; the caller is expected to remove it.</remarks> public override void GetCreatedElementIds(ISet<ElementId> createdElementIds) { // If we used ProjectInformation, don't report that. if (CreatedElementId != ElementId.InvalidElementId && CreatedElementId != Importer.TheCache.ProjectInformationId) { createdElementIds.Add(CreatedElementId); } }
internal async Task <IRoutingTable> UpdateRoutingTableAsync(IRoutingTable routingTable, AccessMode mode, string database, Bookmark bookmark, ISet <Uri> triedUris = null) { if (database == null) { throw new ArgumentNullException(nameof(database)); } var knownRouters = routingTable?.Routers ?? throw new ArgumentNullException(nameof(routingTable)); foreach (var router in knownRouters) { triedUris?.Add(router); try { var conn = await _poolManager.CreateClusterConnectionAsync(router).ConfigureAwait(false); if (conn == null) { routingTable.Remove(router); } else { var newRoutingTable = await _discovery.DiscoverAsync(conn, database, bookmark).ConfigureAwait(false); if (!newRoutingTable.IsStale(mode)) { return(newRoutingTable); } _logger?.Debug("Skipping stale routing table received from server '{0}' for database '{1}'", router, database); } } catch (SecurityException e) { _logger?.Error(e, "Failed to update routing table from server '{0}' for database '{1}' because of a security exception.", router, database); throw; } catch (FatalDiscoveryException e) { _logger?.Error(e, "Failed to update routing table from server '{0}' for database '{1}' because of a fatal discovery exception.", router, database); throw; } catch (Exception e) { _logger?.Warn(e, "Failed to update routing table from server '{0}' for database '{1}'.", router, database); } } return(null); }
public AnnotableMutableObjectBaseCore(IAnnotableObject annotableObject) { this._annotations = new HashSet<IAnnotationMutableObjectBase>(); if (annotableObject.Annotations != null) { /* foreach */ foreach (IAnnotation annotation in annotableObject.Annotations) { _annotations.Add(new AnnotationMutableObjectBaseCore(annotation)); } } }
public static string ToTypeName(this TypeReference?typeReference, ISet <string>?usingNamespaces = null, bool makeNullable = false) { if (typeReference is null) { throw new ArgumentNullException(nameof(typeReference)); } if (typeReference.Ref is not null) { return(HandleRefValue(typeReference.Ref)); } switch (typeReference.Type) { case ObjectType.Array: if (typeReference.ArrayItems is null) { throw new InvalidOperationException("Array type must have array items value."); } usingNamespaces?.Add("System.Collections.Generic"); return($"IEnumerable<{typeReference.ArrayItems.ToTypeName(usingNamespaces, makeNullable)}>"); case ObjectType.Boolean: return("bool" + (makeNullable ? "?" : string.Empty)); case ObjectType.Function: usingNamespaces?.Add("System"); return("Action"); case ObjectType.Integer: return("int" + (makeNullable ? "?" : string.Empty)); case ObjectType.Number: return("double" + (makeNullable ? "?" : string.Empty)); case ObjectType.String: return("string"); default: return("object"); } }
public static ICompilationUnitBuilder AddDefines(this ICompilationUnitBuilder compilationUnitBuilder, params string[] defines) { ISet <string> configuredDefines = compilationUnitBuilder.Options.Defines as ISet <string>; foreach (string define in defines ?? Array.Empty <string>()) { configuredDefines?.Add(define); } return(compilationUnitBuilder); }
public async Task <IRoutingTable> UpdateRoutingTableAsync(ISet <Uri> triedUris = null, Func <IConnection, Task <IRoutingTable> > rediscoveryFunc = null) { rediscoveryFunc = rediscoveryFunc ?? RediscoveryAsync; var knownRouters = _routingTable.Routers; foreach (var router in knownRouters) { triedUris?.Add(router); IConnection conn = await _poolManager.CreateClusterConnectionAsync(router).ConfigureAwait(false); if (conn == null) { _routingTable.Remove(router); } else { try { var roundRobinRoutingTable = await rediscoveryFunc(conn).ConfigureAwait(false); if (!IsRoutingTableStale(roundRobinRoutingTable)) { return(roundRobinRoutingTable); } } catch (Exception e) { _logger?.Warn(e, "Failed to update routing table with server uri={0}.", router); if (e is SessionExpiredException) { // ignored // Already handled by clusterConn.OnConnectionError to remove from load balancer } else { throw; } } } } return(null); }
/// <summary> /// Check filters in Types.None items and modify list if filtered item found /// </summary> private void CheckFilter(string filterText, int filterIndex, Types type, int colorIndex, ISet <int> foundFilters) { var currentList = new List <Token>(this); Clear(); foreach (var item in currentList) { // search only in Types.None if (item.Type != Types.None) { Add(item); continue; } var s = item.Text; var match = Matcher.GetMatchTextIndex(s, filterText); // while token is found in the string while (match.Item1 != -1) { // skip text till found index if (match.Item1 > 0) { var head = s.Substring(0, match.Item1); Add(new Token(Types.None, head)); } // change Type for found token var h = s.Substring(match.Item1, match.Item2); Add(new Token(type, h, colorIndex)); foundFilters?.Add(filterIndex); // keep searching in remained text s = s.Substring(match.Item1 + match.Item2, s.Length - match.Item1 - match.Item2); match = Matcher.GetMatchTextIndex(s, filterText); } // do not forget to save not found tail if (!string.IsNullOrEmpty(s)) { Add(new Token(Types.None, s)); } } }
internal IRoutingTable UpdateRoutingTable(Func <IConnection, IRoutingTable> rediscoveryFunc = null, ISet <Uri> triedUris = null) { lock (_syncLock) { rediscoveryFunc = rediscoveryFunc ?? Rediscovery; while (true) { Uri uri; if (!_routingTable.TryNextRouter(out uri)) { // no alive server return(null); } triedUris?.Add(uri); IConnection conn = CreateClusterConnection(uri); if (conn != null) { try { var roundRobinRoutingTable = rediscoveryFunc(conn); if (!IsRoutingTableStale(roundRobinRoutingTable)) { return(roundRobinRoutingTable); } } catch (Exception e) { _logger?.Info($"Failed to update routing table with server uri={uri} due to error {e.Message}"); if (e is SessionExpiredException) { // ignored // Already handled by clusterConn.OnConnectionError to remove from load balancer } else { throw; } } } } } }
public async Task <IRoutingTable> UpdateRoutingTableAsync(ISet <Uri> triedUris = null, Func <IConnection, Task <IRoutingTable> > rediscoveryFunc = null) { var knownRouters = _routingTable.Routers; foreach (var router in knownRouters) { triedUris?.Add(router); try { var conn = await _poolManager.CreateClusterConnectionAsync(router).ConfigureAwait(false); if (conn == null) { _routingTable.Remove(router); } else { var newRoutingTable = await _discovery.DiscoverAsync(conn).ConfigureAwait(false); if (!IsRoutingTableStale(newRoutingTable)) { return(newRoutingTable); } } } catch (SecurityException e) { _logger?.Error(e, "Failed to update routing table from server '{0}' because of a security exception.", router); throw; } catch (Exception e) { _logger?.Warn(e, "Failed to update routing table from server '{0}'.", router); } } return(null); }
private async Task copyConfigDirFromZk(string fromZkPath, string toZkPath, ISet <string> copiedToZkPaths = null) { try { var files = await zkClient.getChildren(fromZkPath, null, true); foreach (var file in files) { var children = await zkClient.getChildren(fromZkPath + "/" + file, null, true); if (!children.Any()) { var toZkFilePath = toZkPath + "/" + file; //TODO: Log here //logger.info("Copying zk node {} to {}",fromZkPath + "/" + file, toZkFilePath); var data = await zkClient.getData(fromZkPath + "/" + file, null, null, true); //Take care it fails on Exists await zkClient.makePath(toZkFilePath, data, true); copiedToZkPaths?.Add(toZkFilePath); } else { await copyConfigDirFromZk(fromZkPath + "/" + file, toZkPath + "/" + file, copiedToZkPaths); } } } catch (Exception ex) { if (ex is KeeperException || ex is ThreadInterruptedException) { throw new IOException("Error copying nodes from zookeeper path " + fromZkPath + " to " + toZkPath, SolrZkClient.checkInterrupted(ex)); } throw; } }
internal virtual void AddProperty(Command.PropertyCommand property) { Properties.Add(property); }
public override void GetDependencies(ISet <Binding> injectDependencies, ISet <Binding> propertyDependencies) { injectDependencies.Add(elementBinding); }
private void Add(IValueStore valueStore) { _changedValues.Add(valueStore); }
protected override void Perform(ISet <int> c, int parameter) { c.Add(parameter); }
public void Inspect(string email, Action callback) { _rules.Inspect(email, callback); _inspectedEmails.Add(email); }
public async Task AddAsync(User user) { _users.Add(user); await Task.CompletedTask; }
protected override void deepCopy(DomainObject domainObject) { base.deepCopy(domainObject); Element element = (Element)domainObject; naziv = element.naziv; engleskiNaziv = element.engleskiNaziv; nazivPoGimnasticaru = element.nazivPoGimnasticaru; sprava = element.sprava; isTablicniElement = element.isTablicniElement; grupa = element.grupa; tezina = element.tezina; broj = element.broj; podBroj = element.podBroj; grupaBroj = element.grupaBroj; //parentId = element.parentId; if (shouldClone(new TypeAsocijacijaPair(typeof(Video)))) { foreach (Video v in element.VideoKlipovi) { videoKlipovi.Add((Video)v.Clone()); } } else { foreach (Video v in element.VideoKlipovi) { videoKlipovi.Add(v); } } if (shouldClone(new TypeAsocijacijaPair(typeof(Slika)))) { foreach (Slika s in element.Slike) { slike.Add((Slika)s.Clone()); } } else { foreach (Slika s in element.Slike) { slike.Add(s); } } // TODO: Ovo je error prone, zato sto ako kasnije promenim (refaktorisem) // ime promenljive 'varijante', kod nece raditi. Vidi da li moze nekako // drugacije //varijante = new List<Element>(); if (shouldClone(new TypeAsocijacijaPair(typeof(Element), "varijante"))) { foreach (Element e in element.Varijante) { varijante.Add((Element)e.Clone()); } } else { foreach (Element e in element.Varijante) { varijante.Add(e); } } parent = element.parent; if (parent != null && shouldClone(new TypeAsocijacijaPair( typeof(Element), "parent"))) { parent = (Element)element.Clone(); } }
/// <summary> /// Adds the specified item to the roster. /// </summary> /// <param name="item">The item to add.</param> /// <returns>True if the item was added to the collection of roster items; /// Otherwise false.</returns> internal bool Add(RosterItem item) { return(items.Add(item)); }
public void AddSynchronizedTable(string table) { synchronizedTables.Add(table); }
public void Add(Func <string, bool> keepPredicate) { keepPredicates.Add(keepPredicate); }
public override void ExtractTerms(ISet <Term> terms) { terms.Add(Term); }
private BoundStatement Bind(AssignmentStatement assignmentStatement) { initializedVariables.Add(assignmentStatement.Variable); return(new BoundAssignmentStatement(assignmentStatement.Variable, Bind(assignmentStatement.Expression))); }
public override WatchedResource Watch(File file) { _filesToWatch.Add(file); return(Org.Neo4j.Io.fs.watcher.resource.WatchedResource_Fields.Empty); }
private bool TryValidateObjectRecursive( object obj, ICollection<ValidationResult> validationResults, ISet<object> validatedObjects, IDictionary<object, object> validationContextItems = null ) { //short-circuit to avoid infinite loops on cyclical object graphs if (validatedObjects.Contains(obj)) { return true; } validatedObjects.Add(obj); var result = TryValidateObject(obj, validationResults, validationContextItems); var properties = obj.GetType().GetProperties().Where(prop => prop.CanRead && !prop.GetCustomAttributes(typeof(SkipRecursiveValidationAttribute), false).Any() && prop.GetIndexParameters().Length == 0).ToList(); foreach (var property in properties) { if (property.PropertyType == typeof(string) || property.PropertyType.IsValueType) continue; var value = obj.GetPropertyValue(property.Name); List<ValidationResult> nestedResults; switch (value) { case null: continue; case IEnumerable asEnumerable: foreach (var item in asEnumerable) { //NOTE: This does not tell you which item in the IEnumerable<T> failed //Possibly, should have a separate case for Array/Dictionary if (item == null) continue; nestedResults = new List<ValidationResult>(); if (!TryValidateObjectRecursive( item, nestedResults, validatedObjects, validationContextItems )) { result = false; foreach (var validationResult in nestedResults) { var property1 = property; validationResults.Add( new ValidationResult( validationResult.ErrorMessage, validationResult.MemberNames.Select(x => property1.Name + '.' + x) )); } } } break; default: nestedResults = new List<ValidationResult>(); if (!TryValidateObjectRecursive( value, nestedResults, validatedObjects, validationContextItems )) { result = false; foreach (var validationResult in nestedResults) { var property1 = property; validationResults.Add( new ValidationResult( validationResult.ErrorMessage, validationResult.MemberNames.Select(x => property1.Name + '.' + x) )); } } break; } } return result; }
protected override void UpdateNamespaces(ISet <string> namespaces) => namespaces.Add(typeof(System.Linq.Enumerable).Namespace);
public static IDictionary <Type, IEnumerable <IEntity> > ConvertToEntities(this IEnumerable <FlatTableRow> flatTableRows) { foreach (var row in flatTableRows) { var film = new Films { NameFilm = row.NameFilm, Length = row.Length, Country = row.Country, ReleaseDate = row.ReleaseDate, //if (film.Director != null) Director = row.NameDirector != null ? new Directors() { NameDirector = row.NameDirector } : null, Type = row.NameType != null ? new Typess() { NameType = row.NameType }:null, Genre = row.NameGenre != null ? new Genres() { NameGenre = row.NameGenre } : null }; var director = new Directors { NameDirector = row.NameDirector }; var genre = new Genres { NameGenre = row.NameGenre }; var tag = new Tags { NameTag = row.NameTag }; var type = new Typess { NameType = row.NameType }; var tagsFilms = new TagsFilms { Tag = tag, Film = film }; if (row.NameFilm != null) { Films.Add(film); } if (row.NameDirector != null) { Directors.Add(director); } if (row.NameGenre != null) { Genres.Add(genre); } if (row.NameTag != null) { Tags.Add(tag); } if (row.NameType != null) { Typess.Add(type); } film = Films.SingleOrDefault(x => x.Equals(film)); director = Directors.SingleOrDefault(x => x.Equals(director)); genre = Genres.SingleOrDefault(x => x.Equals(genre)); tag = Tags.SingleOrDefault(x => x.Equals(tag)); type = Typess.SingleOrDefault(x => x.Equals(type)); //if (!film.NameTag.Contains(tag, new TagsComparer())) //{ // film.NameTag.Add(tag); // //tag.Films= film; //} //if (!tag?.TagsFilms.Contains(tagsFilms)??false) //{ if (tag != null) { TagsFilms.Add(tagsFilms); tag.TagsFilms.Add(tagsFilms); film.TagsFilms.Add(tagsFilms); tagsFilms.Tag = tag; tagsFilms.Film = film; } //} } return(new Dictionary <Type, IEnumerable <IEntity> > { [typeof(Films)] = Films, [typeof(Directors)] = Directors, [typeof(Genres)] = Genres, [typeof(Tags)] = Tags, [typeof(Typess)] = Typess, [typeof(TagsFilms)] = TagsFilms }); }
/// <summary>Processes an object.</summary> /// <param name="obj">The object to process.</param> /// <param name="path">The path</param> /// <param name="typeNameHint">The type name hint.</param> /// <param name="checkedObjects">The checked objects.</param> /// <param name="replacer">The replacer.</param> /// <returns>The task.</returns> protected virtual async Task VisitAsync(object obj, string path, string typeNameHint, ISet <object> checkedObjects, Action <object> replacer) { if (obj == null || checkedObjects.Contains(obj)) { return; } checkedObjects.Add(obj); if (obj is IJsonReference reference) { var newReference = await VisitJsonReferenceAsync(reference, path, typeNameHint); if (newReference != reference) { replacer(newReference); return; } } if (obj is JsonSchema4 schema) { if (schema.Reference != null) { await VisitAsync(schema.Reference, path, null, checkedObjects, o => schema.Reference = (JsonSchema4)o); } if (schema.AdditionalItemsSchema != null) { await VisitAsync(schema.AdditionalItemsSchema, path + "/additionalItems", null, checkedObjects, o => schema.AdditionalItemsSchema = (JsonSchema4)o); } if (schema.AdditionalPropertiesSchema != null) { await VisitAsync(schema.AdditionalPropertiesSchema, path + "/additionalProperties", null, checkedObjects, o => schema.AdditionalPropertiesSchema = (JsonSchema4)o); } if (schema.Item != null) { await VisitAsync(schema.Item, path + "/items", null, checkedObjects, o => schema.Item = (JsonSchema4)o); } for (var i = 0; i < schema.Items.Count; i++) { var index = i; await VisitAsync(schema.Items.ElementAt(i), path + "/items[" + i + "]", null, checkedObjects, o => ReplaceOrDelete(schema.Items, index, (JsonSchema4)o)); } for (var i = 0; i < schema.AllOf.Count; i++) { var index = i; await VisitAsync(schema.AllOf.ElementAt(i), path + "/allOf[" + i + "]", null, checkedObjects, o => ReplaceOrDelete(schema.AllOf, index, (JsonSchema4)o)); } for (var i = 0; i < schema.AnyOf.Count; i++) { var index = i; await VisitAsync(schema.AnyOf.ElementAt(i), path + "/anyOf[" + i + "]", null, checkedObjects, o => ReplaceOrDelete(schema.AnyOf, index, (JsonSchema4)o)); } for (var i = 0; i < schema.OneOf.Count; i++) { var index = i; await VisitAsync(schema.OneOf.ElementAt(i), path + "/oneOf[" + i + "]", null, checkedObjects, o => ReplaceOrDelete(schema.OneOf, index, (JsonSchema4)o)); } if (schema.Not != null) { await VisitAsync(schema.Not, path + "/not", null, checkedObjects, o => schema.Not = (JsonSchema4)o); } foreach (var p in schema.Properties.ToArray()) { await VisitAsync(p.Value, path + "/properties/" + p.Key, p.Key, checkedObjects, o => schema.Properties[p.Key] = (JsonProperty)o); } foreach (var p in schema.PatternProperties.ToArray()) { await VisitAsync(p.Value, path + "/patternProperties/" + p.Key, null, checkedObjects, o => schema.PatternProperties[p.Key] = (JsonProperty)o); } foreach (var p in schema.Definitions.ToArray()) { await VisitAsync(p.Value, path + "/definitions/" + p.Key, p.Key, checkedObjects, o => { if (o != null) { schema.Definitions[p.Key] = (JsonSchema4)o; } else { schema.Definitions.Remove(p.Key); } }); } } if (!(obj is string) && !(obj is JToken)) { // Reflection fallback if (obj is IDictionary dictionary) { await VisitPropertiesAsync(obj, path, checkedObjects); foreach (var key in dictionary.Keys.OfType <object>().ToArray()) { await VisitAsync(dictionary[key], path + "/" + key, key.ToString(), checkedObjects, o => { if (o != null) { dictionary[key] = (JsonSchema4)o; } else { dictionary.Remove(key); } }); } } else if (obj is IList list) { var items = list.OfType <object>().ToArray(); for (var i = 0; i < items.Length; i++) { var index = i; await VisitAsync(items[i], path + "[" + i + "]", null, checkedObjects, o => ReplaceOrDelete(list, index, o)); } } else if (obj is IEnumerable enumerable) { var items = enumerable.OfType <object>().ToArray(); for (var i = 0; i < items.Length; i++) { await VisitAsync(items[i], path + "[" + i + "]", null, checkedObjects, o => throw new NotSupportedException("Cannot replace enumerable item.")); } } else { await VisitPropertiesAsync(obj, path, checkedObjects); } } }
static CmsSignedHelper() { AddEntries(NistObjectIdentifiers.DsaWithSha224, "SHA224", "DSA"); AddEntries(NistObjectIdentifiers.DsaWithSha256, "SHA256", "DSA"); AddEntries(NistObjectIdentifiers.DsaWithSha384, "SHA384", "DSA"); AddEntries(NistObjectIdentifiers.DsaWithSha512, "SHA512", "DSA"); AddEntries(OiwObjectIdentifiers.DsaWithSha1, "SHA1", "DSA"); AddEntries(OiwObjectIdentifiers.MD4WithRsa, "MD4", "RSA"); AddEntries(OiwObjectIdentifiers.MD4WithRsaEncryption, "MD4", "RSA"); AddEntries(OiwObjectIdentifiers.MD5WithRsa, "MD5", "RSA"); AddEntries(OiwObjectIdentifiers.Sha1WithRsa, "SHA1", "RSA"); AddEntries(PkcsObjectIdentifiers.MD2WithRsaEncryption, "MD2", "RSA"); AddEntries(PkcsObjectIdentifiers.MD4WithRsaEncryption, "MD4", "RSA"); AddEntries(PkcsObjectIdentifiers.MD5WithRsaEncryption, "MD5", "RSA"); AddEntries(PkcsObjectIdentifiers.Sha1WithRsaEncryption, "SHA1", "RSA"); AddEntries(PkcsObjectIdentifiers.Sha224WithRsaEncryption, "SHA224", "RSA"); AddEntries(PkcsObjectIdentifiers.Sha256WithRsaEncryption, "SHA256", "RSA"); AddEntries(PkcsObjectIdentifiers.Sha384WithRsaEncryption, "SHA384", "RSA"); AddEntries(PkcsObjectIdentifiers.Sha512WithRsaEncryption, "SHA512", "RSA"); AddEntries(X9ObjectIdentifiers.ECDsaWithSha1, "SHA1", "ECDSA"); AddEntries(X9ObjectIdentifiers.ECDsaWithSha224, "SHA224", "ECDSA"); AddEntries(X9ObjectIdentifiers.ECDsaWithSha256, "SHA256", "ECDSA"); AddEntries(X9ObjectIdentifiers.ECDsaWithSha384, "SHA384", "ECDSA"); AddEntries(X9ObjectIdentifiers.ECDsaWithSha512, "SHA512", "ECDSA"); AddEntries(X9ObjectIdentifiers.IdDsaWithSha1, "SHA1", "DSA"); AddEntries(EacObjectIdentifiers.id_TA_ECDSA_SHA_1, "SHA1", "ECDSA"); AddEntries(EacObjectIdentifiers.id_TA_ECDSA_SHA_224, "SHA224", "ECDSA"); AddEntries(EacObjectIdentifiers.id_TA_ECDSA_SHA_256, "SHA256", "ECDSA"); AddEntries(EacObjectIdentifiers.id_TA_ECDSA_SHA_384, "SHA384", "ECDSA"); AddEntries(EacObjectIdentifiers.id_TA_ECDSA_SHA_512, "SHA512", "ECDSA"); AddEntries(EacObjectIdentifiers.id_TA_RSA_v1_5_SHA_1, "SHA1", "RSA"); AddEntries(EacObjectIdentifiers.id_TA_RSA_v1_5_SHA_256, "SHA256", "RSA"); AddEntries(EacObjectIdentifiers.id_TA_RSA_PSS_SHA_1, "SHA1", "RSAandMGF1"); AddEntries(EacObjectIdentifiers.id_TA_RSA_PSS_SHA_256, "SHA256", "RSAandMGF1"); encryptionAlgs.Add(X9ObjectIdentifiers.IdDsa.Id, "DSA"); encryptionAlgs.Add(PkcsObjectIdentifiers.RsaEncryption.Id, "RSA"); encryptionAlgs.Add(TeleTrusTObjectIdentifiers.TeleTrusTRsaSignatureAlgorithm, "RSA"); encryptionAlgs.Add(X509ObjectIdentifiers.IdEARsa.Id, "RSA"); encryptionAlgs.Add(CmsSignedGenerator.EncryptionRsaPss, "RSAandMGF1"); encryptionAlgs.Add(CryptoProObjectIdentifiers.GostR3410x94.Id, "GOST3410"); encryptionAlgs.Add(CryptoProObjectIdentifiers.GostR3410x2001.Id, "ECGOST3410"); encryptionAlgs.Add("1.3.6.1.4.1.5849.1.6.2", "ECGOST3410"); encryptionAlgs.Add("1.3.6.1.4.1.5849.1.1.5", "GOST3410"); digestAlgs.Add(PkcsObjectIdentifiers.MD2.Id, "MD2"); digestAlgs.Add(PkcsObjectIdentifiers.MD4.Id, "MD4"); digestAlgs.Add(PkcsObjectIdentifiers.MD5.Id, "MD5"); digestAlgs.Add(OiwObjectIdentifiers.IdSha1.Id, "SHA1"); digestAlgs.Add(NistObjectIdentifiers.IdSha224.Id, "SHA224"); digestAlgs.Add(NistObjectIdentifiers.IdSha256.Id, "SHA256"); digestAlgs.Add(NistObjectIdentifiers.IdSha384.Id, "SHA384"); digestAlgs.Add(NistObjectIdentifiers.IdSha512.Id, "SHA512"); digestAlgs.Add(TeleTrusTObjectIdentifiers.RipeMD128.Id, "RIPEMD128"); digestAlgs.Add(TeleTrusTObjectIdentifiers.RipeMD160.Id, "RIPEMD160"); digestAlgs.Add(TeleTrusTObjectIdentifiers.RipeMD256.Id, "RIPEMD256"); digestAlgs.Add(CryptoProObjectIdentifiers.GostR3411.Id, "GOST3411"); digestAlgs.Add("1.3.6.1.4.1.5849.1.2.1", "GOST3411"); digestAliases.Add("SHA1", new string[] { "SHA-1" }); digestAliases.Add("SHA224", new string[] { "SHA-224" }); digestAliases.Add("SHA256", new string[] { "SHA-256" }); digestAliases.Add("SHA384", new string[] { "SHA-384" }); digestAliases.Add("SHA512", new string[] { "SHA-512" }); noParams.Add(CmsSignedGenerator.EncryptionDsa); // noParams.Add(EncryptionECDsa); noParams.Add(EncryptionECDsaWithSha1); noParams.Add(EncryptionECDsaWithSha224); noParams.Add(EncryptionECDsaWithSha256); noParams.Add(EncryptionECDsaWithSha384); noParams.Add(EncryptionECDsaWithSha512); ecAlgorithms.Add(CmsSignedGenerator.DigestSha1, EncryptionECDsaWithSha1); ecAlgorithms.Add(CmsSignedGenerator.DigestSha224, EncryptionECDsaWithSha224); ecAlgorithms.Add(CmsSignedGenerator.DigestSha256, EncryptionECDsaWithSha256); ecAlgorithms.Add(CmsSignedGenerator.DigestSha384, EncryptionECDsaWithSha384); ecAlgorithms.Add(CmsSignedGenerator.DigestSha512, EncryptionECDsaWithSha512); }
public async Task AddAsync(Article article) { _articles.Add(article); await Task.CompletedTask; }
private static void ProcessCatalog(ManagedPokemonCatalog catalog, ISet <string> fileNames, string root) { foreach (var catalogEntry in catalog.Entries) { fileNames.Add(catalogEntry.ModelPath); fileNames.Add(catalogEntry.ConfigurationPath); var archive = new GFPAK(Path.Combine(root, catalogEntry.PackagePath)); var model = PokemonModel.GetRootAsPokemonModel(archive.GetFile(catalogEntry.ModelPath).Span.ToByteBuffer()); var modelPath = Path.GetDirectoryName(catalogEntry.ModelPath); fileNames.Add(Path.Combine(modelPath, "__ArchiveShader.bnsh").UnixPath(false)); fileNames.Add(Path.Combine(modelPath, "__Combined.bntx").UnixPath(false)); for (var i = 0; i < model.TexturesLength; ++i) { fileNames.Add(Path.Combine(modelPath, model.Textures(i) + ".bntx").UnixPath(false)); } for (var i = 0; i < model.ShaderNamesLength; ++i) { var shader = model.ShaderNames(i); // NOICE! fileNames.Add(Path.Combine(modelPath, shader + ".bnsh").UnixPath(false)); fileNames.Add(Path.Combine(modelPath, shader + ".bnsh_fsh").UnixPath(false)); fileNames.Add(Path.Combine(modelPath, shader + ".bnsh_gsh").UnixPath(false)); fileNames.Add(Path.Combine(modelPath, shader + ".bnsh_vsh").UnixPath(false)); fileNames.Add(Path.Combine(modelPath, $"ArchiveShader-{shader}.bnsh").UnixPath(false)); } var name = Path.GetFileName(Path.GetDirectoryName(catalogEntry.ConfigurationPath)); foreach (var animationConfig in catalogEntry.AnimationSets.Values) { fileNames.Add(animationConfig); var animationPath = Path.GetDirectoryName(animationConfig); fileNames.Add(Path.Combine(animationPath, name + ".gfbanm").UnixPath(false)); var config = PokemonAnimationConfig.GetRootAsPokemonAnimationConfig(archive.GetFile(animationConfig).Span.ToByteBuffer()); var animationData = config.AnimationData.GetValueOrDefault(); for (var i = 0; i < animationData.ReferencesLength; ++i) { fileNames.Add(Path.Combine(animationPath, animationData.References(i).GetValueOrDefault().Path).UnixPath(false)); } } } }
static X509Utilities() { algorithms.Add("MD2WITHRSAENCRYPTION", PkcsObjectIdentifiers.MD2WithRsaEncryption); algorithms.Add("MD2WITHRSA", PkcsObjectIdentifiers.MD2WithRsaEncryption); algorithms.Add("MD5WITHRSAENCRYPTION", PkcsObjectIdentifiers.MD5WithRsaEncryption); algorithms.Add("MD5WITHRSA", PkcsObjectIdentifiers.MD5WithRsaEncryption); algorithms.Add("SHA1WITHRSAENCRYPTION", PkcsObjectIdentifiers.Sha1WithRsaEncryption); algorithms.Add("SHA1WITHRSA", PkcsObjectIdentifiers.Sha1WithRsaEncryption); algorithms.Add("SHA224WITHRSAENCRYPTION", PkcsObjectIdentifiers.Sha224WithRsaEncryption); algorithms.Add("SHA224WITHRSA", PkcsObjectIdentifiers.Sha224WithRsaEncryption); algorithms.Add("SHA256WITHRSAENCRYPTION", PkcsObjectIdentifiers.Sha256WithRsaEncryption); algorithms.Add("SHA256WITHRSA", PkcsObjectIdentifiers.Sha256WithRsaEncryption); algorithms.Add("SHA384WITHRSAENCRYPTION", PkcsObjectIdentifiers.Sha384WithRsaEncryption); algorithms.Add("SHA384WITHRSA", PkcsObjectIdentifiers.Sha384WithRsaEncryption); algorithms.Add("SHA512WITHRSAENCRYPTION", PkcsObjectIdentifiers.Sha512WithRsaEncryption); algorithms.Add("SHA512WITHRSA", PkcsObjectIdentifiers.Sha512WithRsaEncryption); algorithms.Add("SHA1WITHRSAANDMGF1", PkcsObjectIdentifiers.IdRsassaPss); algorithms.Add("SHA224WITHRSAANDMGF1", PkcsObjectIdentifiers.IdRsassaPss); algorithms.Add("SHA256WITHRSAANDMGF1", PkcsObjectIdentifiers.IdRsassaPss); algorithms.Add("SHA384WITHRSAANDMGF1", PkcsObjectIdentifiers.IdRsassaPss); algorithms.Add("SHA512WITHRSAANDMGF1", PkcsObjectIdentifiers.IdRsassaPss); algorithms.Add("RIPEMD160WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD160); algorithms.Add("RIPEMD160WITHRSA", TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD160); algorithms.Add("RIPEMD128WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD128); algorithms.Add("RIPEMD128WITHRSA", TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD128); algorithms.Add("RIPEMD256WITHRSAENCRYPTION", TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD256); algorithms.Add("RIPEMD256WITHRSA", TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD256); algorithms.Add("SHA1WITHDSA", X9ObjectIdentifiers.IdDsaWithSha1); algorithms.Add("DSAWITHSHA1", X9ObjectIdentifiers.IdDsaWithSha1); algorithms.Add("SHA224WITHDSA", NistObjectIdentifiers.DsaWithSha224); algorithms.Add("SHA256WITHDSA", NistObjectIdentifiers.DsaWithSha256); algorithms.Add("SHA384WITHDSA", NistObjectIdentifiers.DsaWithSha384); algorithms.Add("SHA512WITHDSA", NistObjectIdentifiers.DsaWithSha512); algorithms.Add("SHA1WITHECDSA", X9ObjectIdentifiers.ECDsaWithSha1); algorithms.Add("ECDSAWITHSHA1", X9ObjectIdentifiers.ECDsaWithSha1); algorithms.Add("SHA224WITHECDSA", X9ObjectIdentifiers.ECDsaWithSha224); algorithms.Add("SHA256WITHECDSA", X9ObjectIdentifiers.ECDsaWithSha256); algorithms.Add("SHA384WITHECDSA", X9ObjectIdentifiers.ECDsaWithSha384); algorithms.Add("SHA512WITHECDSA", X9ObjectIdentifiers.ECDsaWithSha512); algorithms.Add("GOST3411WITHGOST3410", CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x94); algorithms.Add("GOST3411WITHGOST3410-94", CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x94); algorithms.Add("GOST3411WITHECGOST3410", CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x2001); algorithms.Add("GOST3411WITHECGOST3410-2001", CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x2001); algorithms.Add("GOST3411WITHGOST3410-2001", CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x2001); // // According to RFC 3279, the ASN.1 encoding SHALL (id-dsa-with-sha1) or MUST (ecdsa-with-SHA*) omit the parameters field. // The parameters field SHALL be NULL for RSA based signature algorithms. // noParams.Add(X9ObjectIdentifiers.ECDsaWithSha1); noParams.Add(X9ObjectIdentifiers.ECDsaWithSha224); noParams.Add(X9ObjectIdentifiers.ECDsaWithSha256); noParams.Add(X9ObjectIdentifiers.ECDsaWithSha384); noParams.Add(X9ObjectIdentifiers.ECDsaWithSha512); noParams.Add(X9ObjectIdentifiers.IdDsaWithSha1); noParams.Add(NistObjectIdentifiers.DsaWithSha224); noParams.Add(NistObjectIdentifiers.DsaWithSha256); noParams.Add(NistObjectIdentifiers.DsaWithSha384); noParams.Add(NistObjectIdentifiers.DsaWithSha512); // // RFC 4491 // noParams.Add(CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x94); noParams.Add(CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x2001); // // explicit params // AlgorithmIdentifier sha1AlgId = new AlgorithmIdentifier(OiwObjectIdentifiers.IdSha1, DerNull.Instance); exParams.Add("SHA1WITHRSAANDMGF1", CreatePssParams(sha1AlgId, 20)); AlgorithmIdentifier sha224AlgId = new AlgorithmIdentifier(NistObjectIdentifiers.IdSha224, DerNull.Instance); exParams.Add("SHA224WITHRSAANDMGF1", CreatePssParams(sha224AlgId, 28)); AlgorithmIdentifier sha256AlgId = new AlgorithmIdentifier(NistObjectIdentifiers.IdSha256, DerNull.Instance); exParams.Add("SHA256WITHRSAANDMGF1", CreatePssParams(sha256AlgId, 32)); AlgorithmIdentifier sha384AlgId = new AlgorithmIdentifier(NistObjectIdentifiers.IdSha384, DerNull.Instance); exParams.Add("SHA384WITHRSAANDMGF1", CreatePssParams(sha384AlgId, 48)); AlgorithmIdentifier sha512AlgId = new AlgorithmIdentifier(NistObjectIdentifiers.IdSha512, DerNull.Instance); exParams.Add("SHA512WITHRSAANDMGF1", CreatePssParams(sha512AlgId, 64)); }