Rickedb / OpenProtocolInterpreter

Converts the ugly ASCII package that came from Open Protocol to an object
MIT License
144 stars 72 forks source link

Mid0033.Pack() throws an exception, if revision > 1 #70

Closed IngeRuppio closed 2 years ago

IngeRuppio commented 3 years ago

If I try to use revision 2 (or 3 or 4), Mid0033.Pack() throws an exception:

System.Collections.Generic.KeyNotFoundException: The given key '2' was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at OpenProtocolInterpreter.Mid.BuildHeader() in ...\src\OpenProtocolInterpreter\MID.cs:line 45
   at OpenProtocolInterpreter.Mid.Pack() in ...\src\OpenProtocolInterpreter\MID.cs:line 56
   at OpenProtocolInterpreter.Job.Mid0033.Pack() in ...\src\OpenProtocolInterpreter\Job\Mid0033.cs:line 148

The reason seems to be: RegisterDatafields() only has definitions for revision 1.

By the way, I do not understand this part of the open protocol documentation: in revision 2, the Job list starts at index 92-93, but with revision 3 (and 4), it is documented to start at 94-95. Why and how should this work?