public RevocationValues(IEnumerable crlVals, IEnumerable ocspVals, OtherRevVals otherRevVals) { if (crlVals != null) { if (!CollectionUtilities.CheckElementsAreOfType(crlVals, typeof(CertificateList))) { throw new ArgumentException("Must contain only 'CertificateList' objects", "crlVals"); } this.crlVals = new DerSequence(Asn1EncodableVector.FromEnumerable(crlVals)); } if (ocspVals != null) { if (!CollectionUtilities.CheckElementsAreOfType(ocspVals, typeof(BasicOcspResponse))) { throw new ArgumentException("Must contain only 'BasicOcspResponse' objects", "ocspVals"); } this.ocspVals = new DerSequence(Asn1EncodableVector.FromEnumerable(ocspVals)); } this.otherRevVals = otherRevVals; }
/// <summary>Allows enumeration of all signatures/certifications associated with this key.</summary> /// <returns>An <c>IEnumerable</c> with all signatures/certifications.</returns> public IEnumerable <IPgpSignature> GetSignatures() { IList <IPgpSignature> sigs; if (_subSigs != null) { sigs = _subSigs; } else { sigs = Platform.CreateArrayList(_keySigs); foreach (var extraSigs in _idSigs) { CollectionUtilities.AddRange(sigs, extraSigs); } } return(sigs); }
public async Task MimicReconciliationWithFullDatabaseEnumerationByKeys() { // This is an original and slower version of reconciliation. string databasePath = @"C:\Users\seteplia\AppData\Local\Temp\CloudStore\DatabaseTest\"; var db = new RocksDbContentLocationDatabase(TestClock, new RocksDbContentLocationDatabaseConfiguration(new AbsolutePath(databasePath)) { CleanOnInitialize = false }, () => CollectionUtilities.EmptyArray <MachineId>()); var context = new OperationContext(new Context(Logger)); await db.StartupAsync(context).ThrowIfFailure(); var sw = Stopwatch.StartNew(); var reconcile = MimicOldReconcile(context, machineId: 42, db); sw.Stop(); Output.WriteLine($"Reconcile by {sw.ElapsedMilliseconds}ms. Added: {reconcile.addedContent.Count}, removed: {reconcile.removedContent.Count}"); }
/// <nodoc/> public CompositeSharedOpaqueSealDirectory( AbsolutePath directoryRoot, IReadOnlyList <DirectoryArtifact> composedDirectories, PipProvenance provenance, ReadOnlyArray <StringId> tags, SealDirectoryContentFilter?contentFilter) : base( directoryRoot, CollectionUtilities.EmptySortedReadOnlyArray <FileArtifact, OrdinalFileArtifactComparer>(OrdinalFileArtifactComparer.Instance), CollectionUtilities.EmptySortedReadOnlyArray <DirectoryArtifact, OrdinalDirectoryArtifactComparer>(OrdinalDirectoryArtifactComparer.Instance), SealDirectoryKind.SharedOpaque, provenance, tags, CollectionUtilities.EmptyArray <StringId>().ToReadOnlyArray()) { Contract.Requires(composedDirectories != null); ComposedDirectories = composedDirectories; m_contentFilter = contentFilter; }
private void submitButton_Click(object sender, EventArgs e) { this.updateErrorMessage(null); List<Common.Libraries.Utility.Shared.Receipt> loadedReceipts; string errorMsg; if (!LoadReceiptData(this.receiptTextBox.Text, out loadedReceipts, out errorMsg)) { this.updateErrorMessage(errorMsg); } else if (CollectionUtilities.isNotEmpty(loadedReceipts)) { GlobalDataAccessor.Instance.DesktopSession.PawnReceipt = loadedReceipts; this.NavControlBox.Action = NavBox.NavAction.SUBMIT; } else if (CollectionUtilities.isEmpty(loadedReceipts)) { this.updateErrorMessage("Unable to find receipt."); } }
public OtherSigningCertificate(IEnumerable certs, IEnumerable policies) { if (certs == null) { throw new ArgumentNullException("certs"); } if (!CollectionUtilities.CheckElementsAreOfType(certs, typeof(OtherCertID))) { throw new ArgumentException("Must contain only 'OtherCertID' objects", "certs"); } this.certs = new DerSequence(Asn1EncodableVector.FromEnumerable(certs)); if (policies != null) { if (!CollectionUtilities.CheckElementsAreOfType(policies, typeof(PolicyInformation))) { throw new ArgumentException("Must contain only 'PolicyInformation' objects", "policies"); } this.policies = new DerSequence(Asn1EncodableVector.FromEnumerable(policies)); } }
private EvaluationResult SealDirectory(PipConstructionHelper pipConstructionHelper, DownloadData downloadData, DirectoryArtifact directory, SortedReadOnlyArray <FileArtifact, OrdinalFileArtifactComparer> files) { if (!pipConstructionHelper.TrySealDirectory( directory, files, CollectionUtilities.EmptySortedReadOnlyArray <DirectoryArtifact, OrdinalDirectoryArtifactComparer>(OrdinalDirectoryArtifactComparer.Instance), Pips.Operations.SealDirectoryKind.Partial, null, null, null, out var directoryArtifact) ) { return(EvaluationResult.Error); } var staticDirectory = new StaticDirectory(directoryArtifact, Pips.Operations.SealDirectoryKind.Partial, files.WithCompatibleComparer(OrdinalPathOnlyFileArtifactComparer.Instance)); return(new EvaluationResult(staticDirectory)); }
/// <summary> /// Reads in parallel all writes recorded in given sideband files (<paramref name="sidebandFiles"/>). /// The task of reading paths from a single sideband file is delegated to <see cref="SidebandReader.ReadSidebandFile"/>. /// Exceptions of type <see cref="IOException"/> and <see cref="BuildXLException"/> are caught, logged, and ignored. /// </summary> internal string[] TryReadAllRecordedWrites(IReadOnlyList <string> sidebandFiles) { return(sidebandFiles .AsParallel(Context) .SelectMany(tryReadSidebandFile) .ToArray()); IEnumerable <string> tryReadSidebandFile(string filename) { try { return(SidebandReader.ReadSidebandFile(filename, ignoreChecksum: true)); } catch (Exception e) when(e is BuildXLException || e is IOException || e is OperationCanceledException) { Processes.Tracing.Logger.Log.CannotReadSidebandFileWarning(LoggingContext, filename, e.Message); return(CollectionUtilities.EmptyArray <string>()); } } }
public void Sort() { var ducks = Duck.Ducks.Take(3).ToList(); var sorted = CollectionUtilities.Sort(ducks, new DuckAgeComparer()); var expected = new List <Duck> { new Duck { Id = 3 }, new Duck { Id = 2 }, new Duck { Id = 1 }, }; Assert.Equal(expected, sorted); }
/// <summary> /// /// </summary> /// <returns></returns> private bool populateMachineData() { if (this.pwnSecData == null) { return(false); } if (CollectionUtilities.isNotEmpty(this.pwnSecData.ClientMachines)) { if (this.pwnSecData.MapsValid) { } else { foreach (var cMac in this.pwnSecData.ClientMachines) { } } } return(false); }
/// <summary> /// Helper method to create a project with predictions rooted at the test root /// </summary> /// <returns></returns> public ProjectWithPredictions CreateProjectWithPredictions( string projectName = null, IReadOnlyCollection <AbsolutePath> inputs = null, IReadOnlyCollection <AbsolutePath> outputs = null, IEnumerable <ProjectWithPredictions> references = null, GlobalProperties globalProperties = null, PredictedTargetsToExecute predictedTargetsToExecute = null) { var projectNameRelative = RelativePath.Create(StringTable, projectName ?? "testProj.proj"); var projectWithPredictions = new ProjectWithPredictions( TestPath.Combine(PathTable, projectNameRelative), globalProperties ?? GlobalProperties.Empty, inputs ?? CollectionUtilities.EmptyArray <AbsolutePath>(), outputs ?? CollectionUtilities.EmptyArray <AbsolutePath>(), projectReferences: references?.ToArray() ?? CollectionUtilities.EmptyArray <ProjectWithPredictions>(), predictedTargetsToExecute: predictedTargetsToExecute ?? PredictedTargetsToExecute.CreatePredictedTargetsToExecute(new[] { "Build" })); return(projectWithPredictions); }
/// <summary>Allows enumeration of all signatures/certifications associated with this key.</summary> /// <returns>An <c>IEnumerable</c> with all signatures/certifications.</returns> public IEnumerable GetSignatures() { IList sigs; if (subSigs != null) { sigs = subSigs; } else { sigs = Platform.CreateArrayList(keySigs); foreach (ICollection extraSigs in idSigs) { CollectionUtilities.AddRange(sigs, extraSigs); } } return(new EnumerableProxy(sigs)); }
/// <summary> /// Returns a new tree based on a non-empty collection of ad group criteria. /// </summary> /// <param name="adGroupId">The ad group ID.</param> /// <param name="parentIdMap">The multimap from parent product partition ID /// to child criteria.</param> /// <returns>a new product partition tree.</returns> private static ProductPartitionTree CreateAdGroupTree(long adGroupId, Dictionary <long, List <AdGroupCriterion> > parentIdMap) { ProductPartitionNode rootNode = null; if (parentIdMap.Count == 0) { rootNode = new ProductPartitionNode(null, null, NEW_ROOT_ID); } else { List <AdGroupCriterion> root = CollectionUtilities.TryGetValue(parentIdMap, ROOT_PARENT_ID); PreconditionUtilities.CheckState(root != null, string.Format(ShoppingMessages.RootCriteriaNotFoundInCriteriaList, adGroupId)); PreconditionUtilities.CheckState(root.Count == 1, string.Format(ShoppingMessages.MoreThanOneRootFound, adGroupId)); AdGroupCriterion rootCriterion = root[0]; PreconditionUtilities.CheckState(rootCriterion is BiddableAdGroupCriterion, string.Format(ShoppingMessages.RootCriterionIsNotBiddable, adGroupId)); BiddableAdGroupCriterion biddableRootCriterion = (BiddableAdGroupCriterion)rootCriterion; rootNode = new ProductPartitionNode(null, null, rootCriterion.criterion.id, new ProductDimensionEqualityComparer()); // Set the root's bid if a bid exists on the BiddableAdGroupCriterion. Money rootNodeBid = GetBid(biddableRootCriterion); if (rootNodeBid != null) { rootNode.AsBiddableUnit().CpcBid = rootNodeBid.microAmount; } AddChildNodes(rootNode, parentIdMap); } return(new ProductPartitionTree(adGroupId, rootNode)); }
/// <nodoc /> public static IEnumerable <TResult> Where <TSource, TResult>(this NodeArray.NodeArraySelectorEnumerable <TSource, TResult> selectEnumerable, Func <TResult, bool> predicate) { // If the array is empty it make no sense to allocate anything. if (selectEnumerable.ArraySize == 0) { return(CollectionUtilities.EmptyArray <TResult>()); } return(Where()); IEnumerable <TResult> Where() { foreach (var e in selectEnumerable) { if (predicate(e)) { yield return(e); } } } }
public SignaturePolicyId(DerObjectIdentifier sigPolicyIdentifier, OtherHashAlgAndValue sigPolicyHash, IEnumerable sigPolicyQualifiers) { if (sigPolicyIdentifier == null) { throw new ArgumentNullException("sigPolicyIdentifier"); } if (sigPolicyHash == null) { throw new ArgumentNullException("sigPolicyHash"); } this.sigPolicyIdentifier = sigPolicyIdentifier; this.sigPolicyHash = sigPolicyHash; if (sigPolicyQualifiers != null) { if (!CollectionUtilities.CheckElementsAreOfType(sigPolicyQualifiers, typeof(SigPolicyQualifierInfo))) { throw new ArgumentException("Must contain only 'SigPolicyQualifierInfo' objects", "sigPolicyQualifiers"); } this.sigPolicyQualifiers = new DerSequence(Asn1EncodableVector.FromEnumerable(sigPolicyQualifiers)); } }
/// <summary> /// compute cdt edges crossed by paths /// </summary> internal void FillCrossedCdtEdges(Dictionary <EdgeGeometry, Set <CdtEdge> > crossedCdtEdges) { foreach (var geometryEdge in EdgeGeometries) { SetPortVerticesAndObstacles(geometryEdge.SourcePort, true, out sourceLoosePoly); SetPortVerticesAndObstacles(geometryEdge.TargetPort, false, out targetLoosePoly); //crossedCdtEdges.Add(geometryEdge, new Set<CdtEdge>()); foreach (var boneEdge in EdgesToRoutes[geometryEdge]) { foreach (var cdtEdge in CrossedCdtEdgesOfBoneEdge(boneEdge)) { if (AdjacentToSourceOrTarget(cdtEdge)) { continue; } CollectionUtilities.AddToMap(crossedCdtEdges, geometryEdge, cdtEdge); } } } }
public bool AddQueryParameter(int id, string paramName, string paramTypeName, string paramInitialValue) { if (CollectionUtilities.isEmpty(this.queries) || !this.queries.ContainsKey(id) || string.IsNullOrEmpty(paramName) || string.IsNullOrEmpty(paramTypeName)) { return(false); } bool rt = true; QueryStorageItem qsi = getStorageItem(id); if (qsi == null || !qsi.AddParameter(paramName, paramTypeName, paramInitialValue)) { //Could not add parameter to query //TODO: Log error and report exception rt = false; } return(rt); }
/// <summary> /// Initialize graph comprised of stations and their neighbors /// </summary> void InitializeVirtualGraph() { Dictionary <Station, Set <Station> > neighbors = new Dictionary <Station, Set <Station> >(); foreach (var metroline in metrolines) { Station u = PointToStations[metroline.Polyline.Start]; Station v; for (var p = metroline.Polyline.StartPoint; p.Next != null; p = p.Next, u = v) { v = PointToStations[p.Next.Point]; CollectionUtilities.AddToMap(neighbors, u, v); CollectionUtilities.AddToMap(neighbors, v, u); } } foreach (var s in Stations) { s.Neighbors = neighbors[s].ToArray(); } }
private IReadOnlyList <FullSymbol> ComputeValuesToResolve() { Contract.Ensures(Contract.Result <IReadOnlyList <FullSymbol> >() != null); // If dependents are selected, we must resolve all values to create the full graph if (!m_allowValueShortCircuiting) { return(CollectionUtilities.EmptyArray <FullSymbol>()); } // Check if a subset of values can be resolved IEnumerable <FullSymbol> valuesToResolve = PipFilter.GetValuesToResolve(); if (valuesToResolve != null) { return(new List <FullSymbol>(valuesToResolve)); } // All values must be resolved return(CollectionUtilities.EmptyArray <FullSymbol>()); }
public void AddGranularStoredProcData(string userId, string procName, long callPrep, long callWait, long callProcess, long callTotal, long dataTransferAmt) { List <QuadType <long, long, long, long> > innerList; if (CollectionUtilities.isNotEmptyContainsKey(this.granularStoredProcCounts, userId)) { innerList = this.granularStoredProcCounts[userId]; } else { innerList = new List <QuadType <long, long, long, long> >(); this.granularStoredProcCounts.Add(userId, innerList); } var procStats = new QuadType <long, long, long, long>(callPrep, callWait, callProcess, callTotal); innerList.Add(procStats); //Get the capture object CPNHSDataVO cvo = null; AddCaptureObject(CPNHSDataVO.PackDataType.GRANSTOREDPROC, userId, out cvo); //Fill in capture data cvo.PackType |= CPNHSDataVO.PackDataType.GRANSTOREDPROC; cvo.PackType |= CPNHSDataVO.PackDataType.DATAXFERIN; cvo.ClientProcName = procName; cvo.ClientCallPrepTime = callPrep; cvo.ClientCallProcessTime = callProcess; cvo.ClientCallTotalTime = callTotal; cvo.ClientCallWaitTime = callWait; cvo.NumberTransactionsIn += 1; cvo.TotalTimeTxferDataIn += callTotal; cvo.CurrentLatency += callWait; //Must be in bytes per second cvo.CurrentDataRateIn += (decimal)dataTransferAmt / (callTotal * 1000); //Force this call through as we need every granular proc data point UpdateInternalData(userId, true); }
public override bool Equals(Seed other) { if ((object)other == null) { return(false); } if (object.ReferenceEquals(this, other)) { return(true); } if (this.Name != other.Name || this.Length != other.Length || this.CreationTime != other.CreationTime || this.Comment != other.Comment || this.Rank != other.Rank || this.Key != other.Key || !CollectionUtilities.Equals(this.Keywords, other.Keywords) || this.CompressionAlgorithm != other.CompressionAlgorithm || this.CryptoAlgorithm != other.CryptoAlgorithm || (this.CryptoKey == null) != (other.CryptoKey == null) || this.Certificate != other.Certificate) { return(false); } if (this.CryptoKey != null && other.CryptoKey != null) { if (!Unsafe.Equals(this.CryptoKey, other.CryptoKey)) { return(false); } } return(true); }
/// <summary> /// Begin site method - call prior to getParameters /// </summary> /// <param name="caller">Calling class object</param> /// <param name="siteId">SiteId specifier object</param> /// <param name="ruleIds">List of Business rule strings</param> /// <param name="rules">List of BusinessRuleVO objects - Output param</param> /// <returns>PawnRulesSystemReturnCode</returns> public PawnRulesSystemReturnCode beginSite(object caller, SiteId siteId, List <string> ruleIds, out Dictionary <string, BusinessRuleVO> rules) { rules = new Dictionary <string, BusinessRuleVO>(); //Validate input if (caller == null || CollectionUtilities.isEmpty(ruleIds)) { return (new PawnRulesSystemReturnCode( PawnRulesSystemReturnCode.Code.ERROR, "Input values to beginSite are invalid.")); } //Check if this object is already using the pawn rules system if (this.beginBlockRegistry.ContainsKey(caller)) { PairType <SiteId, bool> curSiteBegin = this.beginBlockRegistry[caller]; if (curSiteBegin.Right) { return (new PawnRulesSystemReturnCode( PawnRulesSystemReturnCode.Code.WARNING, "Already in an active begin block for this site and this caller parent object.")); } curSiteBegin.Right = true; curSiteBegin.Left = siteId; } else { this.beginBlockRegistry.Add(caller, new PairType <SiteId, bool>(siteId, true)); } //Set site id this.currentSite = siteId; //Change last parameter to true if you want to save the rules file to the disk after it is loaded //into the rules engine data structure //rules = RulesHelper.BuildBusinessRules(siteId, true); rules = RulesHelper.BuildBusinessRules(siteId); return(new PawnRulesSystemReturnCode(PawnRulesSystemReturnCode.Code.SUCCESS)); }
/// <summary> /// /// </summary> /// <param name="nm"></param> /// <param name="iFxns"></param> /// <param name="elseFxn"></param> public IfThenElseBlock( string nm, List <PairType <FxnBlock, FxnBlock> > iFxns, FxnBlock elseFxn) { if (string.IsNullOrEmpty(nm) || CollectionUtilities.isEmpty(iFxns)) { throw new ApplicationException("Cannot create IfThenElse block"); } //Set the necessary fields this.ifMap = new Dictionary <string, bool>(); this.setName(nm); this.ifElseBlockPairs = new List <PairType <ConditionBlock, ActionBlock> >(); this.elseBlock = new ActionBlock(nm + "-ElseAction", elseFxn); int cnt = 0; //Create the if blocks foreach (PairType <FxnBlock, FxnBlock> fxn in iFxns) { FxnBlock condFxn = fxn.Left; FxnBlock actFxn = fxn.Right; //Create condition block ConditionBlock cndBlk = new ConditionBlock(nm + "-Condition-" + cnt, fxn.Left); //Create action block ActionBlock actBlk = new ActionBlock(nm + "-Action-" + cnt, fxn.Right); //Create bound pair of condition to action PairType <ConditionBlock, ActionBlock> ifElsBlk = new PairType <ConditionBlock, ActionBlock>(cndBlk, actBlk); //Add this to the if else block pair list this.ifElseBlockPairs.Add(ifElsBlk); //Increase count cnt++; } }
private static EvaluationResult GetPathValues(Context context, EvaluationStackFrame args, Type type) { var name = Args.AsString(args, 0); var separator = Args.AsString(args, 1); string strValue = GetRawValue(context, name); var entry = context.TopStack; if (string.IsNullOrWhiteSpace(strValue)) { return(EvaluationResult.Create(ArrayLiteral.CreateWithoutCopy(CollectionUtilities.EmptyArray <EvaluationResult>(), entry.InvocationLocation, entry.Path))); } var values = separator.Length == 0 ? new[] { strValue } : strValue.Split(new[] { separator }, StringSplitOptions.RemoveEmptyEntries); var pathsOrFiles = new List <EvaluationResult>(); for (int i = 0; i < values.Length; ++i) { if (!string.IsNullOrWhiteSpace(values[i])) { AbsolutePath path = ParsePath(context, name, values[i], 1); EvaluationResult result = type == typeof(AbsolutePath) ? EvaluationResult.Create(path) : type == typeof(FileArtifact) ? EvaluationResult.Create(FileArtifact.CreateSourceFile(path)) : type == typeof(DirectoryArtifact) ? EvaluationResult.Create(DirectoryArtifact.CreateWithZeroPartialSealId(path)) : EvaluationResult.Undefined; if (result.IsUndefined) { throw Contract.AssertFailure(I($"Cannot convert paths to typeof({type.Name})")); } pathsOrFiles.Add(result); } } return(EvaluationResult.Create(ArrayLiteral.CreateWithoutCopy(pathsOrFiles.ToArray(), entry.InvocationLocation, entry.Path))); }
public string GetPopulatedQuery() { string rt = string.Empty; if (string.IsNullOrEmpty(this.queryTemplate) || CollectionUtilities.isEmpty(this.queryParameters)) { return(rt); } //Set the template rt = this.queryTemplate; //Inject the parameters foreach (var p in this.queryParameters) { var repToken = @"?" + p.Key + @"?"; var pType = p.Value.Left; string newVal; if (pType.Equals(@"string", StringComparison.OrdinalIgnoreCase)) { if (string.IsNullOrEmpty(p.Value.Right) || string.IsNullOrWhiteSpace(p.Value.Right)) { newVal = "null"; } else { newVal = string.Format("'{0}'", p.Value.Right); } } else { newVal = p.Value.Right; } rt = rt.Replace(repToken, newVal); } //Return the populated query return(rt); }
/// <summary> /// Starts the addition of projects /// </summary> /// <returns></returns> public NinjaSchedulingProjectBuilder Start(NinjaResolverSettings resolverSettings = null, QualifierId qualifierId = default) { var settings = resolverSettings ?? new NinjaResolverSettings(); // We want to have both ProjectRoot and SpecFile defined if (settings.ProjectRoot == AbsolutePath.Invalid) { settings.ProjectRoot = AbsolutePath.Create(PathTable, TestRoot); } if (settings.SpecFile == AbsolutePath.Invalid) { settings.SpecFile = settings.ProjectRoot.Combine(PathTable, "build.ninja"); } if (qualifierId == default) { qualifierId = FrontEndContext.QualifierTable.CreateQualifier(CollectionUtilities.EmptyDictionary <string, string>()); } return(new NinjaSchedulingProjectBuilder(this, settings, qualifierId)); }
/// <summary> /// Helper method to create a rush project /// </summary> public RushProject CreateRushProject( string projectName = null, string buildCommand = null, AbsolutePath?tempFolder = null, IReadOnlyCollection <AbsolutePath> additionalOutputDirectories = null, IReadOnlyCollection <RushProject> dependencies = null) { projectName ??= "@ms/rush-proj"; var tempDirectory = tempFolder.HasValue ? tempFolder.Value : AbsolutePath.Create(PathTable, GetTempDir()); var rushProject = new RushProject( projectName, TestPath.Combine(PathTable, RelativePath.Create(StringTable, projectName)), buildCommand ?? "node ./main.js", tempDirectory, additionalOutputDirectories ?? CollectionUtilities.EmptyArray <AbsolutePath>() ); rushProject.SetDependencies(dependencies ?? CollectionUtilities.EmptyArray <RushProject>()); return(rushProject); }
/// <summary> /// Creates a strong fingerprint computation for process execution /// </summary> public static ProcessStrongFingerprintComputationData CreateForExecution( ContentHash pathSetHash, ObservedPathSet pathSet, ReadOnlyArray <ObservedInput> observedInputs, StrongContentFingerprint strongFingerprint) { var data = default(ProcessStrongFingerprintComputationData); data.PathSetHash = pathSetHash; data.PathSet = pathSet; data.PriorStrongFingerprints = CollectionUtilities.EmptyArray <StrongContentFingerprint>(); // Initial defaults data.Succeeded = true; data.IsStrongFingerprintHit = false; data.ObservedInputs = observedInputs; data.ComputedStrongFingerprint = strongFingerprint; data.IsNewlyPublishedAugmentedWeakFingerprint = false; data.AugmentedWeakFingerprint = default; return(data); }
public RevocationValues(global::System.Collections.IEnumerable crlVals, global::System.Collections.IEnumerable ocspVals, OtherRevVals otherRevVals) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (crlVals != null) { if (!CollectionUtilities.CheckElementsAreOfType(crlVals, typeof(CertificateList))) { throw new ArgumentException("Must contain only 'CertificateList' objects", "crlVals"); } this.crlVals = new DerSequence(Asn1EncodableVector.FromEnumerable(crlVals)); } if (ocspVals != null) { if (!CollectionUtilities.CheckElementsAreOfType(ocspVals, typeof(BasicOcspResponse))) { throw new ArgumentException("Must contain only 'BasicOcspResponse' objects", "ocspVals"); } this.ocspVals = new DerSequence(Asn1EncodableVector.FromEnumerable(ocspVals)); } this.otherRevVals = otherRevVals; }
public void Test_RangeStream() { using (MemoryStream memoryStream = new MemoryStream(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 })) { byte[] mbyte = new byte[4]; memoryStream.Seek(7, SeekOrigin.Begin); memoryStream.Read(mbyte, 0, mbyte.Length); memoryStream.Seek(5, SeekOrigin.Begin); using (RangeStream rangeStream = new RangeStream(memoryStream, 7, 4)) { Assert.AreEqual(memoryStream.Position, 7, "RangeStream #1"); Assert.AreEqual(rangeStream.Position, 0, "RangeStream #2"); byte[] rbyte = new byte[4]; rangeStream.Read(rbyte, 0, rbyte.Length); Assert.AreEqual(rangeStream.Length, 4, "RangeStream #3"); Assert.IsTrue(CollectionUtilities.Equals(mbyte, rbyte), "RangeStream #4"); } } }