欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C#實(shí)現(xiàn)偽裝文件夾功能

 更新時間:2022年12月26日 09:51:07   作者:芝麻粒兒  
這篇文章主要為大家詳細(xì)介紹了如何利用C#實(shí)現(xiàn)偽裝文件夾的功能,文中的示例代碼講解詳細(xì),對我們學(xué)習(xí)C#有一定的幫助,感興趣的小伙伴可以跟隨小編一起了解一下

實(shí)踐過程

效果

代碼

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }
    private string GetFolType()
    {
        int Tid = comboBox1.SelectedIndex;
        switch (Tid)
        {
            case 0: return @"{20D04FE0-3AEA-1069-A2D8-08002B30309D}";
            case 1: return @"{450D8FBA-AD25-11D0-98A8-0800361B1103}";
            case 2: return @"{992CFFA0-F557-101A-88EC-00DD010CCC48}";
            case 3: return @"{21EC2020-3AEA-1069-A2DD-08002B30309D}";
            case 4: return @"{D6277990-4C6A-11CF-8D87-00AA0060F5BF}";
            case 5: return @"{2227A280-3AEA-1069-A2DE-08002B30309D}";
            case 6: return @"{208D2C60-3AEA-1069-A2D7-08002B30309D}";
            case 7: return @"{645FF040-5081-101B-9F08-00AA002F954E}";
            case 8: return @"{85BBD920-42A0-1069-A2E4-08002B30309D}";
            case 9: return @"{BD84B380-8CA2-1069-AB1D-08000948F534}";
            case 10: return @"{BDEADF00-C265-11d0-BCED-00A0C90AB50F}";
        }
        return @"{20D04FE0-3AEA-1069-A2D8-08002B30309D}";
    }
    private void button1_Click(object sender, EventArgs e)
    {
        if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
        {
            if (folderBrowserDialog1.SelectedPath.Length >= 4)
            {
                txtFolPath.Text = folderBrowserDialog1.SelectedPath;
            }
            else
            {
                MessageBox.Show("不能對盤符進(jìn)行偽裝", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        comboBox1.SelectedIndex = 0;
    }

    private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (comboBox1.SelectedIndex == 11)
        {
            txtID.ReadOnly = false;
            txtID.Text = "";
        }
        else
        {
            txtID.ReadOnly = true;
            txtID.Text = GetFolType();
        }

    }

    private void Camouflage(string str)
    {
        StreamWriter sw = File.CreateText(txtFolPath.Text.Trim() + @"\desktop.ini");
        sw.WriteLine(@"[.ShellClassInfo]");
        sw.WriteLine("CLSID=" + str);
        sw.Close();
        File.SetAttributes(txtFolPath.Text.Trim() + @"\desktop.ini", FileAttributes.Hidden);
        File.SetAttributes(txtFolPath.Text.Trim(), FileAttributes.System);
        MessageBox.Show("偽裝成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
    }

    private void button2_Click(object sender, EventArgs e)
    {
        if (this.txtFolPath.Text == "")
        {
            MessageBox.Show("請選擇文件夾路徑!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
        else
        {
            try
            {
                if (txtID.ReadOnly == false)
                {
                    string str = txtID.Text.Trim();
                    if (str.StartsWith("."))
                        str = str.Substring(1);
                    if (!str.StartsWith("{")||str.Trim().Length!=38)
                    {
                        MessageBox.Show("自定義類型錯誤!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        Camouflage(str);
                    }
                }
                else
                {
                    Camouflage(GetFolType());
                }
            }
            catch
            {
                MessageBox.Show ("不要進(jìn)行多次偽裝!","提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
            }
        }
    }

    private void button3_Click(object sender, EventArgs e)
    {
        if (txtFolPath.Text == "")
        {
            MessageBox.Show("請選擇加密過的文件夾!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Error);
        }
        else
        {
            try
            {
                FileInfo fi = new FileInfo(txtFolPath.Text.Trim() + @"\desktop.ini");
                if (!fi.Exists)
                {
                    MessageBox.Show("該文件夾沒有被偽裝!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    System.Threading.Thread.Sleep(1000);
                    File.Delete(txtFolPath.Text + @"\desktop.ini");
                    File.SetAttributes(txtFolPath.Text.Trim(), FileAttributes.System);
                    MessageBox.Show("還原成功", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch
            {
                MessageBox.Show("不要多次還原!");
            }
        }
    }
}
partial class Form1
{
    /// <summary>
    /// 必需的設(shè)計(jì)器變量。
    /// </summary>
    private System.ComponentModel.IContainer components = null;

    /// <summary>
    /// 清理所有正在使用的資源。
    /// </summary>
    /// <param name="disposing">如果應(yīng)釋放托管資源,為 true;否則為 false。</param>
    protected override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
        {
            components.Dispose();
        }
        base.Dispose(disposing);
    }

    #region Windows 窗體設(shè)計(jì)器生成的代碼

    /// <summary>
    /// 設(shè)計(jì)器支持所需的方法 - 不要
    /// 使用代碼編輯器修改此方法的內(nèi)容。
    /// </summary>
    private void InitializeComponent()
    {
        this.groupBox1 = new System.Windows.Forms.GroupBox();
        this.txtFolPath = new System.Windows.Forms.TextBox();
        this.button1 = new System.Windows.Forms.Button();
        this.label1 = new System.Windows.Forms.Label();
        this.groupBox2 = new System.Windows.Forms.GroupBox();
        this.txtID = new System.Windows.Forms.TextBox();
        this.label3 = new System.Windows.Forms.Label();
        this.comboBox1 = new System.Windows.Forms.ComboBox();
        this.label2 = new System.Windows.Forms.Label();
        this.groupBox3 = new System.Windows.Forms.GroupBox();
        this.button3 = new System.Windows.Forms.Button();
        this.button2 = new System.Windows.Forms.Button();
        this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
        this.groupBox1.SuspendLayout();
        this.groupBox2.SuspendLayout();
        this.groupBox3.SuspendLayout();
        this.SuspendLayout();
        // 
        // groupBox1
        // 
        this.groupBox1.Controls.Add(this.txtFolPath);
        this.groupBox1.Controls.Add(this.button1);
        this.groupBox1.Controls.Add(this.label1);
        this.groupBox1.ForeColor = System.Drawing.Color.Black;
        this.groupBox1.Location = new System.Drawing.Point(12, 8);
        this.groupBox1.Name = "groupBox1";
        this.groupBox1.Size = new System.Drawing.Size(431, 55);
        this.groupBox1.TabIndex = 1;
        this.groupBox1.TabStop = false;
        this.groupBox1.Text = "第一步:選擇文件夾";
        // 
        // txtFolPath
        // 
        this.txtFolPath.Location = new System.Drawing.Point(78, 22);
        this.txtFolPath.Name = "txtFolPath";
        this.txtFolPath.Size = new System.Drawing.Size(296, 21);
        this.txtFolPath.TabIndex = 0;
        // 
        // button1
        // 
        this.button1.Location = new System.Drawing.Point(380, 21);
        this.button1.Name = "button1";
        this.button1.Size = new System.Drawing.Size(43, 23);
        this.button1.TabIndex = 2;
        this.button1.Text = "選擇";
        this.button1.UseVisualStyleBackColor = true;
        this.button1.Click += new System.EventHandler(this.button1_Click);
        // 
        // label1
        // 
        this.label1.AutoSize = true;
        this.label1.Location = new System.Drawing.Point(6, 25);
        this.label1.Name = "label1";
        this.label1.Size = new System.Drawing.Size(77, 12);
        this.label1.TabIndex = 1;
        this.label1.Text = "文件夾路徑:";
        // 
        // groupBox2
        // 
        this.groupBox2.Controls.Add(this.txtID);
        this.groupBox2.Controls.Add(this.label3);
        this.groupBox2.Controls.Add(this.comboBox1);
        this.groupBox2.Controls.Add(this.label2);
        this.groupBox2.ForeColor = System.Drawing.Color.Black;
        this.groupBox2.Location = new System.Drawing.Point(12, 69);
        this.groupBox2.Name = "groupBox2";
        this.groupBox2.Size = new System.Drawing.Size(431, 99);
        this.groupBox2.TabIndex = 2;
        this.groupBox2.TabStop = false;
        this.groupBox2.Text = "第二部:選擇偽裝的類型";
        // 
        // txtID
        // 
        this.txtID.Location = new System.Drawing.Point(103, 57);
        this.txtID.Name = "txtID";
        this.txtID.ReadOnly = true;
        this.txtID.Size = new System.Drawing.Size(320, 21);
        this.txtID.TabIndex = 3;
        // 
        // label3
        // 
        this.label3.AutoSize = true;
        this.label3.Location = new System.Drawing.Point(20, 60);
        this.label3.Name = "label3";
        this.label3.Size = new System.Drawing.Size(77, 12);
        this.label3.TabIndex = 2;
        this.label3.Text = "自定義類型:";
        // 
        // comboBox1
        // 
        this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
        this.comboBox1.FormattingEnabled = true;
        this.comboBox1.Items.AddRange(new object[] {
        "我的電腦",
        "我的文檔",
        "撥號網(wǎng)絡(luò)",
        "控制面板",
        "計(jì)劃任務(wù)",
        "打印機(jī)",
        "網(wǎng)絡(luò)鄰居",
        "回收站",
        "公文包",
        "字體",
        "Web 文件夾",
        "自定義ID"});
        this.comboBox1.Location = new System.Drawing.Point(101, 26);
        this.comboBox1.Name = "comboBox1";
        this.comboBox1.Size = new System.Drawing.Size(322, 20);
        this.comboBox1.TabIndex = 1;
        this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
        // 
        // label2
        // 
        this.label2.AutoSize = true;
        this.label2.Location = new System.Drawing.Point(8, 30);
        this.label2.Name = "label2";
        this.label2.Size = new System.Drawing.Size(89, 12);
        this.label2.TabIndex = 0;
        this.label2.Text = "選擇偽裝類型:";
        // 
        // groupBox3
        // 
        this.groupBox3.Controls.Add(this.button3);
        this.groupBox3.Controls.Add(this.button2);
        this.groupBox3.ForeColor = System.Drawing.Color.Black;
        this.groupBox3.Location = new System.Drawing.Point(12, 174);
        this.groupBox3.Name = "groupBox3";
        this.groupBox3.Size = new System.Drawing.Size(431, 53);
        this.groupBox3.TabIndex = 3;
        this.groupBox3.TabStop = false;
        this.groupBox3.Text = "第三部:操作";
        // 
        // button3
        // 
        this.button3.Location = new System.Drawing.Point(230, 20);
        this.button3.Name = "button3";
        this.button3.Size = new System.Drawing.Size(75, 23);
        this.button3.TabIndex = 1;
        this.button3.Text = "還原";
        this.button3.UseVisualStyleBackColor = true;
        this.button3.Click += new System.EventHandler(this.button3_Click);
        // 
        // button2
        // 
        this.button2.Location = new System.Drawing.Point(127, 20);
        this.button2.Name = "button2";
        this.button2.Size = new System.Drawing.Size(75, 23);
        this.button2.TabIndex = 0;
        this.button2.Text = "偽裝";
        this.button2.UseVisualStyleBackColor = true;
        this.button2.Click += new System.EventHandler(this.button2_Click);
        // 
        // Form1
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(452, 233);
        this.Controls.Add(this.groupBox3);
        this.Controls.Add(this.groupBox2);
        this.Controls.Add(this.groupBox1);
        this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
        this.MaximizeBox = false;
        this.Name = "Form1";
        this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
        this.Text = "偽裝文件夾";
        this.Load += new System.EventHandler(this.Form1_Load);
        this.groupBox1.ResumeLayout(false);
        this.groupBox1.PerformLayout();
        this.groupBox2.ResumeLayout(false);
        this.groupBox2.PerformLayout();
        this.groupBox3.ResumeLayout(false);
        this.ResumeLayout(false);

    }

    #endregion

    private System.Windows.Forms.GroupBox groupBox1;
    private System.Windows.Forms.TextBox txtFolPath;
    private System.Windows.Forms.Button button1;
    private System.Windows.Forms.Label label1;
    private System.Windows.Forms.GroupBox groupBox2;
    private System.Windows.Forms.GroupBox groupBox3;
    private System.Windows.Forms.Button button3;
    private System.Windows.Forms.Button button2;
    private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1;
    private System.Windows.Forms.ComboBox comboBox1;
    private System.Windows.Forms.Label label2;
    private System.Windows.Forms.TextBox txtID;
    private System.Windows.Forms.Label label3;
}

到此這篇關(guān)于C#實(shí)現(xiàn)偽裝文件夾功能的文章就介紹到這了,更多相關(guān)C#偽裝文件夾內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • C# 8.0可空引用類型的使用注意記錄

    C# 8.0可空引用類型的使用注意記錄

    這篇文章主要給大家介紹了關(guān)于C# 8.0可空引用類型使用注意的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家學(xué)習(xí)或者使用C#具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-04-04
  • 詳解C#如何手動改變自制窗體的大小

    詳解C#如何手動改變自制窗體的大小

    這篇文章主要為大家詳細(xì)介紹了在C#中如何實(shí)現(xiàn)手動改變自制窗體的大小,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下
    2024-03-03
  • C#獲取指定目錄下某種格式文件集并備份到指定文件夾

    C#獲取指定目錄下某種格式文件集并備份到指定文件夾

    這篇文章介紹了C#獲取指定目錄下某種格式文件集并備份到指定文件夾的方法,文中通過示例代碼介紹的非常詳細(xì)。對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2022-04-04
  • C#設(shè)置軟件開機(jī)自動運(yùn)行的方法(修改注冊表)

    C#設(shè)置軟件開機(jī)自動運(yùn)行的方法(修改注冊表)

    這篇文章主要介紹了C#設(shè)置軟件開機(jī)自動運(yùn)行的方法,通過簡單修改注冊表開機(jī)啟動項(xiàng)實(shí)現(xiàn)軟件的開機(jī)啟動功能,非常簡單實(shí)用,需要的朋友可以參考下
    2016-06-06
  • C#使用IronPython調(diào)用Python的實(shí)現(xiàn)

    C#使用IronPython調(diào)用Python的實(shí)現(xiàn)

    本文主要介紹了C#使用IronPython調(diào)用Python的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2023-02-02
  • C# ping網(wǎng)絡(luò)IP 實(shí)現(xiàn)網(wǎng)絡(luò)狀態(tài)檢測的方法

    C# ping網(wǎng)絡(luò)IP 實(shí)現(xiàn)網(wǎng)絡(luò)狀態(tài)檢測的方法

    下面小編就為大家?guī)硪黄狢# ping網(wǎng)絡(luò)IP 實(shí)現(xiàn)網(wǎng)絡(luò)狀態(tài)檢測的方法。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2016-08-08
  • C#調(diào)用exe文件的方法詳解

    C#調(diào)用exe文件的方法詳解

    這篇文章主要為大家詳細(xì)介紹了C#調(diào)用exe文件的相關(guān)方法,文中的示例代碼講解詳細(xì),具有一定的借鑒價(jià)值,有需要的小伙伴可以參考一下
    2024-04-04
  • 解析C#中斷言與異常的應(yīng)用方式及異常處理的流程控制

    解析C#中斷言與異常的應(yīng)用方式及異常處理的流程控制

    這篇文章主要介紹了C#中斷言與異常的應(yīng)用方式及異常處理的流程控制,一般來說斷言用于修正程序員自己的錯誤而異常用于應(yīng)對程序運(yùn)行過程中可能出現(xiàn)的錯誤,需要的朋友可以參考下
    2016-01-01
  • C#獲取HTML文本的第一張圖片與截取內(nèi)容摘要示例代碼

    C#獲取HTML文本的第一張圖片與截取內(nèi)容摘要示例代碼

    在日常web開發(fā)的時候,經(jīng)常會遇到需要獲取保存的HTML文本中的第一張圖片,并且截取內(nèi)容摘要的效果,例如織夢的后臺添加完詳細(xì)內(nèi)容后就是自動讀取內(nèi)容摘要,并保存第一張圖片為縮略圖,那么這篇文章跟大家分享下利用C#如何實(shí)現(xiàn),感興趣的朋友們下面來一起看看吧。
    2016-10-10
  • C# 執(zhí)行CMD命令并接收返回結(jié)果的操作方式

    C# 執(zhí)行CMD命令并接收返回結(jié)果的操作方式

    這篇文章主要介紹了C# 執(zhí)行CMD命令并接收返回結(jié)果的操作方式,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2021-04-04

最新評論