Пример #1
0
        public static SamDestination ParseDestReply(SamReply reply)
        {
            if (reply == null)
            {
                throw new ArgumentNullException("reply");
            }
            if (!reply.Check("DEST", "REPLY"))
            {
                throw new SamReplyMismatchException(reply);
            }
            if (reply.ResultString != SamBridgeErrorMessage.OK)
            {
                throw new SamBridgeErrorException(reply);
            }

            string pubBase64  = reply.UniqueValue("PUB").Value;
            string privBase64 = reply.UniqueValue("PRIV").Value;

            return(new SamDestination(pubBase64, privBase64));
        }
Пример #2
0
        public static SamLookupResult ParseNamingReply(SamReply reply)
        {
            if (reply == null)
            {
                throw new ArgumentNullException("reply");
            }
            if (!reply.Check("NAMING", "REPLY"))
            {
                throw new SamReplyMismatchException(reply);
            }
            if (reply.ResultString != SamBridgeErrorMessage.OK)
            {
                throw new SamBridgeErrorException(reply);
            }

            string nameInReply = reply.UniqueValue("NAME").Value;
            string valueBase64 = reply.UniqueValue("VALUE").Value;

            return(new SamLookupResult(nameInReply, valueBase64));
        }
Пример #3
0
        public static string ParseSessionStatus(SamReply reply)
        {
            if (reply == null)
            {
                throw new ArgumentNullException("reply");
            }
            if (!reply.Check("SESSION", "STATUS"))
            {
                throw new SamReplyMismatchException(reply);
            }
            if (reply.ResultString != SamBridgeErrorMessage.OK)
            {
                throw new SamBridgeErrorException(reply);
            }

            string destination = reply.UniqueValue("DESTINATION").Value;

            return(destination);
        }
Пример #4
0
        public static string ParseHelloReply(SamReply reply)
        {
            if (reply == null)
            {
                throw new ArgumentNullException("reply");
            }
            if (!reply.Check("HELLO", "REPLY"))
            {
                throw new SamReplyMismatchException(reply);
            }
            if (reply.ResultString != SamBridgeErrorMessage.OK)
            {
                throw new SamBridgeErrorException(reply);
            }

            string version = reply.UniqueValue("VERSION").Value;

            return(version);
        }
Пример #5
0
        public static string ParseSessionStatus(SamReply reply)
        {
            if (reply == null)
                throw new ArgumentNullException("reply");
            if (!reply.Check("SESSION", "STATUS"))
                throw new SamReplyMismatchException(reply);
            if (reply.ResultString != SamBridgeErrorMessage.OK)
                throw new SamBridgeErrorException(reply);

            string destination = reply.UniqueValue("DESTINATION").Value;
            return destination;
        }
Пример #6
0
        public static SamLookupResult ParseNamingReply(SamReply reply)
        {
            if (reply == null)
                throw new ArgumentNullException("reply");
            if (!reply.Check("NAMING", "REPLY"))
                throw new SamReplyMismatchException(reply);
            if (reply.ResultString != SamBridgeErrorMessage.OK)
                throw new SamBridgeErrorException(reply);

            string nameInReply = reply.UniqueValue("NAME").Value;
            string valueBase64 = reply.UniqueValue("VALUE").Value;
            return new SamLookupResult(nameInReply, valueBase64);
        }
Пример #7
0
        public static string ParseHelloReply(SamReply reply)
        {
            if (reply == null)
                throw new ArgumentNullException("reply");
            if (!reply.Check("HELLO", "REPLY"))
                throw new SamReplyMismatchException(reply);
            if (reply.ResultString != SamBridgeErrorMessage.OK)
                throw new SamBridgeErrorException(reply);

            string version = reply.UniqueValue("VERSION").Value;
            return version;
        }
Пример #8
0
        public static SamDestination ParseDestReply(SamReply reply)
        {
            if (reply == null)
                throw new ArgumentNullException("reply");
            if (!reply.Check("DEST", "REPLY"))
                throw new SamReplyMismatchException(reply);
            if (reply.ResultString != SamBridgeErrorMessage.OK)
                throw new SamBridgeErrorException(reply);

            string pubBase64 = reply.UniqueValue("PUB").Value;
            string privBase64 = reply.UniqueValue("PRIV").Value;
            return new SamDestination(pubBase64, privBase64);
        }