Exemple #1
0
        public void Write(BinaryFormatterWriter output)
        {
            output.WriteByte((byte)_binaryHeaderEnum);
            output.WriteInt32(_objectId);
            output.WriteString(_name);

            output.WriteInt32(_numMembers);
            for (int i = 0; i < _numMembers; i++)
            {
                output.WriteString(_memberNames[i]);
            }
            for (int i = 0; i < _numMembers; i++)
            {
                output.WriteByte((byte)_binaryTypeEnumA[i]);
            }
            for (int i = 0; i < _numMembers; i++)
            {
                BinaryTypeConverter.WriteTypeInfo(_binaryTypeEnumA[i], _typeInformationA[i], _memberAssemIds[i], output);
            }

            if (_assemId > 0)
            {
                output.WriteInt32(_assemId);
            }
        }
 public ChangePasswordsPage(Username myUsername, BinaryFormatterWriter writer, long sessionID)
 {
     InitializeComponent();
     this.myUsername = myUsername;
     this.writer     = writer;
     this.sessionID  = sessionID;
 }
        public void Write(BinaryFormatterWriter output)
        {
            output.WriteByte((byte)_binaryHeaderEnum);
            output.WriteInt32(_objectId);
            output.WriteString(_name);

            output.WriteInt32(_numMembers);
            for (int i = 0; i < _numMembers; i++)
            {
                output.WriteString(_memberNames[i]);
            }
            for (int i = 0; i < _numMembers; i++)
            {
                output.WriteByte((byte)_binaryTypeEnumA[i]);
            }
            for (int i = 0; i < _numMembers; i++)
            {
                BinaryTypeConverter.WriteTypeInfo(_binaryTypeEnumA[i], _typeInformationA[i], _memberAssemIds[i], output);
            }

            if (_assemId > 0)
            {
                output.WriteInt32(_assemId);
            }
        }
Exemple #4
0
 public SettingsPage(Username myUsername, BinaryFormatterWriter writer, long sessionID)
 {
     InitializeComponent();
     this.myUsername = myUsername;
     this.writer     = writer;
     SessionID       = sessionID;
 }
Exemple #5
0
        public NewSimpleChatPage(Username myUsername, BinaryFormatterWriter writer, long sessionID)
        {
            this.myUsername = myUsername;
            this.writer     = writer;
            this.sessionID  = sessionID;

            InitializeComponent();
        }
        public ChatMessageOptionsPage(BinaryFormatterWriter writer, Message msg, ChatType chatType, Username myUsername, long sessionID)
        {
            InitializeComponent();

            senderLabel.Text   = "Sent by: " + msg.SenderUsername.ToString();
            datetimeLabel.Text = "Delivered: " + msg.Datetime.ToString();

            this.writer     = writer;
            this.msg        = msg;
            this.chatType   = chatType;
            this.myUsername = myUsername;
            this.sessionID  = sessionID;
        }
Exemple #7
0
            internal ServerSession(TcpClient client, ChatServer server, long sessionID)
            {
                this.sessionID = sessionID;
                this.server    = server;
                this.client    = client;
                var bf     = new BinaryFormatter();
                var stream = client.GetStream();

                if (stream == null)
                {
                    throw new NullReferenceException();
                }
                br = new BinaryFormatterReader(bf, stream);
                bw = new BinaryFormatterWriter(bf, stream);
            }
Exemple #8
0
        public void Write(BinaryFormatterWriter output)
        {
            output.WriteByte((byte)_binaryHeaderEnum);
            output.WriteInt32(_objectId);
            output.WriteString(_name);

            output.WriteInt32(_numMembers);
            for (int i = 0; i < _numMembers; i++)
            {
                output.WriteString(_memberNames[i]);
            }

            if (_assemId > 0)
            {
                output.WriteInt32(_assemId);
            }
        }
        public void Write(BinaryFormatterWriter output)
        {
            output.WriteByte((byte)_binaryHeaderEnum);
            output.WriteInt32(_objectId);
            output.WriteString(_name);

            output.WriteInt32(_numMembers);
            for (int i = 0; i < _numMembers; i++)
            {
                output.WriteString(_memberNames[i]);
            }

            if (_assemId > 0)
            {
                output.WriteInt32(_assemId);
            }
        }
