Extract out parsing proto file logic from ProtobufGen

truncated into one message