-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Replace BF for string input * Replacing BF * Updated BinaryFormattedObjectExtension * Replacing BF in DataStreams * Fixing Build for test * Updating comments * Adding fall back to BinaryFormatter * Adding UnitTest setup * Adding more BinaryFormatWriter test * Adding more unit tests * Adding BinaryFormattedObjectTests * Replacing Binaries before Unit Tests * Updating copy-wpf.ps1 * Resolving Replace binaries issue * Adding UnitTest setup * Adding more BinaryFormatWriter test * Adding more unit tests * Adding BinaryFormattedObjectTests * Replacing Binaries before Unit Tests * Updating copy-wpf.ps1 * Resolving Replace binaries issue * excluding DirectWriteForwarder for copy command * disable replace naive binaries * updating args data type * Replace BF for string input * Replacing BF * Updated BinaryFormattedObjectExtension * Replacing BF in DataStreams * Fixing Build for test * Updating comments * Adding fall back to BinaryFormatter * Adding UnitTest setup * Adding more BinaryFormatWriter test * Adding more unit tests * Adding BinaryFormattedObjectTests * Replacing Binaries before Unit Tests * Updating copy-wpf.ps1 * Resolving Replace binaries issue * excluding DirectWriteForwarder for copy command * Adding UnitTest setup * Adding more BinaryFormatWriter test * Adding more unit tests * disable replace naive binaries * updating args data type * updating pipeline-pr.yml * Replace BF for string input * Replacing BF * Updated BinaryFormattedObjectExtension * Replacing BF in DataStreams * Fixing Build for test * Updating comments * Adding fall back to BinaryFormatter * Adding UnitTest setup * Adding more BinaryFormatWriter test * Adding more unit tests * Adding BinaryFormattedObjectTests * Replacing Binaries before Unit Tests * Updating copy-wpf.ps1 * Resolving Replace binaries issue * excluding DirectWriteForwarder for copy command * Adding UnitTest setup * Adding more BinaryFormatWriter test * Adding more unit tests * disable replace naive binaries * updating args data type * updating pipeline-pr.yml * Replace BF for string input * Replacing BF * Replacing BF in DataStreams * Updating comments * Adding fall back to BinaryFormatter * Adding more BinaryFormatWriter test * Adding more unit tests * Adding more BinaryFormatWriter test * Adding more unit tests * Remove commented code and add correct indentation * Add "System.Runtime.Serialization.Formatters" reference in unit test * Disabling PresentationCore.Tests [Temp] * Revert Replace binaries before test * Fix indentation * Update Release | x86 type for SystemXamlTest * Update Write-host to wirte-debug for debug statement
- Loading branch information
1 parent
321e201
commit f29acba
Showing
87 changed files
with
6,424 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/BinaryFormat/ArrayInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.IO; | ||
|
||
namespace System.Windows | ||
{ | ||
/// <summary> | ||
/// Array information structure. | ||
/// </summary> | ||
/// <remarks> | ||
/// <para> | ||
/// <see href="https://learn.microsoft.com/openspecs/windows_protocols/ms-nrbf/8fac763f-e46d-43a1-b360-80eb83d2c5fb"> | ||
/// [MS-NRBF] 2.4.2.1 | ||
/// </see> | ||
/// </para> | ||
/// </remarks> | ||
internal readonly struct ArrayInfo : IBinaryWriteable | ||
{ | ||
public Id ObjectId { get; } | ||
public Count Length { get; } | ||
|
||
public ArrayInfo(Id objectId, Count length) | ||
{ | ||
Length = length; | ||
ObjectId = objectId; | ||
} | ||
|
||
public static ArrayInfo Parse(BinaryReader reader, out Count length) | ||
{ | ||
ArrayInfo arrayInfo = new(reader.ReadInt32(), reader.ReadInt32()); | ||
length = arrayInfo.Length; | ||
return arrayInfo; | ||
} | ||
|
||
public readonly void Write(BinaryWriter writer) | ||
{ | ||
writer.Write(ObjectId); | ||
writer.Write(Length); | ||
} | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/BinaryFormat/ArrayRecord.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
|
||
using System.Collections.Generic; | ||
using System.Collections; | ||
using System.Linq; | ||
|
||
namespace System.Windows | ||
{ | ||
/// <summary> | ||
/// Base class for array records. | ||
/// </summary> | ||
/// <devdoc> | ||
/// <see href="https://learn.microsoft.com/openspecs/windows_protocols/ms-nrbf/f57d41e5-d3c0-4340-add8-fa4449a68d1c"> | ||
/// [MS-NRBF] 2.4</see> describes how item records must follow the array record and how multiple null records | ||
/// can be coalesced into an <see cref="NullRecord.ObjectNullMultiple"/> or <see cref="NullRecord.ObjectNullMultiple256"/> | ||
/// record. | ||
/// </devdoc> | ||
internal abstract class ArrayRecord : Record, IEnumerable<object> | ||
{ | ||
public ArrayInfo ArrayInfo { get; } | ||
|
||
/// <summary> | ||
/// The array items. | ||
/// </summary> | ||
/// <remarks> | ||
/// <para> | ||
/// Multi-null records are always expanded to individual <see cref="ObjectNull"/> entries when reading. | ||
/// </para> | ||
/// </remarks> | ||
public IReadOnlyList<object> ArrayObjects { get; } | ||
|
||
/// <summary> | ||
/// Identifier for the array. | ||
/// </summary> | ||
public Id ObjectId => ArrayInfo.ObjectId; | ||
|
||
/// <summary> | ||
/// Length of the array. | ||
/// </summary> | ||
public Count Length => ArrayInfo.Length; | ||
|
||
/// <summary> | ||
/// Returns the item at the given index. | ||
/// </summary> | ||
public object this[int index] => ArrayObjects[index]; | ||
|
||
public ArrayRecord(ArrayInfo arrayInfo, IReadOnlyList<object> arrayObjects) | ||
{ | ||
if (arrayInfo.Length != arrayObjects.Count) | ||
{ | ||
throw new ArgumentException($"{nameof(arrayInfo)} doesn't match count of {nameof(arrayObjects)}"); | ||
} | ||
|
||
ArrayInfo = arrayInfo; | ||
ArrayObjects = arrayObjects; | ||
} | ||
|
||
IEnumerator<object> IEnumerable<object>.GetEnumerator() => ArrayObjects.GetEnumerator(); | ||
IEnumerator IEnumerable.GetEnumerator() => ArrayObjects.GetEnumerator(); | ||
} | ||
} |
Oops, something went wrong.