Пример #1
0
 public abstract ANumber Sub(ANumber a);
Пример #2
0
 public abstract ANumber Div(ANumber a);
Пример #3
0
 public abstract ANumber Add(ANumber a);
Пример #4
0
 public abstract ANumber Mul(ANumber a);
Пример #5
0
        protected override void Decode(ByteList bytes)
        {
            Log.Debug("Decode a NewGameMessage");

            if (bytes == null || !bytes.IsMore)
            {
                return;
            }
            Log.Debug("Try to get the A#");
            if (bytes.PeekShort() < 0 && bytes.PeekShort() > 24)
            {
                Log.Warn($"The length of the encoded A#, {bytes.PeekShort()}, is probably not correct.  Check how you are encoding the string's length");
            }

            ANumber = bytes.GetString();
            Log.Debug($"Decoded A# = {ANumber}"); if (string.IsNullOrWhiteSpace(ANumber) || !ANumber.StartsWith("A"))
            {
                Log.Warn($"The ANumber doesn't start with an A, and therefore may not be encoded correctly");
            }


            if (!bytes.IsMore)
            {
                return;
            }
            Log.Debug("Try to get the LastName");
            if (bytes.PeekShort() < 0 && bytes.PeekShort() > 48)
            {
                Log.Warn($"The length of the encoded LastName, {bytes.PeekShort()}, is probably not correct.  Check how you are encoding the string's length");
            }
            LastName = bytes.GetString();
            Log.Debug($"Decoded LastName = {LastName}");

            if (!bytes.IsMore)
            {
                return;
            }
            Log.Debug("Try to get the FirstName");
            if (bytes.PeekShort() < 0 && bytes.PeekShort() > 48)
            {
                Log.Warn($"The length of the encoded FirstName, {bytes.PeekShort()}, is probably not correct.  Check how you are encoding the string's length");
            }
            FirstName = bytes.GetString();
            Log.Debug($"Decoded FirstName = {FirstName}");

            if (!bytes.IsMore)
            {
                return;
            }
            Log.Debug("Try to get the Alias");
            if (bytes.PeekShort() < 0 && bytes.PeekShort() > 48)
            {
                Log.Warn($"The length of the encoded Alias, {bytes.PeekShort()}, is probably not correct.  Check how you are encoding the string's length");
            }
            Alias = bytes.GetString();
            Log.Debug($"Decoded Alias = {Alias}");
        }