mirror of https://github.com/dahall/Vanara.git
Added PROPERTYKEY.ctor(string) and CoerceToCanonicalValue
parent
26f0235bb7
commit
33924ea0ff
|
@ -85,6 +85,14 @@ public static partial class Ole32
|
||||||
pid = id;
|
pid = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Initializes a new instance of the <see cref="PROPERTYKEY"/> struct using a canonical property name.</summary>
|
||||||
|
/// <param name="canonicalName">Name of the canonical.</param>
|
||||||
|
public PROPERTYKEY(string canonicalName)
|
||||||
|
{
|
||||||
|
PropSys.PSGetPropertyKeyFromName(canonicalName, out var pk).ThrowIfFailed();
|
||||||
|
this = pk;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>A unique GUID for the property.</summary>
|
/// <summary>A unique GUID for the property.</summary>
|
||||||
public readonly Guid Key => fmtid;
|
public readonly Guid Key => fmtid;
|
||||||
|
|
||||||
|
@ -100,6 +108,13 @@ public static partial class Ole32
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override string ToString() => GetCanonicalName() ?? ReverseLookup(this) ?? $"{Key:B} {Id}";
|
public override string ToString() => GetCanonicalName() ?? ReverseLookup(this) ?? $"{Key:B} {Id}";
|
||||||
|
|
||||||
|
/// <summary>Converts the value to the canonical value, according to the property description.</summary>
|
||||||
|
/// <param name="value">
|
||||||
|
/// On entry, contains a pointer to a PROPVARIANT structure that contains the original value. When this function returns
|
||||||
|
/// successfully, contains the canonical value.
|
||||||
|
/// </param>
|
||||||
|
public void CoerceToCanonicalValue(PROPVARIANT value) => PropSys.PSCoerceToCanonicalValue(this, value).ThrowIfFailed();
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override bool Equals(object? obj) => obj is PROPERTYKEY other && Equals(other);
|
public override bool Equals(object? obj) => obj is PROPERTYKEY other && Equals(other);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue