//using DllEapFile;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace EapFileUploadClient
{
public partial class Form1 : Form
{
//EapSocket eapsocket = null;
string filename;
string filepath;
public Form1()
{
InitializeComponent();
//eapsocket = new EapSocket();
}
private void button2_Click(object sender, EventArgs e)
{
string msg = string.Empty;
string ip = txtIp.Text.Trim();
string pt = txtPort.Text.Trim();
//if (!eapsocket.Connect(ip,pt,ref msg))
//{
// ShowMsg("服务器连接失败");
//}
//else
//{
// ShowMsg("服务器连接成功!!!");
//}
}
///
/// 上传
///
///
///
private void button5_Click(object sender, EventArgs e)
{
//string ip = txtIp.Text.Trim();
//string pt = txtPort.Text.Trim();
//filename = txtfilename.Text.Trim();
//filepath = txtfilepath.Text.Trim();
////eapsocket.UpLoadToFile(filename, filepath);
////SendFile
//string msg=string.Empty;
//DllSocket.SendFile(ip, int.Parse(pt), filepath , filename, ref msg);
GetFileDatas("wechart.exe", 1);
}
private byte[] GetFileDatas(string filename, Int32 mode)
{
byte[] filenamebytes = Encoding.UTF8.GetBytes(filename);
Int32 len = filenamebytes.Length + 8;
byte[] alldatas = BitConverter.GetBytes(len);
alldatas.Concat(BitConverter.GetBytes(mode)).Concat(filenamebytes);
return alldatas;
}
///
/// 下载
///
///
///
private void button1_Click(object sender, EventArgs e)
{
string ip = txtIp.Text.Trim();
string pt = txtPort.Text.Trim();
filename = txtfilename.Text.Trim();
filepath = txtfilepath.Text.Trim();
//eapsocket.DownLoadToFile(filename, filepath);
string msg = string.Empty;
//DllSocket.DownFile(ip, int.Parse(pt), filepath, filename, ref msg);
}
void ShowMsg(string str)
{
txtMsg.Items.Add(str + "\r\n");
}
}
}