From 9750c83b927833fd4fb3bce977cc91d7588fef7c Mon Sep 17 00:00:00 2001 From: ThomasGoulet73 <51839772+ThomasGoulet73@users.noreply.github.com> Date: Mon, 30 Dec 2024 17:00:50 -0500 Subject: [PATCH] Cleanup: Use named arguments in WindowsBase. Manual changes. Contributes to dotnet/wpf#10018 --- .../WindowsBase/MS/Internal/IO/Packaging/PackUriHelper.cs | 6 +++--- .../MS/Internal/IO/Packaging/SparseMemoryStream.cs | 8 ++++---- .../Internal/IO/Packaging/XmlDigitalSignatureProcessor.cs | 8 ++++---- .../System/ComponentModel/PropertyChangedEventManager.cs | 2 +- .../System/IO/Packaging/CompoundFile/DataSpaceManager.cs | 4 ++-- .../WindowsBase/System/IO/Packaging/EncryptedPackage.cs | 4 ++-- .../src/WindowsBase/System/Windows/DependencyObject.cs | 8 ++++---- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/PackUriHelper.cs b/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/PackUriHelper.cs index b723f954a0d..286824866c1 100644 --- a/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/PackUriHelper.cs +++ b/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/PackUriHelper.cs @@ -575,9 +575,9 @@ private int Compare(ValidatedPartUri otherPartUri) //need to use the private constructor to initialize this particular partUri as we need this in the //IsRelationshipPartUri, that is called from the constructor. private static readonly Uri _containerRelationshipNormalizedPartUri = new ValidatedPartUri("/_RELS/.RELS", - true /*isnormalized*/, - false /*computeIsRelationship*/, - true /*IsRelationship*/); + isNormalized: true, + computeIsRelationship: false, + isRelationshipPartUri: true); private static ReadOnlySpan ForwardSlashSeparator => ['/']; diff --git a/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/SparseMemoryStream.cs b/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/SparseMemoryStream.cs index 1eee09c5430..9266061600e 100644 --- a/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/SparseMemoryStream.cs +++ b/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/SparseMemoryStream.cs @@ -306,8 +306,8 @@ internal void WriteToStream(Stream stream) { _isolatedStorageStream.Seek(0, SeekOrigin.Begin); PackagingUtilities.CopyStream(_isolatedStorageStream, stream, - Int64.MaxValue/*bytes to copy*/, - 0x80000 /*512K buffer size */); + bytesToCopy: Int64.MaxValue, + bufferSize: 0x80000 /* 512K */); } } else @@ -657,8 +657,8 @@ private void SwitchModeIfNecessary() _isolatedStorageStream.Seek(0, SeekOrigin.Begin); newMemStreamBlock.Stream.Seek(0, SeekOrigin.Begin); PackagingUtilities.CopyStream(_isolatedStorageStream, newMemStreamBlock.Stream, - Int64.MaxValue/*bytes to copy*/, - 0x80000 /*512K buffer size */); + bytesToCopy: Int64.MaxValue, + bufferSize: 0x80000 /* 512K */); } Debug.Assert(newMemStreamBlock.Stream.Length > 0); diff --git a/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/XmlDigitalSignatureProcessor.cs b/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/XmlDigitalSignatureProcessor.cs index 4e020b7d647..1fcdd598664 100644 --- a/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/XmlDigitalSignatureProcessor.cs +++ b/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/XmlDigitalSignatureProcessor.cs @@ -94,7 +94,7 @@ internal bool Verify(X509Certificate2 signer) // Validate the Reference tags in the SignedInfo as per the // restrictions imposed by the OPC spec - ValidateReferences(xmlSig.SignedInfo.References, true /*allowPackageSpecificReference*/); + ValidateReferences(xmlSig.SignedInfo.References, allowPackageSpecificReferences: true); // verify "standard" XmlSignature portions result = xmlSig.CheckSignature(signer, true); @@ -498,8 +498,8 @@ internal static Stream GenerateRelationshipNodeStream(IEnumerable(), - false /* Not writable */)); + writable: false)); } else { @@ -1353,7 +1353,7 @@ void ReadTransformDefinitions() // NOTE: Building MemoryStream directly on top of // instanceData byte array because we want it to be // NOT resizable and NOT writable. - instanceDataStream = new MemoryStream(instanceData, false /* Not writable */); + instanceDataStream = new MemoryStream(instanceData, writable: false); } else { diff --git a/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/IO/Packaging/EncryptedPackage.cs b/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/IO/Packaging/EncryptedPackage.cs index 5084d437510..0695d0d21eb 100644 --- a/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/IO/Packaging/EncryptedPackage.cs +++ b/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/IO/Packaging/EncryptedPackage.cs @@ -1126,8 +1126,8 @@ private void //copy the stream PackagingUtilities.CopyStream(packageStream, _packageStream, - Int64.MaxValue, /*bytes to copy*/ - 4096 /*buffer size */); + bytesToCopy: Int64.MaxValue, + bufferSize: 4096); _package = Package.Open(_packageStream, FileMode.Open, this.FileOpenAccess); } else diff --git a/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/DependencyObject.cs b/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/DependencyObject.cs index f13fdeb1f13..16cfe769a39 100644 --- a/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/DependencyObject.cs +++ b/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/DependencyObject.cs @@ -1089,7 +1089,7 @@ public void CoerceValue(DependencyProperty dp) entryIndex, dp, metadata, - new EffectiveValueEntry() /* oldEntry */, + oldEntry: new EffectiveValueEntry(), ref newEntry, coerceWithDeferredReference: false, coerceWithCurrentValue: false, @@ -1186,7 +1186,7 @@ internal void InvalidateProperty(DependencyProperty dp, bool preserveCurrentValu LookupEntry(dp.GlobalIndex), dp, dp.GetMetadata(DependencyObjectType), - new EffectiveValueEntry() /* oldEntry */, + oldEntry: new EffectiveValueEntry(), ref newEntry, coerceWithDeferredReference: false, coerceWithCurrentValue: false, @@ -3049,7 +3049,7 @@ internal EntryIndex LookupEntry(int targetIndex) if (iHi <= 0) { - return new EntryIndex(0, false /* Found */); + return new EntryIndex(0, found: false); } // Do a binary search to find the value @@ -3091,7 +3091,7 @@ internal EntryIndex LookupEntry(int targetIndex) } while (iLo < iHi); - return new EntryIndex(iLo, false /* Found */); + return new EntryIndex(iLo, found: false); } // insert the given entry at the given index