added a decoder, moved some stuff around

added a decoder for packets, moved the encoder to encode.cs and created
a seperate main.cs file for Main()