Exemple #10
0
        public ChatPage(App app, Username user, ChatInfo info, BinaryFormatterWriter writer, long sessionID)
        {
            if (info == null || writer == null)
            {
                throw new ArgumentNullException();
            }
            this.app        = app;
            this.myUsername = user;
            this.info       = info;
            this.writer     = writer;
            this.sessionID  = sessionID;

            InitializeComponent();
            messages         = info.GetMessages();
            listView         = list;
            list.ItemsSource = messages;
        }
Exemple #11
0
        public static TcpClient Connect(string hostname, int defaultPort, ref BinaryFormatterWriter writer, ref BinaryFormatterReader reader)
        {
            var client = new TcpClient(AddressFamily.InterNetwork);

            client.Connect(hostname, defaultPort);
            var stream = client.GetStream();

            if (stream == null)
            {
                throw new NullReferenceException();
            }
            var bf = new BinaryFormatter();

            writer = new BinaryFormatterWriter(bf, stream);
            reader = new BinaryFormatterReader(bf, stream);
            return(client);
        }
Exemple #12
0
 public void Write(BinaryFormatterWriter output)
 {
     if (_nullCount == 1)
     {
         output.WriteByte((byte)BinaryHeaderEnum.ObjectNull);
     }
     else if (_nullCount < 256)
     {
         output.WriteByte((byte)BinaryHeaderEnum.ObjectNullMultiple256);
         output.WriteByte((byte)_nullCount);
     }
     else
     {
         output.WriteByte((byte)BinaryHeaderEnum.ObjectNullMultiple);
         output.WriteInt32(_nullCount);
     }
 }
Exemple #13
0
        public void Write(BinaryFormatterWriter output)
        {
            switch (_binaryHeaderEnum)
            {
            case BinaryHeaderEnum.ArraySinglePrimitive:
                output.WriteByte((byte)_binaryHeaderEnum);
                output.WriteInt32(_objectId);
                output.WriteInt32(_lengthA[0]);
                output.WriteByte((byte)((InternalPrimitiveTypeE)_typeInformation));
                break;

            case BinaryHeaderEnum.ArraySingleString:
                output.WriteByte((byte)_binaryHeaderEnum);
                output.WriteInt32(_objectId);
                output.WriteInt32(_lengthA[0]);
                break;

            case BinaryHeaderEnum.ArraySingleObject:
                output.WriteByte((byte)_binaryHeaderEnum);
                output.WriteInt32(_objectId);
                output.WriteInt32(_lengthA[0]);
                break;

            default:
                output.WriteByte((byte)_binaryHeaderEnum);
                output.WriteInt32(_objectId);
                output.WriteByte((byte)_binaryArrayTypeEnum);
                output.WriteInt32(_rank);
                for (int i = 0; i < _rank; i++)
                {
                    output.WriteInt32(_lengthA[i]);
                }
                if ((_binaryArrayTypeEnum == BinaryArrayTypeEnum.SingleOffset) ||
                    (_binaryArrayTypeEnum == BinaryArrayTypeEnum.JaggedOffset) ||
                    (_binaryArrayTypeEnum == BinaryArrayTypeEnum.RectangularOffset))
                {
                    for (int i = 0; i < _rank; i++)
                    {
                        output.WriteInt32(_lowerBoundA[i]);
                    }
                }
                output.WriteByte((byte)_binaryTypeEnum);
                BinaryTypeConverter.WriteTypeInfo(_binaryTypeEnum, _typeInformation, _assemId, output);
                break;
            }
        }
