Reading the state of a pin in C#