Builder :
Stub : (Split string if more needed)Code: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(); }
Code: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-", "");
Results 1 to 1 of 1
Thread: [C#] Builder and stub
- 04 Sep. 2010 09:37am #1
[C#] Builder and stub
Shh, I'm watching My little pony.