Зависимости:
using System.IO;
using System.Text;
using System;
{
class Program
{
static void Main(string[] args)
{
using (FileStream fileStream = new FileStream("Stub.exe", FileMode.Open, FileAccess.ReadWrite, FileShare.None))
{
using (BinaryWriter binaryWriter = new BinaryWriter(fileStream))
{
fileStream.Position = fileStream.Length + 1;
binaryWriter.Write("***Hello, World");
}
}
}
}
}
namespace Stub
{
class Program
{
static void Main(string[] args)
{
using (StreamReader streamReader = new StreamReader(System.Reflection.Assembly.GetEntryAssembly().Location))
{
using (BinaryReader binaryReader = new BinaryReader(streamReader.BaseStream))
{
byte[] stubBytes = binaryReader.ReadBytes(Convert.ToInt32(streamReader.BaseStream.Length));
string stubSettings = Encoding.ASCII.GetString(stubBytes).Substring(Encoding.ASCII.GetString(stubBytes).IndexOf("***")).Replace("***", "");
Console.WriteLine(stubSettings);
Console.ReadLine();
}
}
}
}
}
using System.IO;
using System.Text;
using System;
В билдере
namespace Builder
{
class Program
{
static void Main(string[] args)
{
using (FileStream fileStream = new FileStream("Stub.exe", FileMode.Open, FileAccess.ReadWrite, FileShare.None))
{
using (BinaryWriter binaryWriter = new BinaryWriter(fileStream))
{
fileStream.Position = fileStream.Length + 1;
binaryWriter.Write("***Hello, World");
}
}
}
}
}
В Стабе
namespace Stub
{
class Program
{
static void Main(string[] args)
{
using (StreamReader streamReader = new StreamReader(System.Reflection.Assembly.GetEntryAssembly().Location))
{
using (BinaryReader binaryReader = new BinaryReader(streamReader.BaseStream))
{
byte[] stubBytes = binaryReader.ReadBytes(Convert.ToInt32(streamReader.BaseStream.Length));
string stubSettings = Encoding.ASCII.GetString(stubBytes).Substring(Encoding.ASCII.GetString(stubBytes).IndexOf("***")).Replace("***", "");
Console.WriteLine(stubSettings);
Console.ReadLine();
}
}
}
}
}