Skip to content

Commit

Permalink
Fixed a bunch of build errors related to missing XMl docs and nullabi…
Browse files Browse the repository at this point in the history
…lity
  • Loading branch information
dahall committed Feb 4, 2023
1 parent c34a711 commit 98aba00
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Net/DistributedRoutingTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,13 @@ private static void DrtEventCallback(IntPtr Param, bool TimedOut)
switch (pEventData.Value.type)
{
case DRT_EVENT_TYPE.DRT_EVENT_STATUS_CHANGED:
Drt.StatusChange?.Invoke(Drt, new(pEventData.Value));
Drt?.StatusChange?.Invoke(Drt, new(pEventData.Value));
break;
case DRT_EVENT_TYPE.DRT_EVENT_LEAFSET_KEY_CHANGED:
Drt.LeafSetKeyChange?.Invoke(Drt, new(pEventData.Value));
Drt?.LeafSetKeyChange?.Invoke(Drt, new(pEventData.Value));
break;
case DRT_EVENT_TYPE.DRT_EVENT_REGISTRATION_STATE_CHANGED:
Drt.RegistrationStateChange?.Invoke(Drt, new(pEventData.Value));
Drt?.RegistrationStateChange?.Invoke(Drt, new(pEventData.Value));
break;
}
}
Expand Down
9 changes: 9 additions & 0 deletions PInvoke/CoreAudio/AudioClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ public static partial class CoreAudio
/// <summary>Undocumented</summary>
public const uint AMBISONICS_PARAM_VERSION_1 = 1;

/// <summary/>
public const uint WM_APP_GRAPHNOTIFY = 0x8002;
/// <summary/>
public const uint WM_APP_SESSION_DUCKED = 0x8000;
/// <summary/>
public const uint WM_APP_SESSION_UNDUCKED = 0x8001;
/// <summary/>
public const uint WM_APP_SESSION_VOLUME_CHANGED = 0x8003;

/// <summary>Undocumented</summary>
Expand Down Expand Up @@ -151,20 +155,25 @@ public interface IAcousticEchoCancellationControl
HRESULT SetEchoCancellationRenderEndpoint([MarshalAs(UnmanagedType.LPWStr)] string endpointId);
}

/// <summary>Undocumented</summary>
[PInvokeData("audioclient.h")]
[ComImport, Guid("28724C91-DF35-4856-9F76-D6A26413F3DF"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IAudioAmbisonicsControl
{
/// <summary>Undocumented</summary>
[PreserveSig]
HRESULT SetData([In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] AMBISONICS_PARAMS[] pAmbisonicsParams,
uint cbAmbisonicsParams);

/// <summary>Undocumented</summary>
[PreserveSig]
HRESULT SetHeadTracking([MarshalAs(UnmanagedType.Bool)] bool bEnableHeadTracking);

/// <summary>Undocumented</summary>
[PreserveSig]
HRESULT GetHeadTracking([MarshalAs(UnmanagedType.Bool)] out bool pbEnableHeadTracking);

/// <summary>Undocumented</summary>
[PreserveSig]
HRESULT SetRotation(float X, float Y, float Z, float W);
}
Expand Down
2 changes: 1 addition & 1 deletion PInvoke/Ole/Ole32/PropIdl.PROPVARIANT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ public static VARTYPE GetVarType(Type type)
return ret | VARTYPE.VT_HRESULT;
if (elemtype.IsCOMObject)
{
var intf = elemtype.GetInterfaces();
Type[] intf = elemtype.GetInterfaces();
if (intf.Contains(typeof(IStream))) return ret | VARTYPE.VT_STREAM;
if (intf.Contains(typeof(IStorage))) return ret | VARTYPE.VT_STORAGE;
return ret | VARTYPE.VT_UNKNOWN;
Expand Down
2 changes: 1 addition & 1 deletion PInvoke/User32/WindowBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ private IntPtr InternalWndProc(HWND hwnd, uint msg, IntPtr wParam, IntPtr lParam
catch (Exception ex)
{
if (!OnWndProcException(ex))
throw ex;
throw;
return IntPtr.Zero;
}
finally
Expand Down
2 changes: 1 addition & 1 deletion PInvoke/User32/WindowClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ protected virtual IntPtr PrimaryClassWndProc(HWND hwnd, uint msg, IntPtr wParam,
{
var cp = lParam.ToStructure<CREATESTRUCT>().lpCreateParams;
if (cp != IntPtr.Zero && GCHandle.FromIntPtr(cp).Target is IWindowInit wnd)
return wnd.InitWndProcOnNCCreate(hwnd, msg, Marshal.GetFunctionPointerForDelegate(wndProc), lParam);
return wnd.InitWndProcOnNCCreate(hwnd, msg, Marshal.GetFunctionPointerForDelegate(wndProc ?? throw new NullReferenceException()), lParam);
}
catch { }
}
Expand Down
16 changes: 10 additions & 6 deletions System/Network/WindowsFirewall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,9 @@ internal FirewallProfile(INetFwPolicy2 item, NET_FW_PROFILE_TYPE2 type)
/// </remarks>
public string[]? ExcludedInterfaces
{
#pragma warning disable CS8619 // Nullability of reference types in value doesn't match target type.
get => iPol.ExcludedInterfaces[type] is null ? null : (string[])Array.ConvertAll((object[])iPol.ExcludedInterfaces[type], o => o.ToString());
#pragma warning restore CS8619 // Nullability of reference types in value doesn't match target type.
set => iPol.ExcludedInterfaces[type] = value is null || value.Length == 0 ? null : Array.ConvertAll(value, s => (object)s);
}

Expand Down Expand Up @@ -624,7 +626,9 @@ public FirewallRule(string name, string? group, bool allow = true, bool @in = tr
/// </remarks>
public string[]? InterfaceNames
{
#pragma warning disable CS8619 // Nullability of reference types in value doesn't match target type.
get => iRule.Interfaces is null ? null : (string[])Array.ConvertAll((object[])iRule.Interfaces, o => o.ToString());
#pragma warning restore CS8619 // Nullability of reference types in value doesn't match target type.
set => iRule.Interfaces = value is null || value.Length == 0 ? null : Array.ConvertAll(value, s => (object)s);
}

Expand Down Expand Up @@ -868,12 +872,12 @@ public SecurityIdentifier? LocalUserOwner
private INetFwRule3 iRule3 => iRule as INetFwRule3 ?? throw new NotSupportedException();

/// <inheritdoc/>
public bool Equals(FirewallRule other) => Equals(other.Name, Name) &&
Equals(other.Profiles, Profiles) &&
Equals(other.Direction, Direction) &&
Equals(other.Enabled, Enabled) &&
Equals(other.Action, Action) &&
Equals(other.ApplicationName, ApplicationName);
public bool Equals(FirewallRule? other) => Equals(other?.Name, Name) &&
Equals(other?.Profiles, Profiles) &&
Equals(other?.Direction, Direction) &&
Equals(other?.Enabled, Enabled) &&
Equals(other?.Action, Action) &&
Equals(other?.ApplicationName, ApplicationName);
}

/// <summary>Represents the rules for the Windows Firewall.</summary>
Expand Down

0 comments on commit 98aba00

Please sign in to comment.