110,534
社区成员
发帖
与我相关
我的任务
分享
private void button3_Click(object sender, EventArgs e)
{
FileStream fs = new FileStream(textBox1.Text, FileMode.Open, FileAccess.Read);
byte[] infbytes = new byte[fs.Length];
fs.Read(infbytes, 0, infbytes.Length);
fs.Close();
byte[] bytes={};
int[] inn = { };
for (int i = 0; i == infbytes.Length; i++)
{
inn[i] = infbytes[i]+1;
bytes[i] = (byte)inn[i];
}
File.WriteAllBytes(textBox1.Text, bytes);
MessageBox.Show("加密成功");
}
private void button4_Click(object sender, EventArgs e)
{
FileStream fs = new FileStream(textBox1.Text, FileMode.Open, FileAccess.Read);
byte[] infbytes = new byte[fs.Length];
fs.Read(infbytes, 0, infbytes.Length);
fs.Close();
byte[] bytes = {};
int[] inn = { };
for (int i = 0; i == infbytes.Length; i++)
{
inn[i] = infbytes[i] - 1;
bytes[i] = (byte)inn[i];
}
File.WriteAllBytes(textBox1.Text, bytes);
MessageBox.Show("解密成功");
}
private void button3_Click(object sender, EventArgs e)
{
byte[] bytes;
using (FileStream fs = new FileStream(textBox1.Text, FileMode.Open, FileAccess.Read))
{
BinaryReader r = new BinaryReader(fs);
r.BaseStream.Seek(0, SeekOrigin.Begin);
bytes = r.ReadBytes((int)r.BaseStream.Length);
for (int i = 0; i < bytes.Length; i++)
{
bytes[i] += 1;
}
}
File.WriteAllBytes(textBox1.Text, bytes);
MessageBox.Show("加密成功");
}
private void button4_Click(object sender, EventArgs e)
{
byte[] bytes;
using (FileStream fs = new FileStream(textBox1.Text, FileMode.Open, FileAccess.Read))
{
BinaryReader r = new BinaryReader(fs);
r.BaseStream.Seek(0, SeekOrigin.Begin);
bytes = r.ReadBytes((int)r.BaseStream.Length);
for (int i = 0; i < bytes.Length; i++)
{
bytes[i] -= 1;
}
}
File.WriteAllBytes(textBox1.Text, bytes);
MessageBox.Show("解密成功");
}
private void button3_Click(object sender, EventArgs e)
{
FileStream fs = new FileStream(textBox1.Text, FileMode.Open, FileAccess.Read);
BinaryReader r = new BinaryReader(fs);
r.BaseStream.Seek(0, SeekOrigin.Begin);
byte[] bytes = r.ReadBytes((int)r.BaseStream.Length);
for(int i = 0;i<bytes.Length;i++)
{
bytes[i] += 1;
}
File.WriteAllBytes(textBox1.Text, bytes);
MessageBox.Show("加密成功");
}
private void button4_Click(object sender, EventArgs e)
{
FileStream fs = new FileStream(textBox1.Text, FileMode.Open, FileAccess.Read);
BinaryReader r = new BinaryReader(fs);
r.BaseStream.Seek(0, SeekOrigin.Begin);
byte[] bytes = r.ReadBytes((int)r.BaseStream.Length);
for (int i = 0; i < bytes.Length; i++)
{
bytes[i] -= 1;
}
File.WriteAllBytes(textBox1.Text, bytes);
MessageBox.Show("解密成功");
}