Exemple #14
0
 public void Write(BinaryFormatterWriter output)
 {
     if (_nullCount == 1)
     {
         output.WriteByte((byte)BinaryHeaderEnum.ObjectNull);
     }
     else if (_nullCount < 256)
     {
         output.WriteByte((byte)BinaryHeaderEnum.ObjectNullMultiple256);
         output.WriteByte((byte)_nullCount);
     }
     else
     {
         output.WriteByte((byte)BinaryHeaderEnum.ObjectNullMultiple);
         output.WriteInt32(_nullCount);
     }
 }
        public NewGroupChatPage(Username myUsername, BinaryFormatterWriter writer, long sessionID)
        {
            this.myUsername = myUsername;
            this.writer     = writer;
            this.sessionID  = sessionID;

            collection.Add(new StringCell()
            {
                value = string.Empty
            });
            collection.Add(new StringCell()
            {
                value = string.Empty
            });

            InitializeComponent();
            list.ItemsSource = collection;
        }
Exemple #16
0
 public void Write(BinaryFormatterWriter output)
 {
     switch (_binaryHeaderEnum)
     {
         case BinaryHeaderEnum.ArraySinglePrimitive:
             output.WriteByte((byte)_binaryHeaderEnum);
             output.WriteInt32(_objectId);
             output.WriteInt32(_lengthA[0]);
             output.WriteByte((byte)((InternalPrimitiveTypeE)_typeInformation));
             break;
         case BinaryHeaderEnum.ArraySingleString:
             output.WriteByte((byte)_binaryHeaderEnum);
             output.WriteInt32(_objectId);
             output.WriteInt32(_lengthA[0]);
             break;
         case BinaryHeaderEnum.ArraySingleObject:
             output.WriteByte((byte)_binaryHeaderEnum);
             output.WriteInt32(_objectId);
             output.WriteInt32(_lengthA[0]);
             break;
         default:
             output.WriteByte((byte)_binaryHeaderEnum);
             output.WriteInt32(_objectId);
             output.WriteByte((byte)_binaryArrayTypeEnum);
             output.WriteInt32(_rank);
             for (int i = 0; i < _rank; i++)
             {
                 output.WriteInt32(_lengthA[i]);
             }
             if ((_binaryArrayTypeEnum == BinaryArrayTypeEnum.SingleOffset) ||
                 (_binaryArrayTypeEnum == BinaryArrayTypeEnum.JaggedOffset) ||
                 (_binaryArrayTypeEnum == BinaryArrayTypeEnum.RectangularOffset))
             {
                 for (int i = 0; i < _rank; i++)
                 {
                     output.WriteInt32(_lowerBoundA[i]);
                 }
             }
             output.WriteByte((byte)_binaryTypeEnum);
             BinaryTypeConverter.WriteTypeInfo(_binaryTypeEnum, _typeInformation, _assemId, output);
             break;
     }
 }
Exemple #17
0
 public void Write(BinaryFormatterWriter output)
 {
     output.WriteByte((byte)BinaryHeaderEnum.Assembly);
     output.WriteInt32(_assemId);
     output.WriteString(_assemblyString);
 }
Exemple #18
0
 public void Write(BinaryFormatterWriter output)
 {
     output.WriteByte((byte)BinaryHeaderEnum.CrossAppDomainMap);
     output.WriteInt32(_crossAppDomainArrayIndex);
 }
Exemple #19
0
 public void Write(BinaryFormatterWriter output)
 {
     output.WriteByte((byte)BinaryHeaderEnum.CrossAppDomainString);
     output.WriteInt32(_objectId);
     output.WriteInt32(_value);
 }
