亚洲今日精彩视频_精品一级黄色_免费一级A片在现观看视频_8050福利视频 - 一级免费黄色片

首頁 新聞資訊 技術(shù)文章
C# 清理Cookies文件實(shí)例代碼

C# 清理Cookies文件實(shí)例代碼如下:


1.using System;
2.using System.IO;
3.using System.Windows.Forms;
4.
5.namespace WinFormTemp
6.{
7.    public partial class FormTemp : Form
8.    {
9.        public FormTemp()
10.        {
11.            InitializeComponent();
12.            this.HelpButton = true;
13.            this.MaximizeBox = false;
14.            this.MinimizeBox = false;
15.            this.AutoSizeMode = AutoSizeMode.GrowAndShrink; // 禁用手動調(diào)整大小。
16.            this.SizeGripStyle = SizeGripStyle.Hide; // 隱藏調(diào)整大小手柄。
17.            this.StartPosition = FormStartPosition.CenterScreen; // 在桌面居中顯示。
18.        }
19.
20.        protected override void OnLoad(EventArgs e)
21.        {
22.            base.OnLoad(e);
23.            DirectoryInfo dir = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.Cookies));
24.            foreach (FileInfo info in dir.GetFiles("*.txt"))
25.            {
26.                info.Delete();
27.            }
28.            System.Diagnostics.Process.Start(dir.FullName);
29.        }
30.
31.        protected override void OnHelpButtonClicked(System.ComponentModel.CancelEventArgs e)
32.        {
33.            base.OnHelpButtonClicked(e);
34.            e.Cancel = true;
35.            FileInfo info = new FileInfo("Clear.bat");
36.            if (info.Exists)
37.                info.Attributes = FileAttributes.Normal;
38.            using (StreamWriter sw = info.CreateText())
39.            {
40.                sw.WriteLine("@echo off");
41.                sw.Write(@"del /f /s /q ""{0}""", Environment.GetFolderPath(Environment.SpecialFolder.Cookies));
42.            }
43.            System.Diagnostics.Process.Start(info.DirectoryName);
44.        }
45.    }
46.}

 

版權(quán)所有:武漢網(wǎng)福互聯(lián)科技有限公司    鄂ICP備09022096號
業(yè)務(wù)QQ:23444550 客服QQ:267052100 電郵:23444550@qq.com  

鄂公網(wǎng)安備 42010602000905號

手機(jī)站二維碼