Exemplo n.º 1
0
 public void Write(UruStream s)
 {
     s.WriteUInt(fTransID);
     s.WriteUInt(fAgeMcpID);
     s.WriteBytes(fAcctUuid.ToByteArray());
     s.WriteUInt(fPlayerID);
 }
Exemplo n.º 2
0
 public void Read(UruStream s)
 {
     fTransID = s.ReadUInt();
     fAgeMcpID = s.ReadUInt();
     fAcctUuid = new Guid(s.ReadBytes(16));
     fPlayerID = s.ReadUInt();
 }
Exemplo n.º 3
0
 public void Write(UruStream s)
 {
     s.WriteUInt(fParentIdx);
     s.WriteUInt(fChildIdx);
     s.WriteUInt(fSaverIdx);
     s.WriteByte(0);
 }
Exemplo n.º 4
0
 public void Read(UruStream s)
 {
     fParentIdx = s.ReadUInt();
     fChildIdx = s.ReadUInt();
     fSaverIdx = s.ReadUInt();
     s.ReadByte(); //Seen
 }
Exemplo n.º 5
0
 public void Read(UruStream s)
 {
     fType = (EConnType)s.ReadByte();
     fSockHeaderSize = s.ReadUShort();
     fBuildID = s.ReadUInt();
     fBuildType = (NetCliBuildType)s.ReadUInt();
     fBranchID = s.ReadUInt();
     fProductID = new Guid(s.ReadBytes(16));
 }
Exemplo n.º 6
0
        public byte[] ToArray()
        {
            MemoryStream ms = new MemoryStream();
            UruStream s = new UruStream(ms);
            Write(s);

            byte[] buf = ms.ToArray();
            s.Close();
            ms.Close();

            return buf;
        }
Exemplo n.º 7
0
        public void Read(UruStream s)
        {
            while (true) {
                AuthFileEntry entry = new AuthFileEntry();
                entry.fName = s.ReadUnicodeString();
                if (entry.fName == String.Empty) break;
                entry.fSize = (long)(s.ReadUShort() << 16 | s.ReadUShort() & 0xFFFF);
                s.ReadUShort(); //NULL

                fFiles.Add(entry);
            }
        }
Exemplo n.º 8
0
        public void Read(UruStream s)
        {
            fTransID = s.ReadUInt();
            fResult = (ENetError)s.ReadInt();
            fAgeMcpID = s.ReadUInt();
            fAgeInstanceUuid = new Guid(s.ReadBytes(16));
            fAgeVaultID = s.ReadUInt();

            byte[] game = s.ReadBytes(4);
            Array.Reverse(game);
            fGameServerIP = new IPAddress(game);
        }
Exemplo n.º 9
0
        public void Write(UruStream s)
        {
            foreach (AuthFileEntry file in fFiles) {
                s.WriteBytes(Encoding.Unicode.GetBytes(file.fName));
                s.WriteUShort(0);

                s.WriteUShort((ushort)(file.fSize >> 16));
                s.WriteUShort((ushort)(file.fSize & 0xFFFF));
                s.WriteUShort(0);
            }

            s.WriteUShort(0);
        }
Exemplo n.º 10
0
        public override bool Connect()
        {
            if (!base.Connect()) return false;

            //Send the FileConnectHeader
            UruStream s = new UruStream(new NetworkStream(fSocket, false));
            s.BufferWriter();
            fHeader.Write(s);
            s.WriteUInt(12); //Size
            s.WriteUInt(0);
            s.WriteUInt(0);
            s.FlushWriter();
            s.Close();

            fSocket.BeginReceive(new byte[4], 0, 4, SocketFlags.Peek, new AsyncCallback(IReceive), null);
            return true;
        }
Exemplo n.º 11
0
        public void Ping(int time)
        {
            File_PingPong ping = new File_PingPong();
            ping.fPingTime = time;

            ResetIdleTimer();
            lock (fSocket) {
                MemoryStream ms = new MemoryStream();
                UruStream s = new UruStream(ms);

                s.WriteUInt(12);
                s.WriteInt((int)FileCli2Srv.PingRequest);
                ping.Write(s);

                fSocket.Send(ms.ToArray());

                s.Close();
                ms.Close();
            }
        }
Exemplo n.º 12
0
        public override bool Connect()
        {
            if (!base.Connect()) return false;

            //Send the GateConnectHeader
            UruStream s = new UruStream(new NetworkStream(fSocket, false));
            s.BufferWriter();
            fHeader.Write(s);
            s.WriteInt(20);
            s.WriteBytes(Guid.Empty.ToByteArray());
            s.FlushWriter();
            s.Close();

            //Init encryption
            if (!base.NetCliConnect(4))
                return false;

            fSocket.BeginReceive(new byte[2], 0, 2, SocketFlags.Peek, new AsyncCallback(IReceive), null);
            return true;
        }
Exemplo n.º 13
0
        public void Read(UruStream s)
        {
            while (true) {
                FileManifestEntry me = new FileManifestEntry();
                me.fFileName = s.ReadUnicodeString();
                if (me.fFileName == String.Empty) break; //The end of the manifest is an empty string

                me.fDownloadName = s.ReadUnicodeString();
                me.fHash = s.ReadUnicodeString();
                me.fCompressedHash = s.ReadUnicodeString();

                me.fFileSize = (uint)(s.ReadUShort() << 16 | s.ReadUShort() & 0xFFFF);
                s.ReadUShort(); //NULL

                me.fCompressedSize = (uint)(s.ReadUShort() << 16 | s.ReadUShort() & 0xFFFF);
                s.ReadUShort(); //NULL

                me.fFlags = (uint)(s.ReadUShort() << 16 | s.ReadUShort() & 0xFFFF);
                s.ReadUShort(); //NULL

                fEntries.Add(me);
            }
        }
Exemplo n.º 14
0
 public void Write(UruStream s)
 {
     s.WriteByte((byte)fType);
     s.WriteUShort(fSockHeaderSize);
     s.WriteUInt(fBuildID);
     s.WriteUInt((uint)fBuildType);
     s.WriteUInt(fBranchID);
     s.WriteBytes(fProductID.ToByteArray());
 }
Exemplo n.º 15
0
 public void Write(UruStream s)
 {
     s.WriteBytes(fInstanceUuid.ToByteArray());
     s.WriteUnicodeStringF(fFilename, 64);
     s.WriteUnicodeStringF(fInstanceName, 64);
     s.WriteUnicodeStringF(fUserName, 64);
     s.WriteUnicodeStringF(fDescription, 1024);
     s.WriteUInt(fSequenceNumber);
     s.WriteInt(fLanguage);
     s.WriteUInt(fPopulation);
     s.WriteUInt(fCurrPopulation);
 }
Exemplo n.º 16
0
 public void Read(UruStream s)
 {
     fInstanceUuid = new Guid(s.ReadBytes(16));
     fFilename = s.ReadUnicodeStringF(64);
     fInstanceName = s.ReadUnicodeStringF(64);
     fUserName = s.ReadUnicodeStringF(64);
     fDescription = s.ReadUnicodeStringF(1024);
     fSequenceNumber = s.ReadUInt();
     fLanguage = s.ReadInt();
     fPopulation = s.ReadUInt();
     fCurrPopulation = s.ReadUInt();
 }
Exemplo n.º 17
0
 public void Read(UruStream s)
 {
     fPingTime = s.ReadInt();
 }
Exemplo n.º 18
0
 public void Read(UruStream s)
 {
     fTransID = s.ReadUInt();
     fGroup = s.ReadUnicodeStringF(260);
     fBuildID = s.ReadUInt();
 }
Exemplo n.º 19
0
 public void Write(UruStream s)
 {
     s.WriteUInt(fTransID);
     s.WriteInt((int)fResult);
 }
Exemplo n.º 20
0
 public void Read(UruStream s)
 {
     fTransID = s.ReadUInt();
     fResult = (ENetError)s.ReadInt();
 }
Exemplo n.º 21
0
        public void Write(UruStream s)
        {
            s.WriteUInt(fMsgType);

            if (fBuffer == null) fBuffer = new byte[0];
            s.WriteInt(fBuffer.Length);
            s.WriteBytes(fBuffer);
        }
Exemplo n.º 22
0
 public void Write(UruStream s)
 {
     if (fData == null) fData = new byte[0];
     s.WriteUInt(fTransID);
     s.WriteUInt((uint)fResult);
     s.WriteUInt(fReaderID);
     s.WriteUInt(fFileSize);
     s.WriteInt(fData.Length);
     s.WriteBytes(fData);
 }
Exemplo n.º 23
0
 public void Write(UruStream s)
 {
     s.WriteUInt(fTransID);
 }
Exemplo n.º 24
0
 public void Read(UruStream s)
 {
     fTransID = s.ReadUInt();
 }
Exemplo n.º 25
0
        private void IReceive(IAsyncResult ar)
        {
            try {
                lock (fSocket) {
                    fSocket.EndReceive(ar);

                    ResetIdleTimer();

                    //Size
                    byte[] buf = new byte[4];
                    fSocket.Receive(buf);

                    //Message
                    buf = new byte[BitConverter.ToInt32(buf, 0) - 4];
                    fSocket.Receive(buf);
                    fStream = new UruStream(new MemoryStream(buf));

                    FileSrv2Cli msg = (FileSrv2Cli)fStream.ReadInt();
                    switch (msg) {
                        case FileSrv2Cli.BuildIdReply:
                            IGotBuildID();
                            break;
                        case FileSrv2Cli.PingReply:
                            IPong();
                            break;
                        default:
                            string test = Enum.GetName(typeof(FileSrv2Cli), msg);
                            throw new NotSupportedException(msg.ToString("X") + " - " + test);
                    }

                    fStream.Close();
                }

                fSocket.BeginReceive(new byte[2], 0, 2, SocketFlags.Peek, new AsyncCallback(IReceive), null);
            } catch (ObjectDisposedException) {
            } catch (SocketException) {
                fSocket.Close();
            #if !DEBUG
            } catch (Exception e) {
                FireException(e);
            #endif
            }
        }
Exemplo n.º 26
0
        public void Write(UruStream s)
        {
            s.WriteUInt(fTransID);
            s.WriteUInt(fNodeID);
            s.WriteBytes(fRevisionID.ToByteArray());

            if (fNodeData == null) fNodeData = new byte[0];
            s.WriteInt(fNodeData.Length);
            s.WriteBytes(fNodeData);
        }
Exemplo n.º 27
0
 public void Write(UruStream s)
 {
     s.WriteInt(fPingTime);
 }
Exemplo n.º 28
0
 public void Write(UruStream s)
 {
     s.WriteUInt(fTransID);
     s.WriteUInt((uint)fResult);
     s.WriteUInt(fReaderID);
     s.WriteInt(fNumFiles);
     s.WriteInt(fData.Length / 2); //Wide char buffer...
     s.WriteBytes(fData);
 }
Exemplo n.º 29
0
        public uint RequestBuildID()
        {
            File_BuildIdRequest req = new File_BuildIdRequest();
            req.fTransID = IGetTransID();

            ResetIdleTimer();
            lock (fSocket) {
                MemoryStream ms = new MemoryStream();
                UruStream s = new UruStream(ms);

                s.WriteUInt(12);
                s.WriteInt((int)FileCli2Srv.BuildIdRequest);
                req.Write(s);

                fSocket.Send(ms.ToArray());

                s.Close();
                ms.Close();
            }

            return req.fTransID;
        }
Exemplo n.º 30
0
 public void Read(UruStream s)
 {
     fMsgType = s.ReadUInt();
     fBuffer = s.ReadBytes(s.ReadInt());
 }