【#第一文档网# 导语】以下是®第一文档网的小编为您整理的《自己编写一个小病毒代码演示教学》,欢迎阅读!
如有侵权请联系网站删除 C# 代码 自己编写一个小程序, 类是病毒但无害, 就是会创建 50*50*26 个空文件夹, 运行过产生 30000 个文件夹就等不下去了,删除新建的文件夹估计要 10分钟,仅为娱乐 private void button4_Click( object sender, EventArgs e) IList temp_list = new List (); string path = 新建文件夹 " ;/**** 本人笔记本有 I 盘,同时为了删除方 便****/ // string path = Program Files" string pathFile = "" ; 用这行代码时估计你要崩溃 char [] arry = new char [26] {'a' ,'b' , 'c' ,'d' , 'e' , 'f' ,'g' , 'h' ,'i' , 'j' , 'k' , 'l' , 'm' ,'n' , 'o' , 'p' ,'q' , 'r' ,'s' t' ,'u' ,'v' ,'w' ,'x' , 'y' ,'z' }; try { for ( int p = 0; p < 50; p++) { for ( int k = 0; k < 50; k++) { for ( int i = 0; i < 26; i++) { temp_list.Add(i.ToString()); //temp_list.Add("num:" + i.ToString()); } temp_list = getListItems(temp_list, 26); for ( int i = 0; i < temp_list.Count; i++) { richTextBox1.Text += int .Parse(temp_list[i])]; arry[ pathFile += arry[ int .Parse(temp_list[i])]; if ( Directory .Exists(path + "\\" + pathFile))/*** 断文件夹是否存在,存在就删除该文件加 ***/ { .Delete(path + "\\" + pathFile); Directory Directory .CreateDirectory(path + System.IO. + pathFile);/**** } else { System.IO. + pathFile); /**** } "\\" 创建文件加 *****/ 创建文件加 *****/ Directory .CreateDirectory(path + "\\" richTextBox2.Text += temp_list[i]; if (pathFile.Length > 200)/*** 文件夹的名字超过 240字 符后会报错,故取 240以内都有效 ***/ 精品资料 本文来源:https://www.dywdw.cn/9864e9221837f111f18583d049649b6648d709f5.html