监控错误代码system:-100000(systeminfo)

已被0人收藏
&央行发行巨型鼠年金币 单币最高面额100000元
来自:保密
发帖:10+152
央行将于10月23日发行2008中国戊子(鼠)年金银纪念币一套。该套纪念币共13枚,其中金币7枚,银币6枚,均为中华人民共和国法定货币。   其中10公斤圆形金质纪念币(上图)为精制币,含纯金10公斤,直径180毫米,面额100000元,成色99.9%,最大发行量18枚;1公斤梅花形金质纪念币(下图)为精制币,含纯金1公斤,外接圆直径100毫米,面额10000元,成色99.9%,最大发行量118枚。该套金银纪念币由中国金币总公司总经销。
-------------------------------------------------------------------------------------------
这个家伙很懒,什么也没留下......
...楼主...
来自:保密
第三个不错
-------------------------------------------------------------------------------------------
花生米的博客http://blog.pchome.net/u/Pignut
新浪微博:.cn/pignut
来自:保密
发帖:582+3485
最大发行量118枚
央行用这种办法来通货紧缩??
-------------------------------------------------------------------------------------------
不与傻鸟论短长
来自:保密
发帖:371+11852
硕鼠硕鼠,无食我黍!
-------------------------------------------------------------------------------------------
其实我是个牧师
牧师的天职是治疗
我却选择了暗影,
因为更多时候战斗比治疗更有效
来自:保密
发帖:81+963
10公斤卖100000元,谁买到发达了。
估计肯定是内定掉了
-------------------------------------------------------------------------------------------
来自:保密
发帖:10+153
引用:最大发行量118枚央行用这种办法来通货紧缩??
均为中华人民共和国法定货币,还是可以流通的啰
-------------------------------------------------------------------------------------------
这个家伙很懒,什么也没留下......
来自:保密
发帖:81+964
引用:最大发行量118枚央行用这种办法来通货紧缩??
均为中华人民共和国法定货币,还是可以流通的啰
实际可是值183万啊
-------------------------------------------------------------------------------------------
来自:保密
发帖:27+341
好大的老鼠
-------------------------------------------------------------------------------------------
若得心净如明月,长空万里了无尘。
来自:保密
发帖:10+154
引用:引用:引用:最大发行量118枚央行用这种办法来通货紧缩?? 均为中华人民共和国法定货币,还是可以流通的啰实际可是值183万啊
央行应该再刻几个0上去再卖。。。。
-------------------------------------------------------------------------------------------
这个家伙很懒,什么也没留下......
来自:保密
发帖:192+6875
靠,金价最高的时候发行金币
-------------------------------------------------------------------------------------------
“奥迪,科技与成功互辉映”
来自:保密
发帖:582+3486
均为中华人民共和国法定货币,还是可以流通的啰
有人能用这个去买盒避孕套吗。。。
但是人民币还是少了0.118个亿。。
除非央行说 中国所有银行必须接受此硬币,以100万面额进行交易。。。
-------------------------------------------------------------------------------------------
不与傻鸟论短长
...10楼...
来自:保密
硕鼠硕鼠,无食我黍! 和谐社会
-------------------------------------------------------------------------------------------
网上越嚣张,网下越善良。
...11楼...
首先,请你以一种,团成一个团的姿势,然后,慢慢地比较圆润的方式,离开这座让你讨厌的城市,或者讨厌的人的周围首先,请你以一种,团成一个团的姿势,然后,慢慢地比较圆润的方式,离开这座让你讨厌的城市,或者讨厌的人的周围
央行发行巨型鼠年金币 单币最高面额100000元
扫描关注官方微信
扫描下载客户端
你可以发私信给一个或多个听众。默认不能发给非听众,除非对方设置了允许。
奖励分值:您今日还有 3 点分值可以奖励 [ 20 点奖分可自动换取 1 点PP]
请输入4位有相同表情的数字
&违反国家法律&&&&&&&&&含有色情内容
&对他人进行恶意攻击
&散布广告以及其它商业化的宣传
&干扰或混乱kds宽带山网络服务
&发布任何包含种族、 性别、宗教歧视性和猥亵性的信息内容
&恶意刷屏&&&&&&&&&&&&&&&内容重复&&&&&&&&&&&&&&&攻击管理员
&本人要求删除&&&&&&&&当事人要求删除
&与主题无关&&&&&&&&&&&水贴软文&&&&&&&&&&&涉及敏感政治内容
&被要求删除,你懂的&&&&&&&&&&&盗号并发布违规或广告内容
扣除hp值:
宽带山警务室
&恶意刷屏&&&&&&&&&水贴软文
&违反国家法律
&含有色情内容
&对他人进行恶意攻击
&散布广告以及其它商业化的宣传
&干扰或混乱kds宽带山网络服务
&发布任何包含种族、 性别、宗教歧视性和猥亵性的信息内容
&网页不能打开
&图片不能显示
已报名参加的人员:浩敏带屏幕蛇管摄像机HM-E0002&(编号:2108069)
所在地区:&广东 深圳
品&&&&牌:&浩敏
最小订货:&≥1(个)
我要采购: 个
使用说明书
一:产品简介
本产品能够提高您的驾驶乐趣和行车安全。
二:应用范围:探测人眼或者手难以到达的地方,寻找物体等
●可拍照和录像
●可回放图片,录制的视频
●可当U盘使用
●支持32GBTF卡
●3.45英寸彩色LCD显示
●拍摄图片分辨率JPEG640*480
●视频分辨率AVI640*480
●图片格式JPEG
●视频格式MJPEG
●用4节&AAA&电池
●300K高清彩色CMOS芯片
●2灯白光LED
●LED补光灯亮度可以调节
四:功能按键说明
录像部分各操作按键说明
:返回键,短按返回到上一层菜单,长按会软关机(在开机状态下),软关机后长按进入开机画面后会自动关机,要开关一下ON/OFF开关才可以开机。
Rest:复位键,在机子意外死机时按键复位并自动重启。
Left::移位键,回放音乐或视频时短按选择下一段或者下一张照片,长按减小音量。在时间日期调节时增加数值。
Right:移位键,回放音乐或视频时短按选择上一段或者上一张照片,长按增加音量。在时间日期调节时减小数值。在录像预览模式下按此键切换到拍照模式,在拍照模式下按下此键就拍一张照片
OK:确认键,在录像预览模式下按此键切换到录像模式,在录像模式下短按此键开始录像,再短按一下停止录像。在时间日期调节时确认和跳到下一调节项。
USB:连接电脑时插入USB数据线自动切换到存储器模式,也可以外接DC5V电源可以不用装&AAA&电池由外接电源供电,此时手柄上的总电源开关无效。
A/VOUT:在回放视频时可以切换到TV输出,用TV或其它视频设备观看视频内容
TF:TF存储卡插槽
OFF/ON:3.5录像部分电源开关,在不用此设备时请打在OFF状态,注意在录制或者拍照时请不要直接打在OFF,要退出录制项目后再关机。否则将不保存最好一段视频或者最后一张照片。在正常工作时打在ON状态。在机子意外死机时请关闭后重新打开机子将会正常工作。
五:操作说明
接上电源(或者装上电池),将电源录像部分开关打在ON的位置,再打开手柄上的总电源开关,将会出现一个开机画面后过几秒进入录像模式。
5.1主要功能菜单
●录像和拍照模式
●图片回放功能
●视频回放功能
●功能设置
●USB连接(连接了数据线后才会出现)
5.2录像和拍照模式
开机后自动进入录制画面(如下图),在按:键返回到其它功能选项后,再按Left和Right键移动到此录像图标,按OK键进入预览画面
5.2.1:开始和停止录像
短按OK键开始录像(在出现录像图标时),屏上显示一个红点表示正在录像,此时再短按一下OK键则停止录像并保存,红点消失。也可不用按OK键停止,此时就按录多长时间一段自动保存后继续录像(时间参照在功能设置里的录像保存时间为准,有10分钟,25分钟,45分钟/段),录满后会自动删除前面的几段录像继续录像。在录像模式下按Right键一下则回到预览模式,再按一下Right键就切换到拍照模式。
5.2.2:拍照模式
短按Right键,出现一个照相机符号表示工作在拍照模式,此时短按一下Right键就拍一张照片并保存。在拍照模式下按OK键一下则回到预览模式,再按一下OK键就切换到录像模式。
5.2.3:退出录制功能
在录制预览或者拍照和录像模式下按此键退出录制模式回到主菜单。
5.3:图片回放功能
5.3.1:图片张数/总张数显示
进入图片回放目录时显示表示当前选中的照片,000056显示此文件夹里共56张照片
5.3.2:照片日期显示格式
5.3.3:图片回放与删除
5.3.4:退出图片回放功能
5.4:视频回放功能
5.4.1:视频回放
5.4.2:电视输出显示
5.4.3:退出视频回放功能
短按此键,将退出视频回放功能回到主菜单。
5.5:功能设置
在主菜单下按Left和Right键移动到功能设置图标,按OK键进入功能设置画面,见下图
5.5.1:录像设置
按Left和Right键移动到录像设置项,按OK键进入录像设置菜单,见下图
5.5.2.:录像保存时间设置
5.5.3:显示输出设置
注:系统选择了哪项功能再次进入时选项框会停留在哪个选项上
5.5.4:存储器选择设置
5.5.5:格式化设置
5.5.7:自动关机设置
5.5.8:亮度调节功能
5.5.9:时间设置
5.5.10:语言设置
5.5.11:系统信息
内置存储器
已使用:0MB未使用:247MB
已使用:894MB未使用:50MB
SystemInfo
Used:0MBUnused:247MB
Used:894MBUnused:50MB
按退出系统信息界面。
该产品不适合您的采购需求?您可以进行以下操作
1. 一步,委托乐百供采购师帮您采购,专业采购师帮您邀请、审核供应商报价!
2. 返回上级目录,继续查找采购产品,所有安防监控产品信息经过人工核实,价格真实可靠。
3. 其它安防摄像机采购需求,请进入产品列表所有安防摄像机产品信息经过人工核实,价格真实可靠。
联系方式:后可查看
乐百供24小时服务热线:
免费注册请您先进行登录或注册
还不是会员?
* 您的邮箱:
* 登录密码:
* 确认密码:
* 公司名称:
* 您的姓名:先生女士
* 固定电话:
* 验证码:看不清?&
我已看过并同意
&元&/&个&(含税不含运费)
供应商名称:
供应商联系方式:
您也可以主动致电乐百供24小时服务热线
免费发布采购信息,乐百供帮您找供应商!
免费注册,发布商品,乐百供帮您找订单!c#文件操作大全(一)_asp.net开发_ThinkSAAS
c#文件操作大全(一)
c#文件操作大全(一)
内容来源: 网络
1.创建文件夹
//using System.IO;
Directory.CreateDirectory(%%1);
2.创建文件
//using System.IO;
File.Create(%%1);
3.删除文件
//using System.IO;
File.Delete(%%1);
4.删除文件夹
//using System.IO;
Directory.Delete(%%1);
5.删除一个目录下所有的文件夹
//using System.IO;
foreach (string dirStr in Directory.GetDirectories(%%1))
DirectoryInfo dir = new DirectoryInfo(dirStr);
ArrayList folders=new ArrayList();
FileSystemInfo[] fileArr = dir.GetFileSystemInfos();
for (int i = 0; i & folders.C i++)
FileInfo f = folders[i] as FileI
if (f == null)
DirectoryInfo d = folders[i] as DirectoryI
d.Delete();
6.清空文件夹
//using System.IO;
Directory.Delete(%%1,true);
Directory.CreateDirectory(%%1);
7.读取文件
//using System.IO;
StreamReader s = File.OpenText(%%1);
string %%2 =
while ((%%2 = s.ReadLine()) != null){
s.Close();
8.写入文件
//using System.IO;
FileInfo f = new FileInfo(%%1);
StreamWriter w = f.CreateText();
w.WriteLine(%%2);
w.Close();
9.写入随机文件
//using System.IO;
byte[] dataArray = new byte[100000];//new Random().NextBytes(dataArray);
using(FileStream FileStream = new FileStream(%%1, FileMode.Create)){
// Write the data to the file, byte by byte.
for(int i = 0; i & dataArray.L i++){
FileStream.WriteByte(dataArray[i]);
// Set the stream position to the beginning of the file.
FileStream.Seek(0, SeekOrigin.Begin);
// Read and verify the data.
for(int i = 0; i & FileStream.L i++){
if(dataArray[i] != FileStream.ReadByte()){
//写入数据错误
//"数据流"+FileStream.Name+"已验证"
10.读取文件属性
//using System.IO;
FileInfo f = new FileInfo(%%1);//f.CreationTime,f.FullName
if((f.Attributes & FileAttributes.ReadOnly) != 0){
11.写入属性
//using System.IO;
FileInfo f = new FileInfo(%%1);
//设置只读
f.Attributes = myFile.Attributes | FileAttributes.ReadO
//设置可写
f.Attributes = myFile.Attributes & ~FileAttributes.ReadO
12.枚举一个文件夹中的所有文件夹
//using System.IO;
foreach (string %%2 in Directory.GetDirectories(%%1)){
13.复制文件夹
string path = (%%2.LastIndexOf("") == %%2.Length - 1) ? %%2 : %%2+"";
string parent = Path.GetDirectoryName(%%1);
Directory.CreateDirectory(path + Path.GetFileName(%%1));
DirectoryInfo dir = new DirectoryInfo((%%1.LastIndexOf("") == %%1.Length - 1) ? %%1 : %%1 + "");
FileSystemInfo[] fileArr = dir.GetFileSystemInfos();
Queue&FileSystemInfo& Folders = new Queue&FileSystemInfo&(dir.GetFileSystemInfos());
while (Folders.Count&0)
FileSystemInfo tmp = Folders.Dequeue();
FileInfo f = tmp as FileI
if (f == null)
DirectoryInfo d = tmp as DirectoryI
Directory.CreateDirectory(d.FullName.Replace((parent.LastIndexOf("") == parent.Length - 1) ? parent : parent + "", path));
foreach (FileSystemInfo fi in d.GetFileSystemInfos())
Folders.Enqueue(fi);
f.CopyTo(f.FullName.Replace(parent, path));
14.复制目录下所有的文件夹到另一个文件夹下
DirectoryInfo d = new DirectoryInfo(%%1);
foreach (DirectoryInfo dirs in d.GetDirectories())
Queue&FileSystemInfo& al = new Queue&FileSystemInfo&(dirs.GetFileSystemInfos());
while (al.Count & 0)
FileSystemInfo temp = al.Dequeue();
FileInfo file = temp as FileI
if (file == null)
DirectoryInfo directory = temp as DirectoryI
Directory.CreateDirectory(path + directory.Name);
foreach (FileSystemInfo fsi in directory.GetFileSystemInfos())
al.Enqueue(fsi);
File.Copy(file.FullName, path + file.Name);
15.移动文件夹
string filename = Path.GetFileName(%%1);
string path=(%%2.LastIndexOf("") == %%2.Length - 1) ? %%2 : %%2 + "";
if (Path.GetPathRoot(%%1) == Path.GetPathRoot(%%2))
Directory.Move(%%1, path + filename);
string parent = Path.GetDirectoryName(%%1);
Directory.CreateDirectory(path + Path.GetFileName(%%1));
DirectoryInfo dir = new DirectoryInfo((%%1.LastIndexOf("") == %%1.Length - 1) ? %%1 : %%1 + "");
FileSystemInfo[] fileArr = dir.GetFileSystemInfos();
Queue&FileSystemInfo& Folders = new Queue&FileSystemInfo&(dir.GetFileSystemInfos());
while (Folders.Count & 0)
FileSystemInfo tmp = Folders.Dequeue();
FileInfo f = tmp as FileI
if (f == null)
DirectoryInfo d = tmp as DirectoryI
DirectoryInfo dpath = new DirectoryInfo(d.FullName.Replace((parent.LastIndexOf("") == parent.Length - 1) ? parent : parent + "", path));
dpath.Create();
foreach (FileSystemInfo fi in d.GetFileSystemInfos())
Folders.Enqueue(fi);
f.MoveTo(f.FullName.Replace(parent, path));
Directory.Delete(%%1, true);
16.移动目录下所有的文件夹到另一个目录下
string filename = Path.GetFileName(%%1);
if (Path.GetPathRoot(%%1) == Path.GetPathRoot(%%2))
foreach (string dir in Directory.GetDirectories(%%1))
Directory.Move(dir, bine(%%2,filename));
foreach (string dir2 in Directory.GetDirectories(%%1))
string parent = Path.GetDirectoryName(dir2);
Directory.bine(%%2, Path.GetFileName(dir2)));
string dir = (dir2.LastIndexOf("") == dir2.Length - 1) ? dir2 : dir2 + "";
DirectoryInfo dirdir = new DirectoryInfo(dir);
FileSystemInfo[] fileArr = dirdir.GetFileSystemInfos();
Queue&FileSystemInfo& Folders = new Queue&FileSystemInfo&(dirdir.GetFileSystemInfos());
while (Folders.Count & 0)
FileSystemInfo tmp = Folders.Dequeue();
FileInfo f = tmp as FileI
if (f == null)
DirectoryInfo d = tmp as DirectoryI
DirectoryInfo dpath = new DirectoryInfo(d.FullName.Replace((parent.LastIndexOf("") == parent.Length - 1) ? parent : parent + "", %%2));
dpath.Create();
foreach (FileSystemInfo fi in d.GetFileSystemInfos())
Folders.Enqueue(fi);
f.MoveTo(f.FullName.Replace(parent, %%2));
dirdir.Delete(true);
17.以一个文件夹的框架在另一个目录创建文件夹和空文件
string path = (%%2.LastIndexOf("") == %%2.Length - 1) ? %%2 : %%2 + "";
string parent = Path.GetDirectoryName(%%1);
Directory.CreateDirectory(path + Path.GetFileName(%%1));
DirectoryInfo dir = new DirectoryInfo((%%1.LastIndexOf("") == %%1.Length - 1) ? %%1 : %%1 + "");
FileSystemInfo[] fileArr = dir.GetFileSystemInfos();
Queue&FileSystemInfo& Folders = new Queue&FileSystemInfo&(dir.GetFileSystemInfos());
while (Folders.Count & 0)
FileSystemInfo tmp = Folders.Dequeue();
FileInfo f = tmp as FileI
if (f == null)
DirectoryInfo d = tmp as DirectoryI
Directory.CreateDirectory(d.FullName.Replace((parent.LastIndexOf("") == parent.Length - 1) ? parent : parent + "", path));
foreach (FileSystemInfo fi in d.GetFileSystemInfos())
Folders.Enqueue(fi);
if(b) File.Create(f.FullName.Replace(parent, path));
18.复制文件
//using System.IO;
File.Copy(%%1,%%2);
19.复制一个文件夹下所有的文件到另一个目录
//using System.IO;
foreach (string fileStr in Directory.GetFiles(%%1))
File.Copy((%%1.LastIndexOf("") == %%1.Length - 1) ? %%1 +Path.GetFileName(fileStr): %%1 + ""+Path.GetFileName(fileStr),(%%2.LastIndexOf("") == %%2.Length - 1) ? %%2 +Path.GetFileName(fileStr): %%2 + ""+Path.GetFileName(fileStr));
20.提取扩展名
//using System.IO;
string %%2=Path.GetExtension(%%1);
21.提取文件名
//using System.IO;
string %%2=Path.GetFileName(%%1);
22.提取文件路径
//using System.IO;
string %%2=Path.GetDirectoryName(%%1);
23.替换扩展名
//using System.IO;
File.ChangeExtension(%%1,%%2);
24.追加路径
//using System.IO;
string %%bine(%%1,%%2);
25.移动文件
//using System.IO;
File.Move(%%1,%%2+""+file.getname(%%1));
26.移动一个文件夹下所有文件到另一个目录
foreach (string fileStr in Directory.GetFiles(%%1))
File.Move((%%1.LastIndexOf("") == %%1.Length - 1) ? %%1 +Path.GetFileName(fileStr): %%1 + ""+Path.GetFileName(fileStr),(%%2.LastIndexOf("") == %%2.Length - 1) ? %%2 +Path.GetFileName(fileStr): %%2 + ""+Path.GetFileName(fileStr));
27.指定目录下搜索文件
string fileName=%%1;
string dirName=%%2;
DirectoryInfo
DirectoryInfo(dirName);
foreach(FileInfo
dirc.GetFiles()) {
if(file.Name.IndexOf(fileName)&-1)
return file.FullN
foreach(DirectoryInfo
dirc.GetDirectories())
GetFile(fileName,dir.FullName);
"找不到指定的文件";
28.打开对话框
OpenFileDialog penFileDialog=new OpenFileDialog();
openFileDialog.InitialDirectory="c:\";//注意这里写路径时要用c:\而不是c:
openFileDialog.Filter="文本文件|*.*|C#文件|*.cs|所有文件|*.*";
openFileDialog.RestoreDirectory=
openFileDialog.FilterIndex=1;
if (openFileDialog.ShowDialog()==DialogResult.OK) {
fName=openFileDialog.FileN
File fileOpen=new File(fName);
isFileHaveName=
%%1=fileOpen.ReadFile();
%%1.AppendText("");
29.文件分割
//using System.IO;
FileStream fsr = new FileStream(%%1, FileMode.Open, FileAccess.Read);
byte[] btArr = new byte[fsr.Length];
fsr.Read(btArr, 0, btArr.Length);
fsr.Close();
string strFileName=%%1.Substring(%%1.LastIndexOf("")+1);
FileStream fsw = new FileStream(%%2 + strFileName + "1", FileMode.Create, FileAccess.Write);
fsw.Write(btArr, 0, btArr.Length/2);
fsw.Close();
fsw = new FileStream(%%2 + strFileName + "2", FileMode.Create, FileAccess.Write);
fsw.Write(btArr, btArr.Length/2, btArr.Length-btArr.Length/2);
fsw.Close();
30.文件合并
//using System.IO;
string strFileName = %%1.Substring(%%1.LastIndexOf("") + 1);
FileStream fsr1 = new FileStream(%%2 + strFileName + "1", FileMode.Open, FileAccess.Read);
FileStream fsr2 = new FileStream(%%2 + strFileName + "2", FileMode.Open, FileAccess.Read);
byte[] btArr = new byte[fsr1.Length+fsr2.Length];
fsr1.Read(btArr, 0, Convert.ToInt32(fsr1.Length));
fsr2.Read(btArr, Convert.ToInt32(fsr1.Length), Convert.ToInt32(fsr2.Length));
fsr1.Close();fsr2.Close();
FileStream fsw = new FileStream(%%2 + strFileName, FileMode.Create, FileAccess.Write);
fsw.Write(btArr, 0, btArr.Length);
fsw.Close();
31.文件简单加密
//using System.IO;
FileStream fsr = new FileStream(%%1, FileMode.Open, FileAccess.Read);
byte[] btArr = new byte[fsr.Length];
fsr.Read(btArr, 0, btArr.Length);
fsr.Close();
for (int i = 0; i & btArr.L i++){ //加密
int ibt = btArr[i];
ibt += 100;
ibt %= 256;
btArr[i] = Convert.ToByte(ibt);
string strFileName = Path.GetExtension(%%1);
FileStream fsw = new FileStream(%%2+"/" + "enc_" + strFileName, FileMode.Create, FileAccess.Write);
fsw.Write(btArr, 0, btArr.Length);
fsw.Close();
32.文件简单解密
//using System.IO;
FileStream fsr = new FileStream(%%1, FileMode.Open, FileAccess.Read);
byte[] btArr = new byte[fsr.Length];
fsr.Read(btArr, 0, btArr.Length);
fsr.Close();
for (int i = 0; i & btArr.L i++){ //解密
int ibt = btArr[i];
ibt -= 100;
ibt += 256;
ibt %= 256;
btArr[i] = Convert.ToByte(ibt);
string strFileName = Path.GetExtension(%%1);
FileStream fsw = new FileStream(%%2 +"/" + strFileName, FileMode.Create, FileAccess.Write);
fsw.Write(btArr, 0, btArr.Length);
fsw.Close();
33.读取ini文件属性
//using System.Runtime.InteropS
//[DllImport("kernel32")]//返回取得字符串缓冲区的长度
//private static extern long GetPrivateProfileString(string section,string key, string def,StringBuilder retVal,int size,string filePath);
string Section=%%1;
string Key=%%2;
string NoText=%%3;
string iniFilePath="Setup.ini";
string %%4=String.E
if(File.Exists(iniFilePath)){
StringBuilder temp = new StringBuilder(1024);
GetPrivateProfileString(Section,Key,NoText,temp,1024,iniFilePath);
%%4=temp.ToString();
34.合并一个目录下所有的文件
//using System.IO;
FileStream fsw = new FileStream(%%2, FileMode.Create, FileAccess.Write);
foreach (string fileStr in Directory.GetFiles(%%1))
FileStream fsr1 = new FileStream(fileStr, FileMode.Open, FileAccess.Read);
byte[] btArr = new byte[fsr1.Length];
fsr1.Read(btArr, 0, Convert.ToInt32(fsr1.Length));
fsr1.Close();
fsw.Write(btArr, 0, btArr.Length);
fsw.Close();
35.写入ini文件属性
//using System.Runtime.InteropS
//[DllImport("kernel32")]//返回0表示失败,非0为成功
//private static extern long WritePrivateProfileString(string section,string key, string val,string filePath);
string Section=%%1;
string Key=%%2;
string Value=%%3;
string iniFilePath="Setup.ini";
if(File.Exists(iniFilePath))
long pStation = WritePrivateProfileString(Section,Key,Value,iniFilePath);
if(OpStation == 0)
36.获得当前路径
string %%1=Environment.CurrentD
37.读取XML数据库
//using System.X
XmlDocument doc=new XmlDocument();
doc.Load(%%1);
string %%9;
XmlElement xe=doc.GetElementById(%%7);
XmlNodeList elemList=xe.ChildN
foreach(XmlNode elem in elemList)
if(elem.NodeType==%%8)
%%9=elem.V
38.写入XML数据库
//using System.X
XmlDocument doc=new XmlDocument();
doc.Load(%%1);
XmlNode root=doc.DocumentE
XmlElement book=doc.createElement_x(%%3);
XmlElement book=doc.createElement_x(%%5);
XmlElement port=doc.createElement_x(%%6);
book.SetAttribute(%%4,root.ChildNodes.Count.ToString());
author.InnerText=%%8;
book.appendChild(author);
book.appendChild(port);
root.appendChild(book);
doc.Save(%%1);
39.ZIP压缩文件
// Open the file as a FileStream object.
infile = new FileStream(%%1, FileMode.Open, FileAccess.Read, FileShare.Read);
byte[] buffer = new byte[infile.Length];
// Read the file to ensure it is readable.
int count = infile.Read(buffer, 0, buffer.Length);
if (count != buffer.Length)
infile.Close();
//Test Failed: Unable to read data from file
infile.Close();
MemoryStream ms = new MemoryStream();
// Use the newly created memory stream for the compressed data.
DeflateStream compressedzipStream = new DeflateStream(ms, press, true);
//Compression
compressedzipStream.Write(buffer, 0, buffer.Length);
// Close the stream.
compressedzipStream.Close();
//Original size: {0}, Compressed size: {1}", buffer.Length, ms.Length);
FileInfo f = new FileInfo(%%2);
StreamWriter w = f.CreateText();
w.Write(buffer,0,ms.Length);
w.Close();
} // end try
catch (InvalidDataException)
//Error: The file being read contains invalid data.
} catch (FileNotFoundException)
//Error:The file specified was not found.
} catch (ArgumentException)
//Error: path is a zero-length string, contains only white space, or contains one or more invalid characters
} catch (PathTooLongException)
//Error: The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based
platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
} catch (DirectoryNotFoundException)
//Error: The specified path is invalid, such as being on an unmapped drive.
} catch (IOException)
//Error: An I/O error occurred while opening the file.
} catch (UnauthorizedAccessException)
//Error: path specified a file that is read-only, the path is a directory, or caller does not have the required
permissions.
} catch (IndexOutOfRangeException)
//Error: You must provide parameters for MyGZIP.
40.ZIP解压缩
// Open the file as a FileStream object.
infile = new FileStream(%%1, FileMode.Open, FileAccess.Read, FileShare.Read);
byte[] buffer = new byte[infile.Length];
// Read the file to ensure it is readable.
int count = infile.Read(buffer, 0, buffer.Length);
if (count != buffer.Length)
infile.Close();
//Test Failed: Unable to read data from file
infile.Close();
MemoryStream ms = new MemoryStream();
// ms.Position = 0;
DeflateStream zipStream = new DeflateStream(ms, CompressionMode.Decompress);
//Decompression
byte[] decompressedBuffer = new byte[buffer.Length *2];
zipStream.Close();
FileInfo f = new FileInfo(%%2);
StreamWriter w = f.CreateText();
w.Write(decompressedBuffer);
w.Close();
} // end try
catch (InvalidDataException)
//Error: The file being read contains invalid data.
catch (FileNotFoundException)
//Error:The file specified was not found.
catch (ArgumentException)
//Error: path is a zero-length string, contains only white space, or contains one or more invalid characters
catch (PathTooLongException)
//Error: The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based
platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
catch (DirectoryNotFoundException)
//Error: The specified path is invalid, such as being on an unmapped drive.
catch (IOException)
//Error: An I/O error occurred while opening the file.
catch (UnauthorizedAccessException)
//Error: path specified a file that is read-only, the path is a directory, or caller does not have the required
permissions.
catch (IndexOutOfRangeException)
//Error: You must provide parameters for MyGZIP.
41.获得应用程序完整路径
string %%1=Application.ExecutableP
42.ZIP压缩文件夹
private void CreateCompressFile(Stream source, string destinationName)
using (Stream destination = new FileStream(destinationName, FileMode.Create, FileAccess.Write))
using (GZipStream utput = new GZipStream(destination, press))
byte[] bytes = new byte[4096];
while ((n = source.Read(bytes, 0, bytes.Length)) != 0)
output.Write(bytes, 0, n);
ArrayList list = new ArrayList();
foreach (string f in Directory.GetFiles(%%1))
byte[] destBuffer = File.ReadAllBytes(f);
SerializeFileInfo sfi = new SerializeFileInfo(f, destBuffer);
list.Add(sfi);
IFormatter formatter = new BinaryFormatter();
using (Stream s = new MemoryStream())
formatter.Serialize(s, list);
s.Position = 0;
CreateCompressFile(s, %%2);
[Serializable]
class SerializeFileInfo
public SerializeFileInfo(string name, byte[] buffer)
fileName =
fileBuffer =
string fileN
public string FileName
return fileN
byte[] fileB
public byte[] FileBuffer
return fileB
43.递归删除目录下的文件
//using System.IO;
DirectoryInfo DInfo=new DirectoryInfo(%%1);
FileSystemInfo[] FSInfo=DInfo.GetFileSystemInfos();
for(int i=0;i&FSInfo.Li++)
FileInfo FInfo=new FileInfo(%%1+FSInfo[i].ToString());
FInfo.Delete();
44.验证DTD
XmlReaderSettings settings = new XmlReaderSettings();
settings.ProhibitDtd =
settings.ValidationType = ValidationType.DTD;
settings.ValidationEventHandler += new ValidationEventHandler(ValidationCallBack);
// Create the XmlReader object.
XmlReader reader = XmlReader.Create("my book.xml", settings);
// Parse the file.
while (reader.Read());
// Display any validation errors.
private static void ValidationCallBack(object sender, ValidationEventArgs e)
Console.WriteLine("Validation Error: {0}", e.Message);
45.Schema 验证
Boolean m_
XmlValidatingReader reader =
XmlSchemaCollection myschema = new XmlSchemaCollection();
ValidationEventHandler eventHandler = new ValidationEventHandler(ShowCompileErrors);
//Create the XML fragment to be parsed.
String xmlFrag = "&author xmlns=&urn:bookstore- schema&xmlns:xsi=&http://www.w3.org/2001/XMLSchema-instance&&" +
"&first-name&Herman&/first-name&" +
"&last-name&Melville&/last-name&" +
"&/author&";
//Create the XmlParserContext.
XmlParserContext context = new XmlParserContext(null, null, "", XmlSpace.None);
//Implement the reader.
reader = new XmlValidatingReader(xmlFrag, XmlNodeType.Element, context);
//Add the schema.
myschema.Add("urn:bookstore-schema", "c:Books.xsd");
//Set the schema type and add the schema to the reader.
reader.ValidationType = ValidationType.S
reader.Schemas.Add(myschema);
while (reader.Read())
Console.WriteLine("Completed validating xmlfragment");
catch (XmlException XmlExp)
Console.WriteLine(XmlExp.Message);
catch(XmlSchemaException XmlSchExp)
Console.WriteLine(XmlSchExp.Message);
catch(Exception GenExp)
Console.WriteLine(GenExp.Message);
Console.Read();
public static void ShowCompileErrors(object sender, ValidationEventArgs args)
Console.WriteLine("Validation Error: {0}", args.Message);
//Traditionally grep stands for "Global Regular Expression Print".
//Global means that an entire file is searched.
//Regular Expression means that a regular expression string is used to establish a search pattern.
//Print means that the command will display its findings.
//Simply put, grep searches an entire file for the pattern you want and displays its findings.
//The use syntax is different from the traditional Unix syntax, I prefer a syntax similar to
//csc, the C# compiler.
// grep [/h|/H] - Usage Help
// grep [/c] [/i] [/l] [/n] [/r] /E:reg_exp /F:files
// /c - print a count of matching lines
// /i - ig
// /l - print just files (scanning will stop on first match);
// /n - prefix each line of out
// /r - recursive sear
// /E:reg_exp - the Regular Expression used as search pattern. The Regular Expression can be delimited by
// quotes like "..." and &...& if you want to include in it leadin
// /F:files - the list of input files. The files can be separated by commas as in /F:file1,file2,file3
//and wildcards can be used for their specification as in /F:*file?.
//Example:
// grep /c /n /r /E:" C Sharp " /F:*.cs
//Option Flags
private bool m_bR
private bool m_bIgnoreC
private bool m_bJustF
private bool m_bLineN
private bool m_bCountL
private string m_strRegEx;
private string m_strF
//ArrayList keeping the Files
private ArrayList m_arrFiles = new ArrayList();
//Properties
public bool Recursive
get { return m_bR }
set { m_bRecursive = }
public bool IgnoreCase
get { return m_bIgnoreC }
set { m_bIgnoreCase = }
public bool JustFiles
get { return m_bJustF }
set { m_bJustFiles = }
public bool LineNumbers
get { return m_bLineN }
set { m_bLineNumbers = }
public bool CountLines
get { return m_bCountL }
set { m_bCountLines = }
public string RegEx
get { return m_strRegEx; }
set { m_strRegEx = }
public string Files
get { return m_strF }
set { m_strFiles = }
//Build the list of Files
private void GetFiles(String strDir, String strExt, bool bRecursive)
//search pattern can include the wild characters &*& and &?&
string[] fileList = Directory.GetFiles(strDir, strExt);
for(int i=0; i&fileList.L i++)
if(File.Exists(fileList[i]))
m_arrFiles.Add(fileList[i]);
if(bRecursive==true)
//Get recursively from subdirectories
string[] dirList = Directory.GetDirectories(strDir);
for(int i=0; i&dirList.L i++)
GetFiles(dirList[i], strExt, true);
//Search Function
public void Search()
String strDir = Environment.CurrentD
//First empty the list
m_arrFiles.Clear();
//Create recursively a list with all the files complying with the criteria
String[] astrFiles = m_strFiles.Split(new Char[] {&,&});
for(int i=0; i&astrFiles.L i++)
//Eliminate white spaces
astrFiles[i] = astrFiles[i].Trim();
GetFiles(strDir, astrFiles[i], m_bRecursive);
//Now all the Files are in the ArrayList, open each one
//iteratively and look for the search string
String strResults = "Grep Results:
String strL
int iLine, iC
bool bEmpty =
IEnumerator enm = m_arrFiles.GetEnumerator();
while(enm.MoveNext())
StreamReader sr = File.OpenText((string)enm.Current);
iLine = 0;
iCount = 0;
bool bFirst =
while((strLine = sr.ReadLine()) != null)
//Using Regular Expressions as a real Grep
if(m_bIgnoreCase == true)
mtch = Regex.Match(strLine, m_strRegEx, RegexOptions.IgnoreCase);
mtch = Regex.Match(strLine, m_strRegEx);
if(mtch.Success == true)
if(bFirst == true)
if(m_bJustFiles == true)
strResults += (string)enm.Current + "
strResults += (string)enm.Current + ":
//Add the Line to Results string
if(m_bLineNumbers == true)
strResults += " " + iLine + ": " + strLine + "
strResults += " " + strLine + "
sr.Close();
if(bFirst == false)
if(m_bCountLines == true)
strResults += " " + iCount + " Lines Matched
strResults += "
catch(SecurityException)
strResults += "
" + (string)enm.Current + ": Security Exception
catch(FileNotFoundException)
strResults += "
" + (string)enm.Current + ": File Not Found Exception
if(bEmpty == true)
Console.WriteLine("No matches found!");
Console.WriteLine(strResults);
//Print Help
private static void PrintHelp()
Console.WriteLine("Usage: grep [/h|/H]");
Console.WriteLine("
grep [/c] [/i] [/l] [/n] [/r] /E:reg_exp /F:files");
Arguments CommandLine = new Arguments(args);
if(CommandLine["h"] != null || CommandLine["H"] != null)
PrintHelp();
// The working object
ConsoleGrep grep = new ConsoleGrep();
// The arguments /e and /f are mandatory
if(CommandLine["E"] != null)
grep.RegEx = (string)CommandLine["E"];
Console.WriteLine("Error: No Regular Expression specified!");
Console.WriteLine();
PrintHelp();
if(CommandLine["F"] != null)
grep.Files = (string)CommandLine["F"];
Console.WriteLine("Error: No Search Files specified!");
Console.WriteLine();
PrintHelp();
grep.Recursive = (CommandLine["r"] != null);
grep.IgnoreCase = (CommandLine["i"] != null);
grep.JustFiles = (CommandLine["l"] != null);
if(grep.JustFiles == true)
grep.LineNumbers =
grep.LineNumbers = (CommandLine["n"] != null);
if(grep.JustFiles == true)
grep.CountLines =
grep.CountLines = (CommandLine["c"] != null);
// Do the search
grep.Search();
47.直接创建多级目录
//using System.IO;
DirectoryInfo di=new DirectoryInfo(%%1);
di.CreateSubdirectory(%%2);
48.批量重命名
//using System.IO;
string strOldFileN string strNewFileN string strOldPart =this.textBox1.Text.Trim();//重命名文件前的文件名等待替换字符串
string strNewPart = this.textBox2.Text.Trim();//重命名文件后的文件名替换字符串
string strNewFileP
string strFileF
//原始图片目录
int TotalFiles = 0; DateTime StartTime = DateTime.N //获取开始时间
FolderBrowserDialog f1 = new FolderBrowserDialog(); //打开选择目录对话框
if (f1.ShowDialog() == DialogResult.OK) {
strFileFolder = f1.SelectedP
DirectoryInfo di = new DirectoryInfo(strFileFolder);
FileInfo[] filelist = di.GetFiles("*.*");
int i = 0;
foreach (FileInfo fi in filelist) {
strOldFileName = fi.N
strNewFileName = fi.Name.Replace(strOldPart, strNewPart);
strNewFilePath = @strFileFolder + "" + strNewFileN
filelist[i].MoveTo(@strNewFilePath); TotalFiles += 1;
this.listBox1.Items.Add("文件名:" + strOldFileName + "已重命名为" + strNewFileName);
DateTime EndTime = DateTime.N//获取结束时间
TimeSpan ts = EndTime - StartT this.listBox1.Items.Add("总耗时:" + ts.Hours.ToString() + "时" +ts.Minutes.ToString() + "分" + ts.Seconds.ToString() + "秒");
49.文本查找替换
if (args.Length == 3)
ReplaceFiles(args[0],args[1],args[2],null);
if (args.Length == 4)
if (args[3].Contains("v"))
ReplaceVariable(args[0], args[1], args[2], args[3]);
ReplaceFiles(args[0], args[1], args[2], args[3]);
/// &summary&
/// 替换环境变量中某个变量的文本值。可以是系统变量,用户变量,临时变量。替换时会覆盖原始值。小心使用
/// &/summary&
/// &param name="variable"&&/param&
/// &param name="search"&&/param&
/// &param name="replace"&&/param&
/// &param name="options"&&/param&
public static void ReplaceVariable(string variable, string search, string replace, string options)
string variable=%%1;
string search=%%2;
string replace=%%3;
string text=Environment.GetEnvironmentVariable(variable);
System.Windows.Forms.MessageBox.Show(text);
text=ReplaceText(text, search, replace, options);
Environment.SetEnvironmentVariable(variable, text);
text = Environment.GetEnvironmentVariable(variable);
System.Windows.Forms.MessageBox.Show(text);
/// &summary&
/// 批量替换文件文本
/// &/summary&
/// &param name="args"&&/param&
public static void ReplaceFiles(string path,string search, string replace, string options)
string path=%%1;
string search=%%2;
string replace=%%3;
if(File.Exists(path)){
ReplaceFile(path, search, replace, options);
if (Directory.Exists(path))
fs = Directory.GetFiles(path);
foreach (string f in fs)
ReplaceFile(f, search, replace, options);
int i=path.LastIndexOf("");
if(i&0)i=path.LastIndexOf("/");
if (i & -1)
d = path.Substring(0, i + 1);
searchfile = path.Substring(d.Length);
d = System.Environment.CurrentD
searchfile =
searchfile = searchfile.Replace(".", @".");
searchfile = searchfile.Replace("?", @"[^.]?");
searchfile = searchfile.Replace("*", @"[^.]*");
//System.Windows.Forms.MessageBox.Show(d);
System.Windows.Forms.MessageBox.Show(searchfile);
if (!Directory.Exists(d))
fs = Directory.GetFiles(d);
foreach (string f in fs)
if(System.Text.RegularExpressions.Regex.IsMatch(f,searchfile))
ReplaceFile(f, search, replace, options);
/// &summary&
/// 替换单个文本文件中的文本
/// &/summary&
/// &param name="filename"&&/param&
/// &param name="search"&&/param&
/// &param name="replace"&&/param&
/// &param name="options"&&/param&
/// &returns&&/returns&
public static bool ReplaceFile(string filename, string search, string replace,string options)
string path=%%1;
string search=%%2;
string replace=%%3;
FileStream fs = File.OpenRead(filename);
//判断文件是文本文件还二进制文件。该方法似乎不科学
for (long i = 0; i & fs.L i++)
b = (byte)fs.ReadByte();
if (b == 0)
System.Windows.Forms.MessageBox.Show("非文本文件");
//有此字节则表示改文件不是文本文件。就不用替换了
//判断文本文件编码规则。
byte[] bytes = new byte[2];
Encoding coding=Encoding.D
if (fs.Read(bytes, 0, 2) & 2)
if (bytes == new byte[2] { 0xFF, 0xFE }) coding = Encoding.U
if (bytes == new byte[2] { 0xFE, 0xFF }) coding = Encoding.BigEndianU
if (bytes == new byte[2] { 0xEF, 0xBB }) coding = Encoding.UTF8;
fs.Close();
//替换数据
string text=File.ReadAllText(filename, coding);
text=ReplaceText(text,search, replace, options);
File.WriteAllText(filename, text, coding);
/// &summary&
/// 替换文本
/// &/summary&
/// &param name="text"&&/param&
/// &param name="search"&&/param&
/// &param name="replace"&&/param&
/// &param name="options"&&/param&
/// &returns&&/returns&
public static string ReplaceText(string text, string search, string replace, string options)
RegexOptions ps = RegexOptions.N
if (options == null)
//纯文本替换
search = search.Replace(".", @".");
search = search.Replace("?", @"?");
search = search.Replace("*", @"*");
search = search.Replace("(", @"(");
search = search.Replace(")", @")");
search = search.Replace("[", @"[");
search = search.Replace("[", @"[");
search = search.Replace("[", @"[");
search = search.Replace("{", @"{");
search = search.Replace("}", @"}");
ops |= RegexOptions.IgnoreC
if(options.Contains("I"))ops |= RegexOptions.IgnoreC
text = Regex.Replace(text, search, replace, ops);
50.文件关联
//using Microsoft.Win32;
string keyN
string keyV
keyName = %%1; //"WPCFile"
keyValue = %%2; //"资源包文件"
RegistryKey isExCommand =
bool isCreateRegistry =
/// 检查 文件关联是否创建
isExCommand = Registry.ClassesRoot.OpenSubKey(keyName);
if (isExCommand == null)
isCreateRegistry =
if (isExCommand.GetValue("Create").ToString() == Application.ExecutablePath.ToString())
isCreateRegistry =
Registry.ClassesRoot.DeleteSubKeyTree(keyName);
isCreateRegistry =
catch (Exception)
isCreateRegistry =
if (isCreateRegistry)
RegistryKey key,
key = Registry.ClassesRoot.CreateSubKey(keyName);
key.SetValue("Create", Application.ExecutablePath.ToString());
keyico = key.CreateSubKey("DefaultIcon");
keyico.SetValue("", Application.ExecutablePath + ",0");
key.SetValue("", keyValue);
key = key.CreateSubKey("Shell");
key = key.CreateSubKey("Open");
key = key.CreateSubKey("Command");
key.SetValue("", """ + Application.ExecutablePath.ToString() + "" "%1"");
keyName = %%3; //".wpc"
keyValue = %%1;
key = Registry.ClassesRoot.CreateSubKey(keyName);
key.SetValue("", keyValue);
catch (Exception)
51.操作Excel文件
private static string C//连接字符串
Workbook myBook =
Worksheet mySheet=
Excel.ApplicationClass ExlApp = new ApplicationClass();
ExlApp.Visible =
object Missiong = System.Reflection.Missing.V
string reqpath = this.Request.PhysicalP
int pos = reqpath.LastIndexOf("");
reqpath = reqpath.Substring(0,pos);
ExlApp.Workbooks.Open(%%1,oMissiong, oMissiong, oMissiong,oMissiong, oMissiong, oMissiong,
oMissiong,oMissiong,oMissiong, oMissiong, oMissiong, oMissiong);//, oMissiong);//, oMissiong); // reqpath + ""
myBook = ExlApp.Workbooks[1];
mySheet = (Worksheet)myBook.Worksheets[1];
string mySelectQuery = %%2; //"SELECT dh, qy,zb FROM SCXXB"
using(SqlConnection myConnection = new SqlConnection(Connstring)){
SqlCommand myCommand = new SqlCommand(mySelectQuery,myConnection);
myConnection.Open();
SqlDataReader myR
myReader = myCommand.ExecuteReader();
// Always call Read before accessing data.
int recount=0;
while (myReader.Read())
recount=recount+1;
myReader.Close();
myConnection.Close();
int gho=3;
for(int i = 1; i & i ++)
rg = mySheet.get_Range("A" +
gho.ToString(), "C" + ( gho ).ToString());
rg.Copy(oMissiong);
rg.Insert(XlInsertShiftDirection.xlShiftDown);
//从数据表中取数据
mySelectQuery = %%2; //"SELECT dh, qy,zb FROM SCXXB ORDER BY qy,zb";
myConnection = new SqlConnection(Connstring);
myCommand = new SqlCommand(mySelectQuery,myConnection);
myConnection.Open();
myReader = myCommand.ExecuteReader();
int Curhs =
while (myReader.Read())
mySheet.Cells[Curhs,1] =myReader["qy"].ToString() ;
mySheet.Cells[Curhs,2] =myReader["zb"].ToString() ;
mySheet.Cells[Curhs,3] =myReader["dh"].ToString() ;
myReader.Close();
//合并最后一页
MergeCell(ref mySheet,3 , recount ,"A"); //调用函数实现A列合并
MergeCell(ref mySheet,3 , recount ,"B"); //调用函数实现A列合并
myBook.SaveAs(%%1, oMissiong,oMissiong, oMissiong,oMissiong,oMissiong,Excel.XlSaveAsAccessMode.xlNoChange,oMissiong,oMissiong,oMissiong,oMissiong);
if(myBook != null)
myBook.Close(true, %%1, true);
if(mySheet != null)
System.Runtime.InteropServices.Marshal.ReleaseComObject (mySheet);
if(myBook != null)
System.Runtime.InteropServices.Marshal.ReleaseComObject (myBook);
if(ExlApp != null)
ExlApp.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject ((object)ExlApp);
GC.Collect();
/// 合并单元格
private void MergeCell(ref Worksheet mySheet, int startLine,int RecCount, string Col)
string qy1 = mySheet.get_Range(Col + startLine.ToString(), Col + startLine.ToString()).Text.ToString();
Excel.Range rg1,
int ms1, me1;
string strtemp = "";
int ntemp = 0;
me1 = startL
for (int i=1; i&=RecC i++)
ntemp = startLine +
rg = mySheet.get_Range(Col+ ntemp.ToString(), Col+ ntemp.ToString());
strtemp = rg.Text.ToString().Trim();
if (qy1.Trim() != strtemp.Trim())
ms1 = me1;
me1 = i + startLine - 1;
if (me1-ms1&0)
rg1 = mySheet.get_Range(Col + ms1.ToString(), Col + me1.ToString());
rg1.ClearContents();
rg1.MergeCells =
if(Col == "A")
mySheet.Cells[ms1,1] = qy1;
else if (Col == "B")
mySheet.Cells[ms1,2] = qy1;
strtemp = mySheet.get_Range(Col + me1.ToString(), Col + me1.ToString()).Text.ToString();
if(strtemp.Trim() != "")
52.设置JDK环境变量
//using Microsoft.Win32;
int isFileNum=0;
Environment.CurrentDirectory
string srcFileName,srcFilePath,dstFile,srcF
string src=Environment.CurrentDirectory+"
useless.Format("%s%s",szDir,"resin.exe");
srcFile=useless.GetBuffer(0);
dstFile=srcFilePath+"";
CopyFile(srcFile,dstFile,false);
useless.Format("%s%s",szDir,"DLL1.dll");
srcFile=useless.GetBuffer(0);
dstFile=srcFilePath+"";
CopyFile(srcFile,dstFile,false);
useless.Format("%s%s",szDir,"DeployDoc.exe");
srcFile=useless.GetBuffer(0);
dstFile=srcFilePath+"";
CopyFile(srcFile,dstFile,false);
string StrP
CRegEdit SysJavaHstring StrJavaH
SysJavaHome.m_RootKey=HKEY_LOCAL_MACHINE;
SysJavaHome.OpenKey("SYSTEMCurrentControlSetControlSession ManagerEnvironment");
CRegEdit RegHomeP
RegHomePath.m_RootKey=HKEY_CURRENT_USER;
RegHomePath.OpenKey("Environment");
RegHomePath.WriteString("RESIN_HOME",(LPCTSTR)srcFilePath); //D:
esin-3.2.0
useless.Format("%%s",srcFilePath.GetBuffer(0),useful.GetBuffer(0));
SysJavaHome.WriteString("Path",(LPCTSTR)useful);
Sleep(5000);
else if(srcFileName.Find("ant")&0)
string StrP
CRegEdit SysJavaHstring StrJavaH
SysJavaHome.m_RootKey=HKEY_LOCAL_MACHINE;
SysJavaHome.OpenKey("SYSTEMCurrentControlSetControlSession ManagerEnvironment");
CRegEdit RegHomeP
RegHomePath.m_RootKey=HKEY_CURRENT_USER;
RegHomePath.OpenKey("Environment");
RegHomePath.WriteString("ANT_HOME",(LPCTSTR)srcFilePath); //D:apache-ant-1.7.1 PATH=%ANT_HOME%/bin
useless.Format("%%s",srcFilePath.GetBuffer(0),useful.GetBuffer(0));
SysJavaHome.WriteString("Path",(LPCTSTR)useful);
Sleep(5000);
else if(srcFileName.Find("eclipse")==0 || srcFileName.Find("NetBeans")==0)
//char * xmFile="";
//SaveFileToStr("deploy.xml",xmFile);
53.选择文件夹对话框
public class FolderDialog : FolderNameEditor
FolderNameEditor.FolderBrowser fDialog = new
System.Windows.Forms.Design.FolderNameEditor.FolderBrowser();
public FolderDialog()
public DialogResult DisplayDialog()
return DisplayDialog("请选择一个文件夹");
public DialogResult DisplayDialog(string description)
fDialog.Description =
return fDialog.ShowDialog();
public string Path
return fDialog.DirectoryP
~FolderDialog()
fDialog.Dispose();
FolderDialog aa = new FolderDialog();
aa.DisplayDialog();
if(aa.ShowDialog()==DialogResult.OK)
%%1 = aa.SelectedP
54.删除空文件夹
IsValidFileChars(string
Regex("[*\/:?&&|"]");
!regEx.IsMatch("ajpg");
string path = %%1;
if(!IsValidFileChars(path))
throw new Exception("非法目录名!");
if(!Directory.Exists(path))
throw new Exception("本地目录路径不存在!");
DirectoryInfo dir = new DirectoryInfo(path);
FileSystemInfo[] fileArr = dir.GetFileSystemInfos();
Queue&String& Folders = new Queue&String&(Directory.GetDirectories(aa.Path));
while (Folders.Count & 0)
path = Folders.Dequeue();
string[] dirs = Directory.GetDirectories(path);
Directory.Delete(path);
foreach (string direct in dirs)
Folders.Enqueue(direct);
catch (Exception ep)
MessageBox.show(ep.ToString());
55.发送数据到剪贴板
//using System.Windows.F
Clipboard.SetText(%%1);
56.从剪贴板中取数据
//using System.Windows.F
IDataObject iData = Clipboard.GetDataObject();
string %%1;
// 将数据与指定的格式进行匹配,返回bool
if (iData.GetDataPresent(DataFormats.Text))
// GetData检索数据并指定一个格式
%%1 = (string)iData.GetData(DataFormats.Text);
MessageBox.Show("目前剪贴板中数据不可转换为文本","错误");
57.获取文件路径的父路径
//using System.IO;
string %%2=Directory.GetParent(%%1);
58.创建快捷方式
//首先添加以下引用:COM下Windows Script. Host Object Model,然后可以通过以下方法创建快捷方式。
string app = %%1;""
string location1 = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Favorites) + "教学教务管理.url";
string location2 = System.Environment.GetFolderPath(System.Environment.SpecialFolder.DesktopDirectory) + "培训教学教务管理系统.url";
string location3 = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Programs) + "培训教学教务管理系统.url";
// Create a Windows Script. Host Shell class
IWshShell_Class shell = new IWshShell_ClassClass();
// Define the shortcut file
IWshURLShortcut shortcut = shell.CreateShortcut(location1) as IWshURLS
shortcut.TargetPath =
// Save it
shortcut.Save();
shortcut = shell.CreateShortcut(location2) as IWshURLSshortcut.TargetPath =
// Save it
shortcut.Save();
shortcut = shell.CreateShortcut(location3) as IWshURLS
shortcut.TargetPath =
// Save it
shortcut.Save();
catch(COMException ex)
Console.WriteLine(ex.Message);
59.弹出快捷菜单
//在工具箱中找到ContextMenuStrip控件,并拖放至Form1窗体
//设计菜单内容
//将contextMenuStrip1与窗体关联。方法是先选定Form1,为其ContextMenuStrip属性设置属性值为contextMenuStrip1
60.文件夹复制到整合操作
FolderDialog aa = new FolderDialog();
aa.DisplayDialog();
if (aa.Path != "")
string path = (aa.Path.LastIndexOf("") == aa.Path.Length - 1) ? aa.Path : aa.Path+"";
string parent = Path.GetDirectoryName(%%1);
Directory.CreateDirectory(path + Path.GetFileName(%%1));
%%1 = (%%1.LastIndexOf("") == %%1.Length - 1) ? %%1 : %%1 + "";
DirectoryInfo dir = new DirectoryInfo(%%1);
FileSystemInfo[] fileArr = dir.GetFileSystemInfos();
Queue&FileSystemInfo& Folders = new Queue&FileSystemInfo&(dir.GetFileSystemInfos());
while (Folders.Count&0)
FileSystemInfo tmp = Folders.Dequeue();
FileInfo f = tmp as FileI
if (f == null)
DirectoryInfo d = tmp as DirectoryI
Directory.CreateDirectory(d.FullName.Replace((parent.LastIndexOf("") == parent.Length - 1) ? parent : parent + "", path));
foreach (FileSystemInfo fi in d.GetFileSystemInfos())
Folders.Enqueue(fi);
f.CopyTo(f.FullName.Replace(parent, path));
programming lover
PHP开发框架
开发工具/编程工具
服务器环境
ThinkSAAS商业授权:
ThinkSAAS为用户提供有偿个性定制开发服务
ThinkSAAS将为商业授权用户提供二次开发指导和技术支持
让ThinkSAAS更好,把建议拿来。
开发客服微信}

我要回帖

更多关于 错误代码system 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信