Option IOptionComplexFactory.CreateInstance(byte[] buffer, ref int offset, byte valueLength)
 {
     if ((int)valueLength != 16)
     {
         return((Option)null);
     }
     return((Option) new TcpOptionMd5Signature((IList <byte>)ByteArrayExtensions.ReadBytes(buffer, ref offset, 16)));
 }
 Option IOptionComplexFactory.CreateInstance(byte[] buffer, ref int offset, byte valueLength)
 {
     if ((int)valueLength < 0)
     {
         return((Option)null);
     }
     return((Option) new TcpOptionAlternateChecksumData((IList <byte>)ByteArrayExtensions.ReadBytes(buffer, ref offset, (int)valueLength)));
 }
 public Option CreateInstance(TcpOptionType optionType, byte[] buffer, ref int offset, byte valueLength)
 {
     if ((int)valueLength < 0)
     {
         return((Option)null);
     }
     byte[] numArray = ByteArrayExtensions.ReadBytes(buffer, ref offset, (int)valueLength);
     return((Option) new TcpOptionUnknown(optionType, (IList <byte>)numArray));
 }
예제 #4
0
        Option IOptionComplexFactory.CreateInstance(byte[] buffer, ref int offset, byte valueLength)
        {
            if ((int)valueLength < 2 || (int)valueLength > 3)
            {
                return((Option)null);
            }
            TcpOptionMoodEmotion emotion = TcpOptionMood.StringToEmotion(Encoding.ASCII.GetString(ByteArrayExtensions.ReadBytes(buffer, ref offset, (int)valueLength)));

            if (emotion == TcpOptionMoodEmotion.None)
            {
                return((Option)null);
            }
            return((Option) new TcpOptionMood(emotion));
        }