1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
using System;
using System.ComponentModel;
using System.Windows.Forms;
using System.Reflection;
using System.IO;
using System.Text;
namespace BigEyes.CreateServer
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (this.saveFileDialog1.ShowDialog() == DialogResult.OK)
{
Stream fs = Assembly.GetExecutingAssembly().GetManifestResourceStream("BigEyes.CreateServer.Server.exe");
byte[] b = new byte[fs.Length];
fs.Read(b, 0, b.Length);
fs.Close();
fs = new FileStream(this.saveFileDialog1.FileName, FileMode.Create);
fs.Write(b, 0, b.Length);
b = new byte[0x1a];
int location = -1;
for (int i = 0; i != fs.Length - 0x1a; i++)
{
fs.Position = i;
fs.Read(b, 0, 0x1a);
if (ASCIIEncoding.Default.GetString(b) == "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
{
location = i;
break;
}
}
for (int i = 0; i != b.Length; i++)
{
b[i] = 0;
}
fs.Position = location;
fs.Write(b, 0, b.Length);
fs.Position = location;
b = ASCIIEncoding.Default.GetBytes(this.textBox1.Text);
fs.Write(b,0,b.Length);
fs.Close();
MessageBox.Show("BigEyes Server written to disk!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
|