Hark Dand
[SOLVED] .NET runtime control over tty input and output
Turns out: The code does work. I just had a major flaw my approach of testing this...
Changing the
Console.Readkey(true);
to a while(true) { Console.Readkey(true); }
works a lot better. CTRL+C
, of course, is a keystroke, and will end the running program... not because the interrupt gets processed, but because the program ends after a single key press...11 replies
[SOLVED] .NET runtime control over tty input and output
I have this minimal example:
I use
cfmakeraw
here for ease of use; It disables the ISIG
flag which is responsible for processing the CTRL+C
keybind. However, this still cancels on CTRL+C
, which it should not.11 replies
[SOLVED] .NET runtime control over tty input and output
I would agree with this if it weren't for the fact that the same approach (calling the same functions from
termios
) works as expected when using C. Additionally, setting Console.TreatControlCAsInput
to true
does disable CTRL+C. That leads me to the assumption that this would not be something the OS is responsible for but rather the .NET runtime11 replies
✅ Indexer return collection or single object depending on parameter
I found an example of what I am trying to do: https://ironsoftware.com/csharp/excel/examples/read-excel/
44 replies
✅ Indexer return collection or single object depending on parameter
Yes, that would solve the problem. @Sterbehilfe already proposed that. But using the indexer for ranges would then look look like this
someClass[“A1“, “A11“]
Instead of
someClass[“A1:A11“]
44 replies
✅ Indexer return collection or single object depending on parameter
Okay, had a quick look at
Range
. It seems like Range
s won't be the solution either. Their constructor is Range(Index, Index)
, and the Index
constructor is Index(int value, bool fromEnd = false)
, which I wouldn't be able to properly use as my data structure is more like a Dictionary
. I could, of course, introduce some sort of ordering on the Dictionary
, but the Range
"operator" (e.g. [1..3]) still isn't what I'm searching for.44 replies
✅ Indexer return collection or single object depending on parameter
Yes, that would be the solution @Sterbehilfe proposed, that would surely work.
I'll have a look into ranges. Never used them before, so I can't for sure say whether or not they work for my use case. Thanks for the suggestions, though!
44 replies
✅ Indexer return collection or single object depending on parameter
Yeah, I thought about doing that. That would probably work (and I considered that option, maybe should've included that), but partially just out of interest I would really like to know if it would be possible with my proposition.
44 replies
✅ Set up SpecFlow Logging with 2 different projects
The following did the trick:
1. Add the SpecFlow NuGet package with the same version I had in
Project.Specs
to Project
.
2. From there, put a reference into the class which needs to use the logger
3. Assign the logger in test methods
Need to find out how to automatically set the logger via the SpecFlow hooks in Project.Specs
, but that's a question for another day. Thank you for your help!9 replies