hhblaze / Biser

Biser is a cross-platform Binary and JSON Serializer for .NET / dotnet / core / standard / CoreRT / Mono WASM / C#

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Initialization template for the object decoding static function has changed in v.1.7

hhblaze opened this issue · comments

commented

Binary Biser decoding became faster starting from v1.7, but for that objects decoding initialization template must be changed - compiler will show errors in those parts.

Example:

 public static T4 BiserDecode(byte[] enc = null, Biser.Decoder extDecoder = null) 
        {
            Biser.Decoder decoder = null;
            if (extDecoder == null)
            {
                if (enc == null || enc.Length == 0)
                    return null;
                decoder = new Biser.Decoder(enc);
                if (decoder.CheckNull())
                    return null;
            }
            else
            {
/************************ MUST BE LIKE THIS **************************/
//STARTING FROM v1.7, init template has changed
                  if (extDecoder.CheckNull())
                    return null;
                else
                    decoder = extDecoder;
/************************************************************************/
            }

            T4m = new T4();  

            m.Data = decoder.GetByteArray();
            m.Id = decoder.GetULong();
            
            return m;
        }
commented

Objects autogenerator is released https://www.nuget.org/packages/BiserObjectify/ is released.