internal ForCSharpStatement(ReadOnlyCollection<ParameterExpression> variables, ReadOnlyCollection<Expression> initializers, Expression test, ReadOnlyCollection<Expression> iterators, Expression body, LabelTarget breakLabel, LabelTarget continueLabel) : base(test, body, breakLabel, continueLabel) { Variables = variables; Initializers = initializers; Iterators = iterators; }
internal DkmClrType(DkmClrModuleInstance module, DkmClrAppDomain appDomain, Type lmrType) { _module = module; _appDomain = appDomain; _lmrType = lmrType; _evalAttributes = GetEvalAttributes(lmrType); }
public Line(int lineNumber, int oldLineNumber, ReadOnlyCollection<LinePart> parts) { m_lineNumber = lineNumber; m_oldLineNumber = oldLineNumber; m_isNew = parts.All(p => p.Status == LinePartStatus.New); m_parts = parts; }
public static ReadOnlyCollection<string> FindPluginAsGenericList(string pluginName) { List<string> namespaces = new List<string>(); try { HxRegistryWalkerClass registryWalker = new HxRegistryWalkerClass(); IHxRegNamespaceList help2Namespaces = registryWalker.get_RegisteredNamespaceList(""); foreach (IHxRegNamespace currentNamespace in help2Namespaces) { IHxRegPlugInList p = (IHxRegPlugInList)currentNamespace.GetProperty(HxRegNamespacePropId.HxRegNamespacePlugInList); foreach (IHxRegPlugIn plugin in p) { string currentName = (string)plugin.GetProperty(HxRegPlugInPropId.HxRegPlugInName); if (string.Compare(currentName, pluginName) == 0) { namespaces.Add(currentNamespace.Name); break; } } } } catch (System.Runtime.InteropServices.COMException) { } ReadOnlyCollection<string> roNamespaces = new ReadOnlyCollection<string>(namespaces); return roNamespaces; }
protected virtual ReadOnlyCollection<ParameterExpression> VisitParameterExpressionList(ReadOnlyCollection<ParameterExpression> original) { List<ParameterExpression> list = null; for (int i = 0, n = original.Count; i < n; i++) { ParameterExpression p = (ParameterExpression) this.Visit(original[i]); if (list != null) { list.Add(p); } else if (p != original[i]) { list = new List<ParameterExpression>(n); for (int j = 0; j < i; j++) { list.Add(original[j]); } list.Add(p); } } if (list != null) { return list.AsReadOnly(); } return original; }
/// <summary> /// Initializes a new instance of the EnumDefinition class /// Populates this object with information extracted from the XML /// </summary> /// <param name="theNode">XML node describing the Enum object</param> /// <param name="manager">The data dictionary manager constructing this type.</param> public EnumDefinition(XElement theNode, DictionaryManager manager) : base(theNode, TypeId.EnumType) { // ByteSize may be set either directly as an integer or by inference from the Type field. // If no Type field is present then the type is assumed to be 'int' if (theNode.Element("ByteSize") != null) { SetByteSize(theNode.Element("ByteSize").Value); } else { string baseTypeName = theNode.Element("Type") != null ? theNode.Element("Type").Value : "int"; BaseType = manager.GetElementType(baseTypeName); BaseType = DictionaryManager.DereferenceTypeDef(BaseType); FixedSizeBytes = BaseType.FixedSizeBytes.Value; } // Common properties are parsed by the base class. // Remaining properties are the Name/Value Literal elements List<LiteralDefinition> theLiterals = new List<LiteralDefinition>(); foreach (var literalNode in theNode.Elements("Literal")) { theLiterals.Add(new LiteralDefinition(literalNode)); } m_Literals = new ReadOnlyCollection<LiteralDefinition>(theLiterals); // Check the name. If it's null then make one up if (theNode.Element("Name") == null) { Name = String.Format("Enum_{0}", Ref); } }
public override bool isInteractionActive(ReadOnlyCollection<InteractionHandPointer> hands) { // if primary hand is active and secondary hand is active, secondary hand is above certain height -> return true foreach (var hand in hands) { if (hand.HandType != InteractionHandType.None) { if (hand.IsPrimaryForUser) { primaryHand = hand; } else { secondaryHand = hand; } } } if (primaryHand == null || secondaryHand == null || !primaryHand.IsActive) return false; if (secondaryHand.Y < 1.2) return true; else return false; }
private PatternMatchRuleProcessor(ReadOnlyCollection<PatternMatchRule> rules) { Debug.Assert(rules.Count() != 0, "At least one PatternMatchRule is required"); Debug.Assert(rules.Where(r => r == null).Count() == 0, "Individual PatternMatchRules must not be null"); ruleSet = rules; }
internal TryExpression(Type type, Expression body, Expression @finally, Expression fault, ReadOnlyCollection<CatchBlock> handlers) { _type = type; _body = body; _handlers = handlers; _finally = @finally; _fault = fault; }
//допилить!!!!!!!!!!!!! /// <summary> /// Проверяет содержат ли элементы коллекции текст, который задается во втором параметре через запятую по порядку /// </summary> /// <param name="elements"></param> /// <param name="results"></param> /// <returns></returns> protected bool CollectionContainsResults(ReadOnlyCollection<IWebElement> elements, string results) { bool containt = true; if (elements.Count > 1) { char[] separators = new char[elements.Count]; for (int i = 0; i < elements.Count; i++) { separators[i] = ','; } string[] res = results.Split(separators); for (int i = 0; i < elements.Count; i++) { if (!elements[i].Text.Contains(res[i])) { containt = false; } } } else if (elements.Count == 1) { if (elements[0].Text.Contains(results)) { containt = true; } } else { Assert.Fail("There is no elements"); } return containt; }
public Style(string name, StyleCategory category, StyleClassification classification, IList<StyleThreshold> thresholds) { m_name = name; m_category = category; m_classification = classification; m_thresholds = new ReadOnlyCollection<StyleThreshold>(thresholds); }
public Cannon(Direction2D direction, Vector2i index) { _direction = direction; _worldIndex = index; _readOnlyBullets = new ReadOnlyCollection<Bullet>(_bullets); }
private IEnumerable<Record> ReadRecords(string fileName) { var stringBuilder = new StringBuilder(); using (var reader = new StreamReader(fileName)) { ReadOnlyCollection<string> header; if (reader.Peek() >= 0) { var first = this.ParseLine(reader.ReadLine(), stringBuilder).ToArray(); header = new ReadOnlyCollection<string>(first); } else { yield break; } for (var i = 0; i < this._numberRecordsToSkip && reader.Peek() >= 0; i++) { reader.ReadLine(); } while (reader.Peek() >= 0) { var items = this.ParseLine(reader.ReadLine(), stringBuilder).ToArray(); yield return new Record(header, items); } } }
internal ExternalRequirements(Binding context, IEnumerable<Expression> links) : base(context, null, null) { Guard.NotNull(links, "links"); Links = new ReadOnlyCollection<Expression>(new List<Expression>(links)); }
private LifeGrid(LifeGrid source, byte[] newState) { m_width = source.m_width; m_bytesPerRow = source.m_bytesPerRow; m_height = source.m_height; m_state = Array.AsReadOnly(newState); }
public UnconditionalPolicy(ReadOnlyCollection<ClaimSet> issuances, DateTime expirationTime) { if (issuances == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("issuances"); Initialize(ClaimSet.System, null, issuances, expirationTime); }
void ReadClassicIndexFile(BinaryReader br) { int numGlobalObjects, numRooms, numCostumes, numScripts, numSounds; if (Game.GameId == GameId.Maniac) { numGlobalObjects = 800; numRooms = 55; numCostumes = 35; numScripts = 200; numSounds = 100; } else if (Game.GameId == GameId.Zak) { numGlobalObjects = 775; numRooms = 61; numCostumes = 37; numScripts = 155; numSounds = 120; } else { throw new InvalidOperationException(); } ReadDirectoryOfObjects(br, numGlobalObjects); RoomResources = new ReadOnlyCollection<Resource>(ReadRoomResTypeList(br, numRooms)); CostumeResources = new ReadOnlyCollection<Resource>(ReadResTypeList(br, numCostumes)); ScriptResources = new ReadOnlyCollection<Resource>(ReadResTypeList(br, numScripts)); SoundResources = new ReadOnlyCollection<Resource>(ReadResTypeList(br, numSounds)); }
public UpshotControllerDescription(HttpControllerDescriptor controllerDescriptor) { HashSet<Type> entityTypes = new HashSet<Type>(); _upshotControllerType = controllerDescriptor.ControllerType; IEnumerable<MethodInfo> enumerable = from p in _upshotControllerType.GetMethods(BindingFlags.Instance | BindingFlags.Public) where p.DeclaringType != typeof(UpshotController) && p.DeclaringType != typeof(object) && !p.IsSpecialName select p; foreach (MethodInfo current in enumerable) { if (current.GetCustomAttributes(typeof(NonActionAttribute), false).Length <= 0 && (!current.IsVirtual || !(current.GetBaseDefinition().DeclaringType == typeof(UpshotController)))) { if (current.ReturnType != typeof(void)) { Type type = TypeUtility.UnwrapTaskInnerType(current.ReturnType); Type elementType = TypeUtility.GetElementType(type); if (LookUpIsEntityType(elementType)) { if (!entityTypes.Contains(elementType)) { entityTypes.Add(elementType); } } } } } _entityTypes = new ReadOnlyCollection<Type>(entityTypes.ToList()); }
public NavigationTreeService([NotNull] IServiceProvider serviceProvider) { if (serviceProvider == null) throw new ArgumentNullException("serviceProvider"); _serviceProvider = serviceProvider; _nodesReadOnly = _nodes.AsReadOnly(); foreach (var provider in new ExtensionsCache<NavigationTreeProviderInfo, INavigationTreeProvider>(_serviceProvider) .GetAllExtensions()) { var dynamicProvider = provider as IDynamicNavigationTreeProvider; if (dynamicProvider != null) { _dynamicNodes.Add(dynamicProvider, dynamicProvider.CreateNodes(_serviceProvider).ToArray()); dynamicProvider.SubscribeNodesChanged( _serviceProvider, Observer.Create<EventArgs>( arg => { _dynamicNodes[dynamicProvider] = dynamicProvider.CreateNodes(_serviceProvider).ToArray(); UpdateTree(); _treeChanged.OnNext(EventArgs.Empty); })); } else _staticNodes.AddRange(provider.CreateNodes(_serviceProvider)); } UpdateTree(); }
/// <summary> /// Initializes a new instance of the <see cref="AggregateExportProvider"/> class. /// </summary> /// <param name="providers">The prioritized list of export providers.</param> /// <exception cref="ArgumentException"> /// <paramref name="providers"/> contains an element that is <see langword="null"/>. /// </exception> /// <remarks> /// <para> /// The <see cref="AggregateExportProvider"/> will consult the providers in the order they have been specfied when /// executing <see cref="ExportProvider.GetExports(ImportDefinition,AtomicComposition)"/>. /// </para> /// <para> /// The <see cref="AggregateExportProvider"/> does not take ownership of the specified providers. /// That is, it will not try to dispose of any of them when it gets disposed. /// </para> /// </remarks> public AggregateExportProvider(params ExportProvider[] providers) { // NOTE : we optimize for the array case here, because the collection of providers is typically tiny // Arrays are much more compact to store and much faster to create and enumerate ExportProvider[] copiedProviders = null; if (providers != null) { copiedProviders = new ExportProvider[providers.Length]; for (int i = 0; i < providers.Length; i++) { ExportProvider provider = providers[i]; if (provider == null) { throw ExceptionBuilder.CreateContainsNullElement("providers"); } copiedProviders[i] = provider; provider.ExportsChanged += this.OnExportChangedInternal; provider.ExportsChanging += this.OnExportChangingInternal; } } else { copiedProviders = new ExportProvider[] { }; } this._providers = copiedProviders; this._readOnlyProviders = new ReadOnlyCollection<ExportProvider>(this._providers); }
/// <summary> /// The helper to create the AST method call node. Will add conversions (Utils.Convert) /// to parameters and instance if necessary. /// </summary> public static MethodCallExpression SimpleCallHelper(Expression instance, MethodInfo method, params Expression[] arguments) { ContractUtils.RequiresNotNull(method, "method"); ContractUtils.Requires(instance != null ^ method.IsStatic, "instance"); ContractUtils.RequiresNotNullItems(arguments, "arguments"); ParameterInfo[] parameters = method.GetParameters(); ContractUtils.Requires(arguments.Length == parameters.Length, "arguments", "Incorrect number of arguments"); if (instance != null) { instance = Convert(instance, method.DeclaringType); } Expression[] convertedArguments = ArgumentConvertHelper(arguments, parameters); ReadOnlyCollection<Expression> finalArgs; if (convertedArguments == arguments) { // we didn't convert anything, just convert the users original // array to a readonly collection. finalArgs = convertedArguments.ToReadOnly(); } else { // we already copied the array so just stick it in a readonly collection. finalArgs = new ReadOnlyCollection<Expression>(convertedArguments); } // the arguments are now all correct, avoid re-validating the call parameters and // directly create the expression. return Expression.Call(instance, method, finalArgs); }
/// <summary> /// Instantiates a new instance of a DocumentViewerBase. /// </summary> protected DocumentViewerBase() : base() { _pageViews = new ReadOnlyCollection<DocumentPageView>(new List<DocumentPageView>()); // By default text selection is enabled. SetFlags(true, Flags.IsSelectionEnabled); }
internal static NewArrayExpression Make(ExpressionType nodeType, Type type, ReadOnlyCollection<Expression> expressions) { if (nodeType == ExpressionType.NewArrayInit) { return new NewArrayInitExpression(type, expressions); } else { return new NewArrayBoundsExpression(type, expressions); } }
internal CommandMarginProvider( IVim vim, [ImportMany] IEnumerable<Lazy<IOptionsProviderFactory>> optionsProviderFactories) { _vim = vim; _optionsProviderFactories = optionsProviderFactories.ToList().AsReadOnly(); }
internal MemberListBinding(MemberInfo member, ReadOnlyCollection<ElementInit> initializers) #pragma warning disable 618 : base(MemberBindingType.ListBinding, member) { #pragma warning restore 618 Initializers = initializers; }
internal SwitchExpression(Type type, Expression switchValue, Expression defaultBody, MethodInfo comparison, ReadOnlyCollection<SwitchCase> cases) { _type = type; _switchValue = switchValue; _defaultBody = defaultBody; _comparison = comparison; _cases = cases; }
public CartToShim(int cartId, int userId) { CartId = cartId; UserId = userId; CreateDateTime = DateTime.Now; CartItems = new ReadOnlyCollection<CartItem>(_cartItems); }
private AlloyOutliningTaggerWalker(ITreeNodeStream input, ReadOnlyCollection<IToken> tokens, AlloyOutliningTaggerProvider provider, ITextSnapshot snapshot) : base(input, snapshot, provider.OutputWindowService) { _tokens = tokens; _provider = provider; _snapshot = snapshot; }
/// <summary> /// Finds a delegate type for a CallSite using the types in the ReadOnlyCollection of Expression. /// /// We take the read-only collection of Expression explicitly to avoid allocating memory (an array /// of types) on lookup of delegate types. /// </summary> internal static Type MakeCallSiteDelegate(ReadOnlyCollection<Expression> types, Type returnType) { lock (_DelegateCache) { TypeInfo curTypeInfo = _DelegateCache; // CallSite curTypeInfo = NextTypeInfo(typeof(CallSite), curTypeInfo); // arguments for (int i = 0; i < types.Count; i++) { curTypeInfo = NextTypeInfo(types[i].Type, curTypeInfo); } // return type curTypeInfo = NextTypeInfo(returnType, curTypeInfo); // see if we have the delegate already if (curTypeInfo.DelegateType == null) { curTypeInfo.MakeDelegateType(returnType, types); } return curTypeInfo.DelegateType; } }
public ScaleoutStreamManager(Func<int, IList<Message>, Task> send, Action<int, ulong, ScaleoutMessage> receive, int streamCount, TraceSource trace, IPerformanceCounterManager performanceCounters, ScaleoutConfiguration configuration) { if (configuration.QueueBehavior != QueuingBehavior.Disabled && configuration.MaxQueueLength == 0) { throw new InvalidOperationException(Resources.Error_ScaleoutQueuingConfig); } _streams = new ScaleoutStream[streamCount]; _send = send; _receive = receive; var receiveMapping = new ScaleoutMappingStore[streamCount]; performanceCounters.ScaleoutStreamCountTotal.RawValue = streamCount; performanceCounters.ScaleoutStreamCountBuffering.RawValue = streamCount; performanceCounters.ScaleoutStreamCountOpen.RawValue = 0; for (int i = 0; i < streamCount; i++) { _streams[i] = new ScaleoutStream(trace, "Stream(" + i + ")", configuration.QueueBehavior, configuration.MaxQueueLength, performanceCounters); receiveMapping[i] = new ScaleoutMappingStore(); } Streams = new ReadOnlyCollection<ScaleoutMappingStore>(receiveMapping); }
protected override Expression VisitTry(TryExpression node) { MSAst.Expression b = Visit(node.Body); ReadOnlyCollection <CatchBlock> h = Visit(node.Handlers, VisitCatchBlock); MSAst.Expression y = Visit(node.Finally); MSAst.Expression f; _insideConditionalBlock = true; try { f = Visit(node.Fault); } finally { _insideConditionalBlock = false; } node = Ast.MakeTry(node.Type, b, y, f, h); List <MSAst.CatchBlock> newHandlers = null; MSAst.Expression newFinally = null; // If the TryStatement has any Catch blocks we need to insert the exception // event as a first statement so that we can be notified of first-chance exceptions. if (node.Handlers != null && node.Handlers.Count > 0) { newHandlers = new List <MSAst.CatchBlock>(); foreach (var catchBlock in node.Handlers) { MSAst.ParameterExpression exceptionVar = catchBlock.Variable != null ? catchBlock.Variable : Ast.Parameter(catchBlock.Test, null); MSAst.Expression debugMarker, thread; if (_transformToGenerator) { debugMarker = Ast.Call( typeof(RuntimeOps).GetMethod("GetCurrentSequencePointForGeneratorFrame"), _frame ); thread = Ast.Call(typeof(RuntimeOps).GetMethod("GetThread"), _frame); } else { debugMarker = _debugMarker; thread = _thread; } MSAst.Expression exceptionEvent = Ast.Block( // Rethrow ForceToGeneratorLoopException AstUtils.If( Ast.TypeIs( exceptionVar, typeof(ForceToGeneratorLoopException) ), Ast.Throw(exceptionVar) ), AstUtils.If( Ast.Equal(_globalDebugMode, AstUtils.Constant((int)DebugMode.FullyEnabled)), (_pushFrame != null) ? _pushFrame : Ast.Empty(), Ast.Call( typeof(RuntimeOps).GetMethod("OnTraceEvent"), thread, debugMarker, exceptionVar ) ) ); newHandlers.Add(Ast.MakeCatchBlock( catchBlock.Test, exceptionVar, Ast.Block( exceptionEvent, catchBlock.Body ), catchBlock.Filter )); } } if (!_transformToGenerator && node.Finally != null) { // Prevent the user finally block from running if the frame is currently remapping to generator newFinally = AstUtils.If( Ast.Not( Ast.Call( typeof(RuntimeOps).GetMethod("IsCurrentLeafFrameRemappingToGenerator"), _thread ) ), node.Finally ); } if (newHandlers != null || newFinally != null) { node = Ast.MakeTry( node.Type, node.Body, newFinally != null ? newFinally : node.Finally, node.Fault, newHandlers != null ? (IEnumerable <CatchBlock>)newHandlers : node.Handlers ); } return(node); }
internal bool TryGetSecurityKeys(out ReadOnlyCollection <SecurityKey> keys) { keys = _securityKeys; return(keys != null); }
// Use this for initialization void Start() { namesTransform = transform.Find("Names"); keysTransform = transform.Find("Keys"); float maxNameWidth = 0; float contentHeight = 4; ReadOnlyCollection <KeyMapping> keys = InputControl.getKeysList(); foreach (KeyMapping key in keys) { #region Key text GameObject keyNameText = Instantiate(keyNamePrefab) as GameObject; keyNameText.name = key.name; RectTransform keyNameTextRectTransform = keyNameText.GetComponent <RectTransform>(); keyNameTextRectTransform.transform.SetParent(namesTransform); keyNameTextRectTransform.anchoredPosition3D = new Vector3(0, 0, 0); keyNameTextRectTransform.localScale = new Vector3(1, 1, 1); Text keyText = keyNameText.GetComponentInChildren <Text>(); keyText.text = key.name; float keyNameWidth = keyText.preferredWidth + 8; if (keyNameWidth > maxNameWidth) { maxNameWidth = keyNameWidth; } #endregion #region Key buttons GameObject keyButtons = Instantiate(keyButtonsPrefab) as GameObject; keyButtons.name = key.name; RectTransform keyButtonsRectTransform = keyButtons.GetComponent <RectTransform>(); keyButtonsRectTransform.transform.SetParent(keysTransform); keyButtonsRectTransform.anchoredPosition3D = new Vector3(0, 0, 0); keyButtonsRectTransform.localScale = new Vector3(1, 1, 1); for (int i = 0; i < 3; ++i) { InputControlDemo_KeyButtonScript buttonScript = keyButtons.transform.GetChild(i).GetComponent <InputControlDemo_KeyButtonScript>(); buttonScript.keyMapping = key; buttonScript.keyIndex = i; buttonScript.updateText(); } #endregion contentHeight += 28; } RectTransform namesRectTransform = namesTransform.GetComponent <RectTransform>(); RectTransform keysRectTransform = keysTransform.GetComponent <RectTransform>(); RectTransform rectTransform = GetComponent <RectTransform>(); namesRectTransform.offsetMax = new Vector2(maxNameWidth, 0); keysRectTransform.offsetMin = new Vector2(maxNameWidth, 0); rectTransform.offsetMin = new Vector2(0, -contentHeight); }
/// <summary> /// Picks one or more control points within given rectangle</summary> /// <param name="curves">Curves on which to pick points</param> /// <param name="pickRect">Rectangle bounding picked control points</param> /// <param name="points">Points picked</param> /// <param name="regions">PointSelectionRegions of picked points</param> /// <param name="singlePick">if true only single point, tangetnIn, or tangentOut will be picked</param> public void PickPoints(IEnumerable <ICurve> curves, RectangleF pickRect, List <IControlPoint> points, List <PointSelectionRegions> regions, bool singlePick = false) { points.Clear(); regions.Clear(); if (curves == null) { return; } foreach (var curve in curves) { if (!curve.Visible) { continue; } ReadOnlyCollection <IControlPoint> curvePoints = curve.ControlPoints; for (int i = 0; i < curvePoints.Count; i++) { IControlPoint cpt = curvePoints[i]; Vec2F clientcpt = m_canvas.GraphToClient(cpt.X, cpt.Y); if (pickRect.Contains(clientcpt)) { points.Add(cpt); regions.Add(PointSelectionRegions.Point); } else if (curve.CurveInterpolation != InterpolationTypes.Linear && cpt.EditorData.SelectedRegion != PointSelectionRegions.None) { bool tanPicked = false; bool pickTanOut = cpt.TangentOutType != CurveTangentTypes.Stepped && cpt.TangentOutType != CurveTangentTypes.SteppedNext; if (pickTanOut) { Vec2F tangOut = Vec2F.Normalize(m_canvas.GraphToClientTangent(cpt.TangentOut)); Seg2F seg = new Seg2F(clientcpt, (clientcpt + tangOut * m_tangentLength)); if (GdiUtil.Intersects(seg, pickRect)) { points.Add(cpt); regions.Add(PointSelectionRegions.TangentOut); tanPicked = true; } } bool pickTanIn = true; if (i > 0) { IControlPoint prevCpt = curvePoints[i - 1]; pickTanIn = prevCpt.TangentOutType != CurveTangentTypes.Stepped && prevCpt.TangentOutType != CurveTangentTypes.SteppedNext; } if (!tanPicked && pickTanIn) { // pick tangentIn. Vec2F tangIn = Vec2F.Normalize(m_canvas.GraphToClientTangent(cpt.TangentIn)); tangIn.X = -tangIn.X; tangIn.Y = -tangIn.Y; Seg2F seg = new Seg2F(clientcpt, (clientcpt + tangIn * m_tangentLength)); if (GdiUtil.Intersects(seg, pickRect)) { points.Add(cpt); regions.Add(PointSelectionRegions.TangentIn); } } } if (singlePick && points.Count > 0) { break; } } if (singlePick && points.Count > 0) { break; } } // foreach curve in curves }
/// <summary> /// Draws given curve</summary> /// <param name="curve">Curve</param> /// <param name="g">Graphics object</param> /// <param name="thickness">Curve thickness in pixels</param> public void DrawCurve(ICurve curve, Graphics g, float thickness = 1.0f) { // draw pre-infinity // draw actual // draw post-inifiny. ReadOnlyCollection <IControlPoint> points = curve.ControlPoints; if (points.Count == 0) { return; } m_infinityPen.Width = thickness; m_curvePen.Width = thickness; m_infinityPen.Color = curve.CurveColor; m_curvePen.Color = curve.CurveColor; if (points.Count == 1) { Vec2F p = m_canvas.GraphToClient(0, points[0].Y); g.DrawLine(m_infinityPen, 0, p.Y, m_canvas.ClientSize.Width, p.Y); return; } float w = m_canvas.ClientSize.Width; float h = m_canvas.ClientSize.Height; float x0 = m_canvas.ClientToGraph(0); float x1 = m_canvas.ClientToGraph(w); IControlPoint fpt = points[0]; IControlPoint lpt = points[points.Count - 1]; float step = m_tessellation / m_canvas.Zoom.X; List <PointF> pointList = new List <PointF>(m_canvas.Width / m_tessellation); ICurveEvaluator cv = CurveUtils.CreateCurveEvaluator(curve); PointF scrPt = new PointF(); float bound = 500; // guard again gdi+ overflow. float minY = -bound; float maxY = h + bound; // draw pre infinity if (fpt.X > x0) { float start = x0; float end = Math.Min(fpt.X, x1); float rangeX = end - start; for (float x = 0; x < rangeX; x += step) { float xv = start + x; float y = cv.Evaluate(xv); scrPt = m_canvas.GraphToClient(xv, y); scrPt.Y = MathUtil.Clamp(scrPt.Y, minY, maxY); pointList.Add(scrPt); } scrPt = m_canvas.GraphToClient(end, cv.Evaluate(end)); scrPt.Y = MathUtil.Clamp(scrPt.Y, minY, maxY); pointList.Add(scrPt); if (pointList.Count > 1) { g.DrawLines(m_infinityPen, pointList.ToArray()); } } // draw actual if ((fpt.X > x0 || lpt.X > x0) && (fpt.X < x1 || lpt.X < x1)) { int leftIndex; int rightIndex; ComputeIndices(curve, out leftIndex, out rightIndex); if (curve.CurveInterpolation == InterpolationTypes.Linear) { for (int i = leftIndex; i < rightIndex; i++) { IControlPoint p1 = points[i]; IControlPoint p2 = points[i + 1]; PointF cp1 = m_canvas.GraphToClient(p1.X, p1.Y); PointF cp2 = m_canvas.GraphToClient(p2.X, p2.Y); g.DrawLine(m_curvePen, cp1.X, cp1.Y, cp2.X, cp2.Y); } } else { for (int i = leftIndex; i < rightIndex; i++) { IControlPoint p1 = points[i]; IControlPoint p2 = points[i + 1]; if (p1.TangentOutType == CurveTangentTypes.Stepped) { PointF cp1 = m_canvas.GraphToClient(p1.X, p1.Y); PointF cp2 = m_canvas.GraphToClient(p2.X, p2.Y); g.DrawLine(m_curvePen, cp1.X, cp1.Y, cp2.X, cp1.Y); g.DrawLine(m_curvePen, cp2.X, cp1.Y, cp2.X, cp2.Y); } else if (p1.TangentOutType != CurveTangentTypes.SteppedNext) { float start = Math.Max(p1.X, x0); float end = Math.Min(p2.X, x1); pointList.Clear(); float rangeX = end - start; for (float x = 0; x < rangeX; x += step) { float xv = start + x; float y = cv.Evaluate(xv); scrPt = m_canvas.GraphToClient(xv, y); scrPt.Y = MathUtil.Clamp(scrPt.Y, minY, maxY); pointList.Add(scrPt); } scrPt = m_canvas.GraphToClient(end, cv.Evaluate(end)); scrPt.Y = MathUtil.Clamp(scrPt.Y, minY, maxY); pointList.Add(scrPt); if (pointList.Count > 1) { g.DrawLines(m_curvePen, pointList.ToArray()); } } }// for (int i = leftIndex; i < rightIndex; i++) } } //draw post-infinity. if (lpt.X < x1) { pointList.Clear(); float start = Math.Max(x0, lpt.X); float end = x1; float rangeX = end - start; for (float x = 0; x < rangeX; x += step) { float xv = start + x; float y = cv.Evaluate(xv); scrPt = m_canvas.GraphToClient(xv, y); scrPt.Y = MathUtil.Clamp(scrPt.Y, minY, maxY); pointList.Add(scrPt); } scrPt = m_canvas.GraphToClient(end, cv.Evaluate(end)); scrPt.Y = MathUtil.Clamp(scrPt.Y, minY, maxY); pointList.Add(scrPt); if (pointList.Count > 1) { g.DrawLines(m_infinityPen, pointList.ToArray()); } } }
internal static PowerShell Convert(ScriptBlockAst body, ReadOnlyCollection <ParameterAst> functionParameters, bool isTrustedInput, ExecutionContext context, Dictionary <string, object> variables, bool filterNonUsingVariables, bool?createLocalScope, object[] args) { ExecutionContext.CheckStackDepth(); if (args == null) { args = Array.Empty <object>(); } // Perform validations on the ScriptBlock. GetSimplePipeline can allow for more than one // pipeline if the first parameter is true, but Invoke-Command doesn't yet support multiple // pipelines in a PowerShell (it just grabs the last command directly.) The rest of this // code properly supports multiple pipelines, so it should just work to change the false to true // if/when Invoke-Command can support multiple pipelines. string errorId; string errorMsg; body.GetSimplePipeline(true, out errorId, out errorMsg); if (errorId != null) { throw new ScriptBlockToPowerShellNotSupportedException(errorId, null, errorMsg); } var checker = new ScriptBlockToPowerShellChecker { ScriptBeingConverted = body }; if (functionParameters != null) { foreach (var parameter in functionParameters) { parameter.InternalVisit(checker); } } body.InternalVisit(checker); // When the context is null (or they haven't supplied any variables), throw, but only if we really need the // context (basically, if we have some variable reference to resolve). if (context == null && (checker.HasUsingExpr || checker.UsesParameter) && (variables == null)) { throw new PSInvalidOperationException(AutomationExceptions.CantConvertScriptBlockWithNoContext); } try { var converter = new ScriptBlockToPowerShellConverter { _context = context, _createLocalScope = createLocalScope }; if (checker.HasUsingExpr) { converter._usingValueMap = GetUsingValues(body, isTrustedInput, context, variables, filterNonUsingVariables).Item1; } if (checker.UsesParameter) { // If any parameters are used, we create a new scope and bind the parameters. var newScope = context.EngineSessionState.NewScope(false); context.EngineSessionState.CurrentScope = newScope; context.EngineSessionState.CurrentScope.ScopeOrigin = CommandOrigin.Internal; var locals = MutableTuple.MakeTuple(Compiler.DottedLocalsTupleType, Compiler.DottedLocalsNameIndexMap); // Get the parameter metadata for the script block. // If 'functionParameters' is not null, then the ScriptBlockAst is actually the body of a FunctionDefinitionAst, and it doesn't have a ParamBlock. // If 'functionParameters' is null, then the ScriptBlockAst may have parameters defined in its ParamBlock. bool usesCmdletBinding = false; var parameters = functionParameters != null ? Compiler.GetParameterMetaData(functionParameters, true, ref usesCmdletBinding) : ((IParameterMetadataProvider)body).GetParameterMetadata(true, ref usesCmdletBinding); object[] remainingArgs = ScriptBlock.BindArgumentsForScriptblockInvoke( (RuntimeDefinedParameter[])parameters.Data, args, context, false, null, locals); locals.SetAutomaticVariable(AutomaticVariable.Args, remainingArgs, context); newScope.LocalsTuple = locals; } foreach (var pipeline in body.EndBlock.Statements.OfType <PipelineAst>()) { converter._powershell.AddStatement(); converter.ConvertPipeline(pipeline, isTrustedInput); } return(converter._powershell); } finally { if (checker.UsesParameter) { context.EngineSessionState.RemoveScope(context.EngineSessionState.CurrentScope); } } }
internal static ReadOnlyCollection <IAuthorizationPolicy> CloneAuthorizationPoliciesIfNecessary(ReadOnlyCollection <IAuthorizationPolicy> authorizationPolicies) { if (authorizationPolicies != null && authorizationPolicies.Count > 0) { bool clone = false; for (int i = 0; i < authorizationPolicies.Count; ++i) { UnconditionalPolicy policy = authorizationPolicies[i] as UnconditionalPolicy; if (policy != null && policy.IsDisposable) { clone = true; break; } } if (clone) { List <IAuthorizationPolicy> ret = new List <IAuthorizationPolicy>(authorizationPolicies.Count); for (int i = 0; i < authorizationPolicies.Count; ++i) { UnconditionalPolicy policy = authorizationPolicies[i] as UnconditionalPolicy; if (policy != null) { ret.Add(policy.Clone()); } else { ret.Add(authorizationPolicies[i]); } } return(new ReadOnlyCollection <IAuthorizationPolicy>(ret)); } } return(authorizationPolicies); }
internal static void DisposeClaimSetsIfNecessary(ReadOnlyCollection <ClaimSet> claimSets) { throw ExceptionHelper.PlatformNotSupported(); }
/// <summary> /// Allows you to do things before this item's tooltip is drawn. /// </summary> /// <param name="item">The item</param> /// <param name="lines">The tooltip lines for this item</param> /// <param name="x">The top X position for this tooltip. It is where the first line starts drawing</param> /// <param name="y">The top Y position for this tooltip. It is where the first line starts drawing</param> /// <returns>Whether or not to draw this tooltip</returns> public virtual bool PreDrawTooltip(Item item, ReadOnlyCollection <TooltipLine> lines, ref int x, ref int y) { return(true); }
/// <summary> /// Allows you to do things after this item's tooltip is drawn. The lines contain draw information as this is ran after drawing the tooltip. /// </summary> /// <param name="item">The item</param> /// <param name="lines">The tooltip lines for this item</param> public virtual void PostDrawTooltip(Item item, ReadOnlyCollection <DrawableTooltipLine> lines) { }
public byte[] CreateCookieFromSecurityContext(UniqueId contextId, string id, byte[] key, DateTime tokenEffectiveTime, DateTime tokenExpirationTime, UniqueId keyGeneration, DateTime keyEffectiveTime, DateTime keyExpirationTime, ReadOnlyCollection <IAuthorizationPolicy> authorizationPolicies) { throw ExceptionHelper.PlatformNotSupported(); }
public GameState(IEnumerable <ProvinceState> provinces) { Provinces = provinces.ToList().AsReadOnly(); _tileOwners = GetTileOwnerDictionary(); }
public PlayerStat() { statModifiers = new List <StatModifier>(); StatModifiers = statModifiers.AsReadOnly(); }
public static void ValidateArgumentTypes(MethodBase method, ExpressionType nodeKind, ref ReadOnlyCollection <Expression> arguments) { #if NET35 || UNITY_5 Debug.Assert(nodeKind == ExpressionType.Invoke || nodeKind == ExpressionType.Call || nodeKind == ExpressionType.New); #else Debug.Assert(nodeKind == ExpressionType.Invoke || nodeKind == ExpressionType.Call || nodeKind == ExpressionType.Dynamic || nodeKind == ExpressionType.New); #endif ParameterInfo[] pis = GetParametersForValidation(method, nodeKind); ValidateArgumentCount(method, nodeKind, arguments.Count, pis); Expression[] newArgs = null; for (int i = 0, n = pis.Length; i < n; i++) { Expression arg = arguments[i]; ParameterInfo pi = pis[i]; arg = ValidateOneArgument(method, nodeKind, arg, pi); if (newArgs == null && arg != arguments[i]) { newArgs = new Expression[arguments.Count]; for (int j = 0; j < i; j++) { newArgs[j] = arguments[j]; } } if (newArgs != null) { newArgs[i] = arg; } } if (newArgs != null) { arguments = new ReadOnlyCollection <Expression>(newArgs); } }
string IDkmClrFormatter.GetTypeName(DkmInspectionContext inspectionContext, DkmClrType type, DkmClrCustomTypeInfo typeInfo, ReadOnlyCollection <string> formatSpecifiers) { bool unused; return(GetTypeName(new TypeAndCustomInfo(type.GetLmrType(), typeInfo), escapeKeywordIdentifiers: false, sawInvalidIdentifier: out unused)); }
internal abstract string TrimAndGetFormatSpecifiers(string expression, out ReadOnlyCollection <string> formatSpecifiers);
public static Schema MixedSchema(bool isSingleton = false) { var schema = new Schema("user", isSingleton: isSingleton) .Publish() .AddArray(101, "root-array", Partitioning.Language, f => f .AddAssets(201, "nested-assets") .AddBoolean(202, "nested-boolean") .AddDateTime(203, "nested-datetime") .AddGeolocation(204, "nested-geolocation") .AddJson(205, "nested-json") .AddJson(211, "nested-json2") .AddNumber(206, "nested-number") .AddReferences(207, "nested-references") .AddString(208, "nested-string") .AddTags(209, "nested-tags") .AddUI(210, "nested-ui")) .AddAssets(102, "root-assets", Partitioning.Invariant, new AssetsFieldProperties()) .AddBoolean(103, "root-boolean", Partitioning.Invariant, new BooleanFieldProperties()) .AddDateTime(104, "root-datetime", Partitioning.Invariant, new DateTimeFieldProperties { Editor = DateTimeFieldEditor.DateTime }) .AddDateTime(105, "root-date", Partitioning.Invariant, new DateTimeFieldProperties { Editor = DateTimeFieldEditor.Date }) .AddGeolocation(106, "root-geolocation", Partitioning.Invariant, new GeolocationFieldProperties()) .AddJson(107, "root-json", Partitioning.Invariant, new JsonFieldProperties()) .AddNumber(108, "root-number", Partitioning.Invariant, new NumberFieldProperties { MinValue = 1, MaxValue = 10 }) .AddReferences(109, "root-references", Partitioning.Invariant, new ReferencesFieldProperties()) .AddString(110, "root-string1", Partitioning.Invariant, new StringFieldProperties { Label = "My String1", IsRequired = true, AllowedValues = ReadOnlyCollection.Create("a", "b") }) .AddString(111, "root-string2", Partitioning.Invariant, new StringFieldProperties { Hints = "My String1" }) .AddTags(112, "root-tags", Partitioning.Language, new TagsFieldProperties()) .AddUI(113, "root-ui", Partitioning.Language, new UIFieldProperties()) .Update(new SchemaProperties { Hints = "The User" }) .HideField(104) .HideField(211, 101) .DisableField(109) .DisableField(212, 101) .LockField(105); return(schema); }
string IDkmClrFormatter.GetValueString(DkmClrValue value, DkmInspectionContext inspectionContext, ReadOnlyCollection <string> formatSpecifiers) { ObjectDisplayOptions options = GetValueStringOptions((inspectionContext.EvaluationFlags & DkmEvaluationFlags.NoQuotes) == 0); return(GetValueString(value, inspectionContext, options, GetValueFlags.IncludeObjectId)); }
/// <summary> /// Compute tangents for the given curve</summary> /// <param name="curve">Curve object to be modified</param> /// <param name="index">0-based index into the curve's ControlPoints. If the index is out of /// bound, this method does nothing</param> public static void ComputeTangentIn(ICurve curve, int index) { if (curve == null) { return; } ReadOnlyCollection <IControlPoint> points = curve.ControlPoints; if (index < 0 || index >= points.Count) { return; } IControlPoint curP = points[index]; if (curP.TangentInType == CurveTangentTypes.Fixed) { return; } Vec2F tan = new Vec2F(0, 0); int lastIndex = points.Count - 1; IControlPoint prevP = (index > 0) ? points[index - 1] : null; IControlPoint nextP = (index < lastIndex) ? points[index + 1] : null; if ((curP.TangentInType == CurveTangentTypes.Clamped) && (prevP != null)) { float py = prevP.Y - curP.Y; if (py < 0.0f) { py = -py; } float ny = (nextP == null ? py : nextP.Y - curP.Y); if (ny < 0.0f) { ny = -ny; } if ((ny <= 0.05f) || (py <= 0.05f)) { curP.TangentInType = CurveTangentTypes.Flat; } } switch (curP.TangentInType) { case CurveTangentTypes.Clamped: case CurveTangentTypes.Spline: if (curP.TangentInType == CurveTangentTypes.Clamped) { curP.TangentInType = CurveTangentTypes.Spline; } /* Maya 2.0 smooth tangents */ if ((prevP == null) && (nextP != null)) { tan.X = nextP.X - curP.X; tan.Y = nextP.Y - curP.Y; } else if ((prevP != null) && (nextP == null)) { tan.X = curP.X - prevP.X; tan.Y = curP.Y - prevP.Y; } else if ((prevP != null) && (nextP != null)) { float dx = nextP.X - prevP.X; float dy = 0.0f; if (dx < s_epsilone) { dy = MaxTan; } else { dy = (nextP.Y - prevP.Y) / dx; } tan.X = curP.X - prevP.X; tan.Y = dy * tan.X; } else { tan = new Vec2F(1, 0); } break; case CurveTangentTypes.Linear: if (prevP == null) { tan = new Vec2F(1, 0); } else { tan = new Vec2F(curP.X - prevP.X, curP.Y - prevP.Y); } break; case CurveTangentTypes.Stepped: tan = new Vec2F(0, 0); break; case CurveTangentTypes.SteppedNext: tan = new Vec2F(float.MaxValue, float.MaxValue); break; case CurveTangentTypes.Flat: if (prevP == null) { float x = (nextP == null) ? 0 : (nextP.X - curP.X); tan = new Vec2F(x, 0); } else { tan = new Vec2F(curP.X - prevP.X, 0); } break; case CurveTangentTypes.Fixed: break; default: throw new NotImplementedException(curP.TangentInType.ToString()); } tan = EnsureValidTangent(tan, false); if (curP.TangentIn != tan) { curP.TangentIn = tan; } }
public Box(ReadOnlyCollection <Box> children) { // initially set all fields to 0.0 Dimensions = default(Dimensions); Children = children; }
public SqlNode() { Children = new ReadOnlyCollection <SqlNode>(m_children); }
public NodeBox(ReadOnlyCollection <Box> children, StyledNode style) : base(children) { Style = style; }
internal static LambdaExpression Create(Expression body, string name, bool tailCall, ReadOnlyCollection <ParameterExpression> parameters) { return(new Expression <TDelegate>(body, name, tailCall, parameters)); }
/// <summary> /// Performs the runtime binding of the dynamic operation on a set of arguments. /// </summary> /// <param name="args">An array of arguments to the dynamic operation.</param> /// <param name="parameters">The array of <see cref="ParameterExpression"/> instances that represent the parameters of the call site in the binding process.</param> /// <param name="returnLabel">A LabelTarget used to return the result of the dynamic binding.</param> /// <returns> /// An Expression that performs tests on the dynamic operation arguments, and /// performs the dynamic operation if the tests are valid. If the tests fail on /// subsequent occurrences of the dynamic operation, Bind will be called again /// to produce a new <see cref="Expression"/> for the new argument types. /// </returns> public sealed override Expression Bind(object[] args, ReadOnlyCollection <ParameterExpression> parameters, LabelTarget returnLabel) { ContractUtils.RequiresNotNull(args, nameof(args)); ContractUtils.RequiresNotNull(parameters, nameof(parameters)); ContractUtils.RequiresNotNull(returnLabel, nameof(returnLabel)); if (args.Length == 0) { throw System.Linq.Expressions.Error.OutOfRange("args.Length", 1); } if (parameters.Count == 0) { throw System.Linq.Expressions.Error.OutOfRange("parameters.Count", 1); } if (args.Length != parameters.Count) { throw new ArgumentOutOfRangeException(nameof(args)); } // Ensure that the binder's ReturnType matches CallSite's return // type. We do this so meta objects and language binders can // compose trees together without needing to insert converts. Type expectedResult; if (IsStandardBinder) { expectedResult = ReturnType; if (returnLabel.Type != typeof(void) && !TypeUtils.AreReferenceAssignable(returnLabel.Type, expectedResult)) { throw System.Linq.Expressions.Error.BinderNotCompatibleWithCallSite(expectedResult, this, returnLabel.Type); } } else { // Even for non-standard binders, we have to at least make sure // it works with the CallSite's type to build the return. expectedResult = returnLabel.Type; } DynamicMetaObject target = DynamicMetaObject.Create(args[0], parameters[0]); DynamicMetaObject[] metaArgs = CreateArgumentMetaObjects(args, parameters); DynamicMetaObject binding = Bind(target, metaArgs); if (binding == null) { throw System.Linq.Expressions.Error.BindingCannotBeNull(); } Expression body = binding.Expression; BindingRestrictions restrictions = binding.Restrictions; // Ensure the result matches the expected result type. if (expectedResult != typeof(void) && !TypeUtils.AreReferenceAssignable(expectedResult, body.Type)) { // // Blame the last person that handled the result: assume it's // the dynamic object (if any), otherwise blame the language. // if (target.Value is IDynamicMetaObjectProvider) { throw System.Linq.Expressions.Error.DynamicObjectResultNotAssignable(body.Type, target.Value.GetType(), this, expectedResult); } else { throw System.Linq.Expressions.Error.DynamicBinderResultNotAssignable(body.Type, this, expectedResult); } } // if the target is IDO, standard binders ask it to bind the rule so we may have a target-specific binding. // it makes sense to restrict on the target's type in such cases. // ideally IDO metaobjects should do this, but they often miss that type of "this" is significant. if (IsStandardBinder && args[0] is IDynamicMetaObjectProvider) { if (restrictions == BindingRestrictions.Empty) { throw System.Linq.Expressions.Error.DynamicBindingNeedsRestrictions(target.Value !.GetType(), this); } } // Add the return if (body.NodeType != ExpressionType.Goto) { body = Expression.Return(returnLabel, body); } // Finally, add restrictions if (restrictions != BindingRestrictions.Empty) { body = Expression.IfThen(restrictions.ToExpression(), body); } return(body); }
private void PublishChangeList(ReadOnlyCollection <InvoiceModel> invoiceModels) { invoiceReceiver?.ReceiveInvoices(invoiceModels); }
protected Object () { resources = resource_list.AsReadOnly (); }
public IntArrayKey(IEnumerable <int> sequence) { _array = sequence.ToArray(); _hashCode = hashCode(); Array = new ReadOnlyCollection <int>(_array); }
internal Expression(Expression body, string name, bool tailCall, ReadOnlyCollection <ParameterExpression> parameters) : base(typeof(TDelegate), name, body, tailCall, parameters) { }
/// <summary> /// Initializes a new instance of the <see cref="LawSource" /> class. /// </summary> /// <param name="stream"><see cref="Stream" /> which contains raw waveform-audio data.</param> /// <param name="waveFormat">The format of the waveform-audio data within the <paramref name="stream" />.</param> public LawSource(Stream stream, WaveFormat waveFormat, ReadOnlyCollection <WaveFileChunk> chunks) { if (stream == null) { throw new ArgumentNullException("stream"); } if (waveFormat == null) { throw new ArgumentNullException("waveFormat"); } if (!stream.CanRead) { throw new ArgumentException("stream is not readable", "stream"); } if (waveFormat.WaveFormatTag != AudioEncoding.MuLaw && waveFormat.WaveFormatTag != AudioEncoding.ALaw) { throw new ArgumentException(string.Format("Not supported encoding: {0}", waveFormat.WaveFormatTag)); } this._chunks = chunks; // check format var audioFormat = new AudioFormat(); this._audioFormat = audioFormat; var fmtChunk = (FmtChunk)_chunks.FirstOrDefault(x => x is FmtChunk); if (fmtChunk != null) { // https://github.com/chirlu/sox/blob/4927023d0978615c74e8a511ce981cf4c29031f1/src/wav.c long oldPosition = stream.Position; long startPosition = fmtChunk.StartPosition; long endPosition = fmtChunk.EndPosition; long chunkDataSize = fmtChunk.ChunkDataSize; stream.Position = startPosition; var reader = new BinaryReader(stream); audioFormat.Encoding = (AudioEncoding)reader.ReadInt16(); audioFormat.Channels = reader.ReadInt16(); audioFormat.SampleRate = reader.ReadInt32(); audioFormat.AverageBytesPerSecond = reader.ReadInt32(); audioFormat.BlockAlign = reader.ReadInt16(); audioFormat.BitsPerSample = reader.ReadInt16(); if (fmtChunk.ChunkDataSize > 16) { audioFormat.ExtraSize = reader.ReadInt16(); } // reset position stream.Position = oldPosition; reader = null; } var dataChunk = (DataChunk)_chunks.FirstOrDefault(x => x is DataChunk); if (dataChunk != null) { audioFormat.DataChunkSize = dataChunk.ChunkDataSize; audioFormat.DataStartPosition = dataChunk.DataStartPosition; audioFormat.DataEndPosition = dataChunk.DataEndPosition; // calculate byte length when 16 bits per sample _length = audioFormat.DataChunkSize * 2; } else { throw new ArgumentException("The specified stream does not contain any data chunks."); } Log.Verbose(audioFormat.ToString()); // set the format identifiers to what this class returns waveFormat.BitsPerSample = 16; // originally 4 waveFormat.WaveFormatTag = AudioEncoding.Pcm; // originally adpcm _waveFormat = waveFormat; _stream = stream; }
/// <summary> /// Initialize a new instance of the <see cref="VendorSpecificDataBlock"/> class with the data of this block untreated with version block. /// </summary> /// <param name="dataBlock">Unprocessed data in this block</param> /// <param name="version">Block version.</param> public VendorSpecificDataBlock(ReadOnlyCollection <byte> dataBlock, int?version = null) : base(dataBlock, version) { }