HavenDV / H.Pipes

A simple, easy to use, strongly-typed, async wrapper around .NET named pipes.
MIT License
219 stars 26 forks source link

Non-generic pipes #19

Open alexis- opened 2 years ago

alexis- commented 2 years ago

Hello!

As discussed:

alexis- commented 2 years ago

https://github.com/HavenDV/H.Pipes/issues/18

alexis- commented 2 years ago

P.S. static lambdas won't work here because they're using variables from the outer scope

HavenDV commented 2 years ago

In any case, thank you for the changes. Give me a few days to delve into them in detail and think through possible problems.

HavenDV commented 2 years ago

In fact, an amazing amount of work has been done. Thank you for that. In some moments of implementation, I see omissions. To speed up the process, I'll just change it, and in the future we can discuss the changes, if suddenly I made a mistake in something.

HavenDV commented 2 years ago

As for function parameters - they are aligned well, but I'm not sure if that's practical, as long as there is no automatic option to align that. Perhaps you know of something that automates this?

alexis- commented 2 years ago

In some moments of implementation, I see omissions. To speed up the process, I'll just change it, and in the future we can discuss the changes, if suddenly I made a mistake in something.

Sounds good. :)

As for function parameters - they are aligned well, but I'm not sure if that's practical, as long as there is no automatic option to align that. Perhaps you know of something that automates this?

Ah yes, that's a good point. I'm using Resharper which does almost all the formatting for me. It has become an automatism, and even though I tried to adhere to the coding style in the project, I didn't realize parameter alignment would be awkward. I trust your judgement, so please do what you think is best!

HavenDV commented 2 years ago

Ah yes, that's a good point. I'm using Resharper which does almost all the formatting for me. It has become an automatism, and even though I tried to adhere to the coding style in the project, I didn't realize parameter alignment would be awkward. I trust your judgement, so please do what you think is best!

Oh, after I started working on large projects, using ReSharper became painful (it really slows down the IDE on large projects). Gotta give it another chance :)

alexis- commented 2 years ago

Hello Konstantin! :)

I have made a minor addition that I would like to submit. It simply consists of overloads to the WriteAsync methods which accept offset and length parameters.

This is very useful for optimizing memory allocation and buffer usages, and will align H.Pipes with the API surface of most networking libraries.

I have added some test code and also made some minor improvement to the documentation.

Should I push those changes on this PR?

Cheers, Alexis

alexis- commented 2 years ago

I have pushed the changes in a separate branch if you wish to check it out! It is based on this very branch.

See commit: https://github.com/alexis-/H.Pipes/commit/0f3dbbd30949aa19c4a0f8223a68f68223b23780