converting OTG project to C#

incomplete, more to come later.  then optimizations and refactoring.