Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add MessageWriter.WriteDictionary() overloads for VariantValue #327

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/Tmds.DBus.Protocol/MessageWriter.Array.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,22 @@
public void WriteArray(IEnumerable<ObjectPath> value)
=> WriteArrayOfT(value);

public void WriteArray(VariantValue[] value)
=> WriteArray(value.AsSpan());

public void WriteArray(ReadOnlySpan<VariantValue> value)
=> WriteArrayOfT(value);

public void WriteArray(IEnumerable<VariantValue> value)
=> WriteArrayOfT(value);

public void WriteArray(Variant[] value)

Check warning on line 113 in src/Tmds.DBus.Protocol/MessageWriter.Array.cs

View workflow job for this annotation

GitHub Actions / build

'Variant' is obsolete: 'Variant will be removed. Use the VariantValue type instead.'
=> WriteArray(value.AsSpan());

public void WriteArray(ReadOnlySpan<Variant> value)

Check warning on line 116 in src/Tmds.DBus.Protocol/MessageWriter.Array.cs

View workflow job for this annotation

GitHub Actions / build

'Variant' is obsolete: 'Variant will be removed. Use the VariantValue type instead.'
=> WriteArrayOfT(value);

public void WriteArray(IEnumerable<Variant> value)

Check warning on line 119 in src/Tmds.DBus.Protocol/MessageWriter.Array.cs

View workflow job for this annotation

GitHub Actions / build

'Variant' is obsolete: 'Variant will be removed. Use the VariantValue type instead.'
=> WriteArrayOfT(value);

public void WriteArray(SafeHandle[] value)
Expand Down
15 changes: 15 additions & 0 deletions src/Tmds.DBus.Protocol/MessageWriter.Dictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@ public void WriteDictionaryEnd(ArrayStart start)
public void WriteDictionaryEntryStart()
=> WriteStructureStart();

// Write method for the common 'a{sv}' type.
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026")] // It's safe to call WriteDictionary with these types.
public void WriteDictionary(IEnumerable<KeyValuePair<string, VariantValue>> value)
=> WriteDictionary<string, VariantValue>(value);

// Write method for the common 'a{sv}' type.
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026")] // It's safe to call WriteDictionary with these types.
public void WriteDictionary(KeyValuePair<string, VariantValue>[] value)
=> WriteDictionary<string, VariantValue>(value);

// Write method for the common 'a{sv}' type.
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026")] // It's safe to call WriteDictionary with these types.
public void WriteDictionary(Dictionary<string, VariantValue> value)
=> WriteDictionary<string, VariantValue>(value);

// Write method for the common 'a{sv}' type.
[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026")] // It's safe to call WriteDictionary with these types.
public void WriteDictionary(IEnumerable<KeyValuePair<string, Variant>> value)
Expand Down
Loading