Пример #1
0
 public void ToString(ProtocolOutput output, out string result)
 {
     result = "";
     if (output == ProtocolOutput.ExploreToScratch)
     {
         result = ToString();
     }
 }
Пример #2
0
 public static IProtocol Generate(ProtocolOutput output, byte[] bytes, int offset, int length)
 {
     if (output == ProtocolOutput.ScratchToExplore)
     {
         return(ExploreProtocol.Create(ExploreProtocolDataType.DTInt, bytes, offset, length, false, "JSONProtocol"));
     }
     return(null);
 }
Пример #3
0
        public static TProtocol Generate <TProtocol>(ProtocolOutput output, byte[] bytes, int offset, int length) where TProtocol : IProtocol
        {
            var result = Generate(output, bytes, offset, length);

            if (result is TProtocol)
            {
                return((TProtocol)result);
            }
            return(default(TProtocol));
        }
Пример #4
0
        public void ToBytes(ProtocolOutput output, out bool encryption, out byte[] bytes)
        {
            encryption = false;
            bytes      = null;

            if (output == ProtocolOutput.ExploreToScratch)
            {
                var json = ToString();
                bytes = Encoding.UTF8.GetBytes(json);
            }
        }