Пример #1
0
        public object reverse(byte[] send) // revser message from byte[]
        {
            switch (tag)
            {
            case 0:
                stringMessage s = new stringMessage();

                string result = s.decode(send);     // 1024 is buffer length
                receive = result;
                break;

            case 1:
                imageMessage im = new imageMessage();

                Image i = im.decode(send);
                receive = i;
                break;

            //case 2:
            //    Profile go here
            default:
                break;
            }
            return(receive);
        }
Пример #2
0
        public byte[] convert(object receiver) // convert from object to byte[]
        {
            switch (tag)
            {
            case 0:
                stringMessage s = new stringMessage();
                sender = s.encode((receiver as string));
                break;

            case 1:
                imageMessage i = new imageMessage();
                sender = i.encode(receiver as Image, (receiver as Image).RawFormat);
                break;

            //case 2:
            //    Profile go here
            default:
                break;
            }
            return(sender);
        }