Exemple #20
0
 public void Write(BinaryFormatterWriter output)
 {
     output.WriteByte((byte)BinaryHeaderEnum.MemberReference);
     output.WriteInt32(_idRef);
 }
 public void Write(BinaryFormatterWriter output)
 {
     output.WriteByte((byte)BinaryHeaderEnum.ObjectString);
     output.WriteInt32(_objectId);
     output.WriteString(_value !);
 }
 public void Write(BinaryFormatterWriter output)
 {
     output.WriteByte((byte)BinaryHeaderEnum.MessageEnd);
 }
Exemple #23
0
 internal static void Disconnect(ref TcpClient client, ref BinaryFormatterReader reader, ref BinaryFormatterWriter writer)
 {
     client.Close();
     reader = null;
     writer = null;
 }
 public void Write(BinaryFormatterWriter output)
 {
     output.WriteByte((byte)BinaryHeaderEnum.CrossAppDomainString);
     output.WriteInt32(_objectId);
     output.WriteInt32(_value);
 }
 public void Write(BinaryFormatterWriter output)
 {
     output.WriteByte((byte)BinaryHeaderEnum.CrossAppDomainAssembly);
     output.WriteInt32(_assemId);
     output.WriteInt32(_assemblyIndex);
 }
 public void Write(BinaryFormatterWriter output)
 {
     output.WriteValue(_typeInformation, _value);
 }
 public void Write(BinaryFormatterWriter output)
 {
     output.WriteByte((byte)BinaryHeaderEnum.CrossAppDomainAssembly);
     output.WriteInt32(_assemId);
     output.WriteInt32(_assemblyIndex);
 }
Exemple #28
0
 public void Write(BinaryFormatterWriter output)
 {
     output.WriteValue(_typeInformation, _value);
 }
 public void Write(BinaryFormatterWriter output)
 {
     output.WriteByte((byte)BinaryHeaderEnum.ObjectString);
     output.WriteInt32(_objectId);
     output.WriteString(_value);
 }
Exemple #30
0
 public void Write(BinaryFormatterWriter output)
 {
     output.WriteByte((byte)BinaryHeaderEnum.Assembly);
     output.WriteInt32(_assemId);
     output.WriteString(_assemblyString);
 }
Exemple #31
0
 public void Write(BinaryFormatterWriter output)
 {
     output.WriteByte((byte)BinaryHeaderEnum.Object);
     output.WriteInt32(_objectId);
     output.WriteInt32(_mapId);
 }
Exemple #32
0
 public void Write(BinaryFormatterWriter output)
 {
     output.WriteByte((byte)BinaryHeaderEnum.MemberPrimitiveTyped);
     output.WriteByte((byte)_primitiveTypeEnum);
     output.WriteValue(_primitiveTypeEnum, _value);
 }
Exemple #33
0
 public void Write(BinaryFormatterWriter output)
 {
     output.WriteByte((byte)BinaryHeaderEnum.MessageEnd);
 }
Exemple #34
0
 public void Write(BinaryFormatterWriter output)
 {
     output.WriteByte((byte)BinaryHeaderEnum.MemberReference);
     output.WriteInt32(_idRef);
 }
Exemple #35
0
 public void Write(BinaryFormatterWriter output)
 {
     output.WriteByte((byte)BinaryHeaderEnum.Object);
     output.WriteInt32(_objectId);
     output.WriteInt32(_mapId);
 }
 public void Write(BinaryFormatterWriter output)
 {
     output.WriteByte((byte)BinaryHeaderEnum.CrossAppDomainMap);
     output.WriteInt32(_crossAppDomainArrayIndex);
 }
 public void Write(BinaryFormatterWriter output)
 {
     output.WriteByte((byte)BinaryHeaderEnum.MemberPrimitiveTyped);
     output.WriteByte((byte)_primitiveTypeEnum);
     output.WriteValue(_primitiveTypeEnum, _value);
 }
Exemple #38
0
 public virtual void Write(BinaryFormatterWriter output)
 {
     output.Write((byte)1);
     output.Write(this.ObjectId);
     output.Write(this.MapId);
 }