Skip to content

Commit

Permalink
Protocol: make some members non-public.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmds committed Mar 13, 2024
1 parent 8efb8d2 commit f1a2a4d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
26 changes: 13 additions & 13 deletions docs/protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,19 +210,6 @@ Note: this example shows how to writing an array of strings. There is a `WriteAr

### Reading a dictionary

```cs
ArrayStart arrayStart = writer.WriteDictionaryStart();
foreach (var item in value)
{
writer.WriteDictionaryEntryStart();
writer.Write... // write the key
writer.Write... // write the value
}
writer.WriteDictionaryEnd(arrayStart);
```

### Reading a dictionary

```cs
Dictionary<byte, string> dictionary = new();
ArrayEnd dictEnd = reader.ReadDictionaryStart();
Expand All @@ -234,6 +221,19 @@ while (reader.HasNext(dictEnd))
}
```

### Writing a dictionary

```cs
ArrayStart arrayStart = writer.WriteDictionaryStart();
foreach (var item in value)
{
writer.WriteDictionaryEntryStart();
writer.Write... // write the key
writer.Write... // write the value
}
writer.WriteDictionaryEnd(arrayStart);
```

### Reading a struct

To read a struct call `AlignStruct` and then read the struct fields.
Expand Down
4 changes: 1 addition & 3 deletions src/Tmds.DBus.Protocol/MessageWriter.Array.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@ public void WriteArray<T>(IEnumerable<T> value)
WriteArrayEnd(arrayStart);
}

[RequiresUnreferencedCode(Strings.UseNonGenericWriteArray)]
[Obsolete(Strings.UseNonGenericWriteArrayObsolete)]
public void WriteArray<T>(ReadOnlySpan<T> value)
internal void WriteArray<T>(ReadOnlySpan<T> value)
where T : notnull
{
#if NET || NETSTANDARD2_1_OR_GREATER
Expand Down
2 changes: 1 addition & 1 deletion src/Tmds.DBus.Protocol/Reader.Array.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public VariantValue[] ReadArrayOfVariantValue()
return items.ToArray();
}

public unsafe T[] ReadArrayOfNumeric<T>() where T : unmanaged
private unsafe T[] ReadArrayOfNumeric<T>() where T : unmanaged
{
int length = ReadInt32();
if (sizeof(T) > 4)
Expand Down

0 comments on commit f1a2a4d

Please sign in to comment.