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

feat(infra): abstract over WASAPI COM interfaces #241

Merged
merged 8 commits into from
Feb 13, 2023

Conversation

AreamanM
Copy link
Contributor

@AreamanM AreamanM commented Feb 4, 2023

No description provided.

@lars-berger
Copy link
Collaborator

I took a quick look over at cswin32 to see if it could help us replace the WindowsApiService stuff. There were a few things that weren't all that great:

  • We'd have to switch over a lot of types. Eg. window handles are no longer IntPtr, instead they're winmdroot.Foundation.HWND. Afaik we'd have to literally switch over every IntPtr handle to their corresponding cswin32 type.
    image

  • Although the generated comments for functions are better than what we've currently got, Vanara's seem to be way better.

  • It's easier to switch to Vanara vs cswin32 (no NativeMethods.txt and types should be consistent). cswin32 is also more likely to change their APIs as it matures.

Vanara's wrapper over the CoreAudio apis was released literally yesterday, so it's pretty perfect timing for us. I'm personally in favour of Vanara vs cswin32 or dotnet/pinvoke (similar to Vanara, but doesn't have CoreAudio wrappers).

If we do go ahead and switch, would SystemVolumeInformation.cs be simplified any further, or would it only affect WindowsApiService?

@lars-berger
Copy link
Collaborator

Started a branch on refactor/replace-windows-api-pinvokes-with-vanara. Only installed the vanara sub packages so far

@AreamanM
Copy link
Contributor Author

AreamanM commented Feb 7, 2023

I think Vanara is definitely the way to go, I'll merge with refactor/replace-windows-api-pinvokes-with-vanara and migrate as much of the WASAPI stuff as I can, and as for your question about SystemVolumeInformation.cs, it won't be simplified further unfortunately.

Is the structure of SystemVolumeInformation.cs fine? I'll move some classes out of the file and make the event handler part more clear, but other than that, are there any general structure changes you would suggest?

@HolbyFPV
Copy link
Collaborator

HolbyFPV commented Feb 8, 2023

Another big positive of going with Vanara is the code coverage is really good. You can find the unit test for any function your interested in and get a working example with all the structs and params that are needed. Saved me a lot of time working with the networking APIs.

@lars-berger lars-berger marked this pull request as ready for review February 13, 2023 03:34
@lars-berger lars-berger merged commit c7069be into glzr-io:master Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants