Exemplo n.º 1
0
        internal void SU_SendLauncherInfo(Client client, long length, string hash)
        {
            PacketStream stream = new PacketStream(0x1001);

            stream.WriteInt64(length);
            byte[] hashEncrypt = DesCipher.Encrypt(hash);
            stream.WriteInt32(hashEncrypt.Length);
            stream.WriteBytes(hashEncrypt);
            ClientManager.Instance.Send(client, stream);
        }
Exemplo n.º 2
0
        internal void SC_SendArguments(Client client, string arguments)
        {
            PacketStream stream = new PacketStream(0x0031);

            byte[] argEncrypt = DesCipher.Encrypt(arguments);
            stream.WriteInt32(argEncrypt.Length);
            stream.WriteBytes(argEncrypt);

            ClientManager.Instance.Send(client, stream);
        }
Exemplo n.º 3
0
        internal void SC_SendOTP(Client client, string otp)
        {
            PacketStream stream = new PacketStream(0x0013);

            byte[] encOTP = DesCipher.Encrypt(otp);
            stream.WriteInt32(encOTP.Length);
            stream.WriteBytes(encOTP);

            ClientManager.Instance.Send(client, stream);
        }
Exemplo n.º 4
0
        internal void SC_SendFile(Client client, string filePath)
        {
            int chunkSize = 64000;

            string fileName = Path.GetFileName(filePath);

            byte[] buffer = (File.Exists(filePath)) ? File.ReadAllBytes(filePath) : null;
            if (buffer.Length > 0)
            {
                // Just incase file is smaller than initial chunkSize
                chunkSize = Math.Min(64000, buffer.Length);

                SC_SendFileInfo(client, buffer.Length);

                int i = 0;

                while (true)
                {
                    if (i == buffer.Length)
                    {
                        break;
                    }

                    PacketStream fStream = new PacketStream(0x0042);

                    fStream.Flush();

                    fStream.WriteInt32(chunkSize);
                    fStream.WriteInt32(i);

                    byte[] tempBuffer = new byte[chunkSize];
                    Array.Copy(buffer, i, tempBuffer, 0, chunkSize);

                    fStream.WriteBytes(tempBuffer);

                    ClientManager.Instance.Send(client, fStream);

                    // Increase the index position
                    i = i + chunkSize;

                    // Refresh the chunkSize
                    chunkSize = Math.Min(64000, buffer.Length - i);
                }

                SC_SendFileEOF(client, fileName);
            }
        }
Exemplo n.º 5
0
        internal void SU_SendLauncher(Client client, string filePath)
        {
            int chunkSize = 64000;

            byte[] buffer = File.ReadAllBytes(filePath);
            if (buffer.Length > 0)
            {
                // Just incase file is smaller than initial chunkSize
                chunkSize = Math.Min(64000, buffer.Length);

                int i = 0;

                while (true)
                {
                    if (i == buffer.Length)
                    {
                        break;
                    }

                    PacketStream fStream = new PacketStream(0x1101);

                    fStream.Flush();

                    fStream.WriteInt32(chunkSize);
                    fStream.WriteInt32(i);

                    byte[] tempBuffer = new byte[chunkSize];
                    Array.Copy(buffer, i, tempBuffer, 0, chunkSize);

                    fStream.WriteBytes(tempBuffer);

                    ClientManager.Instance.Send(client, fStream);

                    // Increase the index position
                    i = i + chunkSize;

                    // Refresh the chunkSize
                    chunkSize = Math.Min(64000, buffer.Length - i);
                }

                SU_SendLauncherEOF(client);
            }
        }