/// <summary> /// Replaces an UTF-16 encoded string /// </summary> private void ReplaceUTF16(bool all) { var inputBytes = StringParser.GetUTF16Bytes(txtNewString.Text, false); var result = all ? Replacer.ReplaceAll(FrmMain.fileBytes, StringParser.GetUTF16Bytes(txtOriginalString.Text, false), inputBytes) : Replacer.ReplaceFirst(FrmMain.fileBytes, StringParser.GetUTF16Bytes(txtOriginalString.Text, false), inputBytes); worked = result.Worked; if (result.Worked) { FrmMain.fileBytes = result.Bytes; } }
/// <summary> /// Replaces an ASCII encoded string /// </summary> private void ReplaceASCII(bool all) { var inputBytes = Encoding.ASCII.GetBytes(txtNewString.Text); var result = all ? Replacer.ReplaceAll(FrmMain.fileBytes, Encoding.ASCII.GetBytes(txtOriginalString.Text), inputBytes) : Replacer.ReplaceFirst(FrmMain.fileBytes, Encoding.ASCII.GetBytes(txtOriginalString.Text), inputBytes); worked = result.Worked; if (result.Worked) { FrmMain.fileBytes = result.Bytes; } }