[C#] Builder and stub
Builder :
Stub : (Split string if more needed)
string filepath = string.Empty;
SaveFileDialog saveDlg = new SaveFileDialog();
{
saveDlg.FileName = "Server.exe";
saveDlg.Filter = "Executable Files (*.exe)|*.exe";
if (saveDlg.ShowDialog() == DialogResult.OK)
filepath = saveDlg.FileName;
else
return;
}
File.Copy(Application.StartupPath+@"\stub.exe", filepath);
string split = "-whatever-";
string info = split + txtWhatever.text +
split;
FileStream fs = new FileStream(filepath, FileMode.Open, FileAccess.ReadWrite, FileShare.None);
{
BinaryWriter bw = new BinaryWriter(fs);
fs.Position = fs.Length + 1;
bw.Write(info);
bw.Close();
}Stub : (Split string if more needed)
StreamReader sr = new StreamReader(System.Windows.Forms.Application.ExecutablePath);
BinaryReader br = new BinaryReader(sr.BaseStream);
byte[] fileData = br.ReadBytes(Convert.ToInt32(sr.BaseStream.Length));
br.Close();
sr.Close();
ASCIIEncoding Conv = new ASCIIEncoding();
string whatever = Conv.GetString(fileData).Substring(Conv.GetString(fileData).IndexOf("-whatever-")).Replace("-whatever-", "");