// This is a non-recursive chain/path building algorithm. // // At this stage we only checks for PartialChain, Cyclic and UntrustedRoot errors are they // affect the path building (other errors are verification errors). // // Note that the order match the one we need to match MS and not the one defined in RFC3280, // we also include the trusted root certificate (trust anchor in RFC3280) in the list. // (this isn't an issue, just keep that in mind if you look at the source and the RFC) private X509ChainStatusFlags BuildChainFrom(X509Certificate2 certificate) { elements.Add(certificate); while (!IsChainComplete(certificate)) { certificate = FindParent(certificate); if (certificate == null) { return(X509ChainStatusFlags.PartialChain); } if (elements.Contains(certificate)) { return(X509ChainStatusFlags.Cyclic); } elements.Add(certificate); } // roots may be supplied (e.g. in the ExtraStore) so we need to confirm their // trustiness (what a cute word) in the trusted root collection if (!Roots.Contains(certificate)) { elements [elements.Count - 1].StatusFlags |= X509ChainStatusFlags.UntrustedRoot; } return(X509ChainStatusFlags.NoError); }
public void PutRoot(Identifier identifier) { var stored = getStored(identifier); if (!Roots.Contains(stored)) { connection.ExecutePortableSql("insert into :[dbo.nrdo_object] (:[type], :[name]) values (:type, :name)", cmd => setRootParams(cmd, identifier)); Roots.Add(stored); } }
public void DeleteRoot(Identifier identifier) { var stored = getStored(identifier); if (Roots.Contains(stored)) { connection.ExecutePortableSql("delete from :[dbo.nrdo_object] where :[type] = :type and :[name] = :name", cmd => setRootParams(cmd, identifier)); Subs.RemoveWhere(sub => identComparer.Equals(sub.Parent, stored)); Roots.Remove(stored); } }
bool BackUp() { if (string.IsNullOrEmpty(Adapter.CurrentRoot)) { Toast.MakeText(this, "已经是根目录了", ToastLength.Short).Show(); return(false); } var current = new DirectoryInfo(Adapter.CurrentRoot); if (Roots.Contains(current.FullName)) { Adapter.SetData(Roots); return(true); } Adapter.SetData(current.Parent.FullName); return(true); }
public void Rename(Identifier from, Identifier to) { if (!object.Equals(from.ObjectType, to.ObjectType)) { throw new ArgumentException("Cannot rename between different object types " + from.ObjectType + " and " + to.ObjectType); } var storedFrom = getStored(from); var storedTo = getStored(to); if (!Roots.Contains(storedFrom)) { throw new ArgumentException("Cannot store rename from " + from + " to " + to + " because " + from + " does not exist in state table"); } if (Roots.Contains(storedTo)) { throw new ArgumentException("Cannot store rename from " + from + " to " + to + " because " + to + " already exists in state table"); } connection.ExecutePortableSql("insert into :[dbo.nrdo_object] (:[type], :[name]) values (:type, :name)", cmd => setRootParams(cmd, to)); Roots.Add(storedTo); connection.ExecutePortableSql("update :[dbo.nrdo_object_sub] set :[parent_name] = :toname where :[parent_type] = :type and parent_name = :fromname", cmd => { cmd.SetString("toname", "varchar", to.Name); cmd.SetString("type", "varchar", from.ObjectType.Name); cmd.SetString("fromname", "varchar", from.Name); }); var newSubs = from sub in Subs where identComparer.Equals(sub.Parent, storedFrom) select new StoredSub(storedTo, sub.Child); Subs.UnionWith(newSubs.ToImmutableList()); Subs.RemoveWhere(sub => identComparer.Equals(sub.Parent, storedFrom)); connection.ExecutePortableSql("delete from :[dbo.nrdo_object] where :[type] = :type and :[name] = :name", cmd => setRootParams(cmd, from)); Roots.Remove(storedFrom); }
protected override async Task <int> BuildInternal(BuildSettings settings) { var filesToCreate = EntityHelper.EntityTypes.Where(e => Roots.Contains(e.Name) && !Enums.Contains(e.Name)); BuilderFileCountUpdate(filesToCreate.Count()); await Pause.WaitWhilePausedAsync(); foreach (var file in filesToCreate) { var filePath = string.Concat(settings.ServicePath, file.Name, "Service", settings.FileExtension); await BuildFile <eBuildSectionService>(filePath, file, settings); await Pause.WaitWhilePausedAsync(); if (Cancellation.IsCancellationRequested) { break; } } return(filesToCreate.Count()); }
public bool IsRoot(ISceneGraphNode node) { return(Roots.Contains(node)); }
public bool ContainsRoot(Identifier root) { return(Roots.Contains(getStored(root))); }