added SendProfile
This commit is contained in:
1 parent
e70ce5ad68
commit
1a68c26e9f
8 files changed
+199
-51
No files matched your search
+14
@@ -48,6 +48,7 @@
|
||||
this.btUp = new System.Windows.Forms.Button();
|
||||
this.btDown = new System.Windows.Forms.Button();
|
||||
this.btSendAvatar = new System.Windows.Forms.Button();
|
||||
this.btSendProfile = new System.Windows.Forms.Button();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -239,11 +240,23 @@
|
||||
this.btSendAvatar.UseVisualStyleBackColor = true;
|
||||
this.btSendAvatar.Click += new System.EventHandler(this.btSendAvatar_Click);
|
||||
//
|
||||
// btSendProfile
|
||||
//
|
||||
this.btSendProfile.Enabled = false;
|
||||
this.btSendProfile.Location = new System.Drawing.Point(831, 339);
|
||||
this.btSendProfile.Name = "btSendProfile";
|
||||
this.btSendProfile.Size = new System.Drawing.Size(165, 23);
|
||||
this.btSendProfile.TabIndex = 15;
|
||||
this.btSendProfile.Text = "Send Profile";
|
||||
this.btSendProfile.UseVisualStyleBackColor = true;
|
||||
this.btSendProfile.Click += new System.EventHandler(this.btSendProfile_Click);
|
||||
//
|
||||
// ClientTest
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1008, 550);
|
||||
this.Controls.Add(this.btSendProfile);
|
||||
this.Controls.Add(this.btSendAvatar);
|
||||
this.Controls.Add(this.btDown);
|
||||
this.Controls.Add(this.btUp);
|
||||
@@ -293,6 +306,7 @@
|
||||
private System.Windows.Forms.Button btUp;
|
||||
private System.Windows.Forms.Button btDown;
|
||||
private System.Windows.Forms.Button btSendAvatar;
|
||||
private System.Windows.Forms.Button btSendProfile;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,11 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
@@ -119,6 +122,7 @@ namespace ClientTest
|
||||
btLeft.Enabled = true;
|
||||
btRight.Enabled = true;
|
||||
btSendAvatar.Enabled = true;
|
||||
btSendProfile.Enabled = true;
|
||||
});
|
||||
}
|
||||
else
|
||||
@@ -136,6 +140,7 @@ namespace ClientTest
|
||||
btLeft.Enabled = false;
|
||||
btRight.Enabled = false;
|
||||
btSendAvatar.Enabled = false;
|
||||
btSendProfile.Enabled = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -222,7 +227,40 @@ namespace ClientTest
|
||||
{
|
||||
data[i] = (byte) (i % 255);
|
||||
}
|
||||
client.SendMessage(CCommands.CreateCommandSendAvatarPicture(512, 512, data), null);
|
||||
client.SendMessage(CCommands.CreateCommandSendAvatarPicture(512, 512, data), OnResponse);
|
||||
}
|
||||
|
||||
private void btSendProfile_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!client.Connected || !loggedIn)
|
||||
return;
|
||||
|
||||
if (!File.Exists("test.jpg"))
|
||||
{
|
||||
byte[] data = new byte[512 * 512 * 4];
|
||||
for (int i = 0; i < data.Length; i++)
|
||||
{
|
||||
data[i] = (byte)(i % 255);
|
||||
}
|
||||
|
||||
Bitmap bmp = new Bitmap(512, 512);
|
||||
BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
|
||||
Marshal.Copy(data, 0, bmpData.Scan0, data.Length);
|
||||
bmp.UnlockBits(bmpData);
|
||||
|
||||
bmp.Save("test.jpg", ImageFormat.Jpeg);
|
||||
bmp.Dispose();
|
||||
}
|
||||
|
||||
if (File.Exists("test.jpg"))
|
||||
{
|
||||
byte[] data = File.ReadAllBytes("test.jpg");
|
||||
|
||||
if (data == null)
|
||||
return;
|
||||
|
||||
client.SendMessage(CCommands.CreateCommandSendProfile(data, "TestUser", 0), OnResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user