Skip to content
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: 0 additions & 9 deletions src/Tmds.DBus.Protocol/Array.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

namespace Tmds.DBus.Protocol;

// Using obsolete generic write members
#pragma warning disable CS0618

public sealed class Array<T> : IDBusWritable, IList<T>, IVariantValueConvertable
where T : notnull
{
Expand Down Expand Up @@ -89,12 +86,6 @@ public bool Remove(T item)
return _values.Remove(item);
}

public Variant AsVariant()
=> Variant.FromArray(this);

public static implicit operator Variant(Array<T> value)
=> value.AsVariant();

public static implicit operator VariantValue(Array<T> value)
=> value.AsVariantValue();

Expand Down
4 changes: 0 additions & 4 deletions src/Tmds.DBus.Protocol/Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,6 @@ private void RefHandles(MessageBuffer message)
message.RefHandles();
}

[Obsolete("Use an overload that accepts ObserverFlags.")]
public ValueTask<IDisposable> AddMatchAsync<T>(MatchRule rule, MessageValueReader<T> reader, Action<Exception?, T, object?, object?> handler, object? readerState = null, object? handlerState = null, bool emitOnCapturedContext = true, bool subscribe = true)
=> AddMatchAsync(rule, reader, handler, readerState, handlerState, emitOnCapturedContext, ObserverFlags.EmitOnDispose | (!subscribe ? ObserverFlags.NoSubscribe : default));

public ValueTask<IDisposable> AddMatchAsync<T>(MatchRule rule, MessageValueReader<T> reader, Action<Exception?, T, object?, object?> handler, ObserverFlags flags, object? readerState = null, object? handlerState = null, bool emitOnCapturedContext = true)
=> AddMatchAsync(rule, reader, handler, readerState, handlerState, emitOnCapturedContext, flags);

Expand Down
8 changes: 0 additions & 8 deletions src/Tmds.DBus.Protocol/Dict.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

namespace Tmds.DBus.Protocol;

// Using obsolete generic write members
#pragma warning disable CS0618

public sealed class Dict<TKey, TValue> : IDBusWritable, IDictionary<TKey, TValue>, IVariantValueConvertable
where TKey : notnull
where TValue : notnull
Expand All @@ -26,11 +23,6 @@ private Dict(Dictionary<TKey, TValue> value)
_dict = value;
}

public Variant AsVariant() => Variant.FromDict(this);

public static implicit operator Variant(Dict<TKey, TValue> value)
=> value.AsVariant();

[UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026")] // this is a supported variant type.
void IDBusWritable.WriteTo(ref MessageWriter writer)
=> writer.WriteDictionary<TKey, TValue>(_dict);
Expand Down
9 changes: 0 additions & 9 deletions src/Tmds.DBus.Protocol/MessageWriter.Array.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,6 @@ public void WriteArray(ReadOnlySpan<VariantValue> value)
public void WriteArray(IEnumerable<VariantValue> value)
=> WriteArrayOfT(value);

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

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

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

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

Expand Down
18 changes: 0 additions & 18 deletions src/Tmds.DBus.Protocol/MessageWriter.Dictionary.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
namespace Tmds.DBus.Protocol;

// Using obsolete generic write members
#pragma warning disable CS0618

public ref partial struct MessageWriter
{
public ArrayStart WriteDictionaryStart()
Expand All @@ -29,21 +26,6 @@ public void WriteDictionary(KeyValuePair<string, VariantValue>[] value)
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)
=> WriteDictionary<string, Variant>(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, Variant>[] value)
=> WriteDictionary<string, Variant>(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, Variant> value)
=> WriteDictionary<string, Variant>(value);

private void WriteDictionary<TKey, TValue>(IEnumerable<KeyValuePair<TKey, TValue>> value)
where TKey : notnull
where TValue : notnull
Expand Down
5 changes: 0 additions & 5 deletions src/Tmds.DBus.Protocol/MessageWriter.Variant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ namespace Tmds.DBus.Protocol;

public ref partial struct MessageWriter
{
public void WriteVariant(Variant value)
{
value.WriteTo(ref this);
}

public void WriteVariant(VariantValue value)
{
value.WriteVariantTo(ref this);
Expand Down
4 changes: 0 additions & 4 deletions src/Tmds.DBus.Protocol/MessageWriter.WriteT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ internal void Write<T>(T value) where T : notnull
{
WriteSignature(((Signature)(object)value));
}
else if (typeof(T) == typeof(Variant))
{
((Variant)(object)value).WriteTo(ref this);
}
else if (typeof(T) == typeof(VariantValue))
{
((VariantValue)(object)value).WriteVariantTo(ref this);
Expand Down
2 changes: 0 additions & 2 deletions src/Tmds.DBus.Protocol/ObjectPath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,4 @@ private void ThrowEmptyException()
public static implicit operator string(ObjectPath value) => value._value;

public static implicit operator ObjectPath(string value) => new ObjectPath(value);

public Variant AsVariant() => new Variant(this);
}
4 changes: 0 additions & 4 deletions src/Tmds.DBus.Protocol/Reader.Dictionary.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
namespace Tmds.DBus.Protocol;


// Using obsolete generic read members
#pragma warning disable CS0618

public ref partial struct Reader
{
public ArrayEnd ReadDictionaryStart()
Expand Down
6 changes: 0 additions & 6 deletions src/Tmds.DBus.Protocol/Signature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ public readonly struct Signature

internal byte[] Data => _value ?? Array.Empty<byte>();

[Obsolete("Use the constructor that accepts a ReadOnlySpan.")]
public Signature(string value)
=> _value = Encoding.UTF8.GetBytes(value);

public Signature(ReadOnlySpan<byte> value)
=> _value = value.ToArray();

Expand All @@ -34,6 +30,4 @@ public override string ToString()

public static implicit operator Signature(ReadOnlySpan<byte> value)
=> new Signature(value);

public Variant AsVariant() => new Variant(this);
}
63 changes: 0 additions & 63 deletions src/Tmds.DBus.Protocol/Struct.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
namespace Tmds.DBus.Protocol;

// Using obsolete generic write members
#pragma warning disable CS0618

public static class Struct
{
public static Struct<T1> Create<T1>(T1 item1)
Expand Down Expand Up @@ -109,12 +106,6 @@ void IDBusWritable.WriteTo(ref MessageWriter writer)
private ValueTuple<T1> ToValueTuple()
=> new ValueTuple<T1>(Item1);

public Variant AsVariant()
=> Variant.FromStruct(this);

public static implicit operator Variant(Struct<T1> value)
=> value.AsVariant();

public static implicit operator VariantValue(Struct<T1> value)
=> value.AsVariantValue();

Expand Down Expand Up @@ -149,12 +140,6 @@ void IDBusWritable.WriteTo(ref MessageWriter writer)
private (T1, T2) ToValueTuple()
=> (Item1, Item2);

public Variant AsVariant()
=> Variant.FromStruct(this);

public static implicit operator Variant(Struct<T1, T2> value)
=> value.AsVariant();

public static implicit operator VariantValue(Struct<T1, T2> value)
=> value.AsVariantValue();

Expand Down Expand Up @@ -192,12 +177,6 @@ void IDBusWritable.WriteTo(ref MessageWriter writer)
private (T1, T2, T3) ToValueTuple()
=> (Item1, Item2, Item3);

public Variant AsVariant()
=> Variant.FromStruct(this);

public static implicit operator Variant(Struct<T1, T2, T3> value)
=> value.AsVariant();

public static implicit operator VariantValue(Struct<T1, T2, T3> value)
=> value.AsVariantValue();

Expand Down Expand Up @@ -239,12 +218,6 @@ void IDBusWritable.WriteTo(ref MessageWriter writer)
private (T1, T2, T3, T4) ToValueTuple()
=> (Item1, Item2, Item3, Item4);

public Variant AsVariant()
=> Variant.FromStruct(this);

public static implicit operator Variant(Struct<T1, T2, T3, T4> value)
=> value.AsVariant();

public static implicit operator VariantValue(Struct<T1, T2, T3, T4> value)
=> value.AsVariantValue();

Expand Down Expand Up @@ -290,12 +263,6 @@ void IDBusWritable.WriteTo(ref MessageWriter writer)
private (T1, T2, T3, T4, T5) ToValueTuple()
=> (Item1, Item2, Item3, Item4, Item5);

public Variant AsVariant()
=> Variant.FromStruct(this);

public static implicit operator Variant(Struct<T1, T2, T3, T4, T5> value)
=> value.AsVariant();

public static implicit operator VariantValue(Struct<T1, T2, T3, T4, T5> value)
=> value.AsVariantValue();

Expand Down Expand Up @@ -345,12 +312,6 @@ void IDBusWritable.WriteTo(ref MessageWriter writer)
private (T1, T2, T3, T4, T5, T6) ToValueTuple()
=> (Item1, Item2, Item3, Item4, Item5, Item6);

public Variant AsVariant()
=> Variant.FromStruct(this);

public static implicit operator Variant(Struct<T1, T2, T3, T4, T5, T6> value)
=> value.AsVariant();

public static implicit operator VariantValue(Struct<T1, T2, T3, T4, T5, T6> value)
=> value.AsVariantValue();

Expand Down Expand Up @@ -404,12 +365,6 @@ void IDBusWritable.WriteTo(ref MessageWriter writer)
private (T1, T2, T3, T4, T5, T6, T7) ToValueTuple()
=> (Item1, Item2, Item3, Item4, Item5, Item6, Item7);

public Variant AsVariant()
=> Variant.FromStruct(this);

public static implicit operator Variant(Struct<T1, T2, T3, T4, T5, T6, T7> value)
=> value.AsVariant();

public static implicit operator VariantValue(Struct<T1, T2, T3, T4, T5, T6, T7> value)
=> value.AsVariantValue();

Expand Down Expand Up @@ -467,12 +422,6 @@ void IDBusWritable.WriteTo(ref MessageWriter writer)
private (T1, T2, T3, T4, T5, T6, T7, T8) ToValueTuple()
=> (Item1, Item2, Item3, Item4, Item5, Item6, Item7, Item8);

public Variant AsVariant()
=> Variant.FromStruct(this);

public static implicit operator Variant(Struct<T1, T2, T3, T4, T5, T6, T7, T8> value)
=> value.AsVariant();

public static implicit operator VariantValue(Struct<T1, T2, T3, T4, T5, T6, T7, T8> value)
=> value.AsVariantValue();

Expand Down Expand Up @@ -534,12 +483,6 @@ void IDBusWritable.WriteTo(ref MessageWriter writer)
private (T1, T2, T3, T4, T5, T6, T7, T8, T9) ToValueTuple()
=> (Item1, Item2, Item3, Item4, Item5, Item6, Item7, Item8, Item9);

public Variant AsVariant()
=> Variant.FromStruct(this);

public static implicit operator Variant(Struct<T1, T2, T3, T4, T5, T6, T7, T8, T9> value)
=> value.AsVariant();

public static implicit operator VariantValue(Struct<T1, T2, T3, T4, T5, T6, T7, T8, T9> value)
=> value.AsVariantValue();

Expand Down Expand Up @@ -605,12 +548,6 @@ void IDBusWritable.WriteTo(ref MessageWriter writer)
private (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) ToValueTuple()
=> (Item1, Item2, Item3, Item4, Item5, Item6, Item7, Item8, Item9, Item10);

public Variant AsVariant()
=> Variant.FromStruct(this);

public static implicit operator Variant(Struct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> value)
=> value.AsVariant();

public static implicit operator VariantValue(Struct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> value)
=> value.AsVariantValue();

Expand Down
13 changes: 0 additions & 13 deletions src/Tmds.DBus.Protocol/TypeModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ public static DBusType GetTypeAlignment<T>()
{
return DBusType.Signature;
}
else if (typeof(T) == typeof(Variant))
{
return DBusType.Variant;
}
else if (typeof(T) == typeof(VariantValue))
{
return DBusType.Variant;
Expand Down Expand Up @@ -123,8 +119,6 @@ public static void EnsureSupportedVariantType<T>()
{ }
else if (typeof(T) == typeof(Signature))
{ }
else if (typeof(T) == typeof(Variant))
{ }
else if (typeof(T) == typeof(VariantValue))
{ }
else if (typeof(T).IsConstructedGenericType)
Expand Down Expand Up @@ -187,8 +181,6 @@ private static void EnsureSupportedVariantType(Type type)
{ }
else if (type == typeof(Signature))
{ }
else if (type == typeof(Variant))
{ }
else if (type == typeof(VariantValue))
{ }
else if (type.IsConstructedGenericType)
Expand Down Expand Up @@ -296,11 +288,6 @@ private static int AppendTypeSignature(Type type, Span<byte> signature)
signature[0] = (byte)DBusType.Signature;
return 1;
}
else if (type == typeof(Variant))
{
signature[0] = (byte)DBusType.Variant;
return 1;
}
else if (type == typeof(VariantValue))
{
signature[0] = (byte)DBusType.Variant;
Expand Down
Loading