using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO; namespace WindowsFormsApplication9
{
public partial class Form1 : Form
{
private string res = "";
public Form1()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog ss = new OpenFileDialog();
if (ss.ShowDialog() == DialogResult.OK)
{
res = ss.FileName;
}
fun();
}
public void fun()
{
FileInfo fileinfo = new FileInfo(res);
long len =;
MessageBox.Show(len.ToString());
byte[] buff1 = new byte[len];
byte[] buff2 = new byte[];
FileStream fs = new FileStream(res, FileMode.Open);
fs.Read(buff1, , (int)len);
fs.Close();
OppositeByteArray(buff1,ref buff2);
FileStream fw = new FileStream(res, FileMode.Open);
for (int i = ; i < ; i++)
{
fw.WriteByte(buff2[i]);
}
//fw.Write(buff1, 0, (int)len);
fw.Write(buff1,,(int)len);
fw.Close();
fileinfo = new FileInfo(res);
}
/// <summary>
/// 把一个字节数组按位取反,得到一个新的字节数组
/// </summary>
/// <param name="inputData"></param>
/// <param name="outputData"></param>
public static void OppositeByteArray(byte[] inputData, ref byte[] outputData)
{
int len = inputData.Length; int temp; for (int i = ; i < len; i++)
{
temp = (int)inputData[i];//原字节数组字节转成int型
outputData[i] = (byte)~temp;//取反后赋给输出字节数组 } }
}
}

最新文章

  1. Maven No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? 问题
  2. unix basic command
  3. java、tomcat环境变量的配置(针对windows)
  4. log4net 日志跟踪程序
  5. SPOJ 1108 Card Trick 暴力模拟
  6. 【转】Application.mk 文件语法规范
  7. GO:格式化代码
  8. spring MVC中文乱码相关总结
  9. 基于visual Studio2013解决面试题之1405归并排序
  10. 关于angularjs+typeahead的整合
  11. linux-c/c++调试利器gdb、ddd小试
  12. javascript语句语义大全(7)
  13. 去掉iframe默认滚动条后影响正常滚动以及js解决高度自适应。
  14. 反反爬虫 IP代理
  15. java 堆、栈、方法区/ 类变量、成员变量、局部变量
  16. centos7 openssl 生成证书给自己使用
  17. C:指针遍历二维数组
  18. java面试题复习(七)
  19. Jmeter如何把响应数据的结果保存到本地的一个文件
  20. Office 365实现单点登录系列(5)—配置单点登录

热门文章

  1. POPTEST老李分享session,cookie的安全性以及区别 3
  2. (删)Java线程同步实现二:Lock锁和Condition
  3. js按值传递和按引用传递
  4. POI框架实现创建Excel表、添加数据、读取数据
  5. 银盛支付ecshop,shopex,shopnc在线支付接口,php版本支付接口开发
  6. (转)使用string.Format需要注意的一个性能问题
  7. 作死上CODEVS,青铜题
  8. bzoj4826 [Hnoi2017]影魔
  9. 新型钓鱼手段预警:你看到的 аррӏе.com 真是苹果官网?
  10. RedHat 7.1 下安装 Zabbix监控程序详解(适合linux初级用户)