C# winfrom 寫的一個搜索助手,可以按照標題和內容搜索,支持doc,xls,ppt,pdf,txt等格式的文件搜索

来源:https://www.cnblogs.com/zhuifengnianshao/archive/2018/12/14/10117801.html
-Advertisement-
Play Games

C# winfrom 寫的一個搜索助手,可以按照標題和內容搜索,指定目錄後,遍歷搜索文件和子目,現在只寫了支持.DOC.DOCX.XLS.XLSX.PPT.PPTX.PDF.HTML.HTM.TXT等格式的文件搜索,讀取execl 內容使用的是NPOI組件,doc,html,txt 格式的使用Str ...


 

C# winfrom 寫的一個搜索助手,可以按照標題和內容搜索,指定目錄後,遍歷搜索文件和子目,現在只寫了支持.DOC.DOCX.XLS.XLSX.PPT.PPTX.PDF.HTML.HTM.TXT等格式的文件搜索,讀取execl 內容使用的是NPOI組件,doc,html,txt 格式的使用StreamReader 流文件讀取方式,ppt,pdf使用的Spire組件。

直接上代碼

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
using System.Security.AccessControl;
using NPOI.SS.UserModel;
using NPOI.HSSF.UserModel;
using NPOI.XSSF.UserModel;
using Spire.Presentation;
using Spire.Pdf;

namespace Search
{
    public partial class formMain : Form
    {
        public formMain()
        {
            InitializeComponent();
        }
        //選擇文件路徑
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                FolderBrowserDialog dialog = new FolderBrowserDialog();
                dialog.Description = "請選擇文件路徑";
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    string foldPath = dialog.SelectedPath;
                    textBox1.Text = foldPath;
                    //把選擇路徑存儲在註冊表
                    Application.UserAppDataRegistry.SetValue("ZMJASearchPath", foldPath);
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
           try
            {
                string foldPath = textBox1.Text;
                if (string.IsNullOrEmpty(foldPath))
                {
                    MessageBox.Show("請選擇文件路徑!");
                    return;
                }
                string searckkey = textBox2.Text;
                if (string.IsNullOrEmpty(searckkey))
                {
                    MessageBox.Show("請輸入搜索關鍵字!");
                    return;
                }
                string extension = comboBox1.Text;
                if (!string.IsNullOrEmpty(extension))
                {
                    extension = extension.ToUpper();
                    switch (extension)
                    {
                        case ".HTML":
                            extension = ".HTML.HTM";
                            break;
                        case ".DOC":
                            extension = ".DOC.DOCX";
                            break;
                        case ".XLS":
                            extension = ".XLS.XLSX";
                            break;
                        case ".PPT":
                            extension = ".PPT.PPTX";
                            break;
                        default:
                            break;
                    }
                }
                else {
                    extension = ".DOC.DOCX.XLS.XLSX.PPT.PPTX.PDF.HTML.HTM.TXT";
                }
                dataGridView1.Rows.Clear();
                listDirectory(@foldPath, extension, comboBox2.Text, searckkey);

                lbmessage.Text = "";
                MessageBox.Show("搜索完畢");
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }

         /// <summary>
         /// 列出path路徑對應的文件夾中的子文件夾和文件
         /// 然後再遞歸列出子文件夾內的文件和文件夾
         /// </summary>
         /// <param name="path">需要搜索文件夾的路徑</param>
         public void listDirectory(string path,string extension, string coding,string searckkey)
         {
             DirectoryInfo theFolder = new DirectoryInfo(@path);
             DirectorySecurity s = new DirectorySecurity(path, AccessControlSections.Access);
            //判斷目錄是否 可以訪問  
            if (!s.AreAccessRulesProtected)
            {

                foreach (FileInfo file in theFolder.GetFiles())
                {
                    if (string.IsNullOrEmpty(extension) || extension.Contains(file.Extension.ToUpper()))
                    {
                        lbmessage.Text = "正在搜索文件:" + path + "\\" + file.Name;
                        Application.DoEvents();

                        #region 僅檢索標題
                        if (comboBox3.Text == "僅標題")
                        {
                            if (file.Name.Contains(searckkey))
                            {
                                int index = this.dataGridView1.Rows.Add();
                                this.dataGridView1.Rows[index].Cells[0].Value = index + 1;
                                this.dataGridView1.Rows[index].Cells[1].Value = file.Name;
                                this.dataGridView1.Rows[index].Cells[2].Value = path + "\\" + file.Name;
                                break;
                            }
                        }
                        #endregion

                        #region 標題和內容都檢索
                        else
                        {
                            #region 檢索判斷標題
                            //預設檢索 先搜索標題是否有,如果有,則退出迴圈,如果沒有,再檢索內容
                            if (file.Name.Contains(searckkey))
                            {
                                int index = this.dataGridView1.Rows.Add();
                                this.dataGridView1.Rows[index].Cells[0].Value = index + 1;
                                this.dataGridView1.Rows[index].Cells[1].Value = file.Name;
                                this.dataGridView1.Rows[index].Cells[2].Value = path + "\\" + file.Name;
                                break;
                            }
                            #endregion 

                            using (FileStream fs = new FileStream(path + "\\" + file.Name, FileMode.Open, FileAccess.Read))
                            {
                                #region 讀取Execl

                                if (file.Extension.ToUpper().Contains(".XLS"))
                                {
                                    try
                                    {
                                        IWorkbook workbook = null;//全局workbook
                                        ISheet sheet;//sheet
                                        switch (file.Extension)
                                        {
                                            //xls是03,用HSSFWorkbook打開,.xlsx是07或者10用XSSFWorkbook打開
                                            case ".xls": workbook = new HSSFWorkbook(fs); break;
                                            case ".xlsx": workbook = new XSSFWorkbook(fs); break;
                                            default: break;
                                        }
                                        fs.Close();//關閉文件流
                                        if (workbook != null)
                                        {
                                            int count = workbook.NumberOfSheets;
                                            bool bo = false; //bo初始化為假
                                            for (int index = 0; index < count; index++)
                                            {
                                                if (bo)//如果bo為真
                                                    break;//退出第一層迴圈
                                                sheet = workbook.GetSheetAt(index);//讀取到指定的sheet
                                                                                   //遍歷讀取cell
                                                for (int i = sheet.FirstRowNum; i <= sheet.LastRowNum; i++)
                                                {
                                                    if (bo)//如果bo為真
                                                        break;//退出第二層迴圈
                                                    IRow row = sheet.GetRow(i);//得到一行
                                                    if (row != null)
                                                    {
                                                        for (int j = row.FirstCellNum; j < row.LastCellNum; j++)
                                                        {
                                                            ICell cell = row.GetCell(j);//得到cell
                                                            if (cell != null)//如果cell為null,則賦值為空
                                                            {
                                                                if (row.GetCell(j).ToString().Contains(searckkey))
                                                                {
                                                                    int GridIndex = this.dataGridView1.Rows.Add();
                                                                    this.dataGridView1.Rows[GridIndex].Cells[0].Value = GridIndex + 1;
                                                                    this.dataGridView1.Rows[GridIndex].Cells[1].Value = file.Name;
                                                                    this.dataGridView1.Rows[GridIndex].Cells[2].Value = path + "\\" + file.Name;
                                                                    bo = true;//bo賦為真
                                                                    break;//退出第三層迴圈
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        //釋放資源
                                        workbook = null;
                                        sheet = null;
                                    }
                                    catch (Exception err)
                                    {
                                        //MessageBox.Show(err.Message);
                                    }
                                }
                                #endregion

                                #region 讀取ppt內容
                                else if (file.Extension.ToUpper().Contains(".PPT"))
                                {
                                    try
                                    {
                                        //初始化一個Presentation類實例,並載入文檔
                                        Presentation ppt = new Presentation();
                                        ppt.LoadFromFile(path + "\\" + file.Name);
                                        bool bo = false;
                                        foreach (ISlide slide in ppt.Slides)
                                        {
                                            if (bo)//如果bo為真
                                                break;//退出第一層迴圈
                                            foreach (Spire.Presentation.IShape shape in slide.Shapes)
                                            {
                                                if (bo)//如果bo為真
                                                    break;//退出第一層迴圈
                                                if (shape is IAutoShape)
                                                {
                                                    foreach (TextParagraph tp in (shape as IAutoShape).TextFrame.Paragraphs)
                                                    {
                                                        if (tp.Text.Contains(searckkey))
                                                        {
                                                            int GridIndex = this.dataGridView1.Rows.Add();
                                                            this.dataGridView1.Rows[GridIndex].Cells[0].Value = GridIndex + 1;
                                                            this.dataGridView1.Rows[GridIndex].Cells[1].Value = file.Name;
                                                            this.dataGridView1.Rows[GridIndex].Cells[2].Value = path + "\\" + file.Name;
                                                            bo = true;//bo賦為真
                                                            break;//退出第三層迴圈
                                                        }
                                                    }
                                                }

                                            }
                                        }
                                        ppt = null; //釋放資源
                                    }
                                    catch (Exception err)
                                    {
                                        //MessageBox.Show(err.Message);
                                    }
                                }
                                #endregion

                                #region 讀取pdf文件
                                else if (file.Extension.ToUpper().Contains(".PDF")) {
                                    try
                                    {
                                        PdfDocument pdf= new PdfDocument();
                                        pdf.LoadFromFile(@path + "\\" + file.Name);
                                        foreach (PdfPageBase page in pdf.Pages)
                                        {
                                            string content = page.ExtractText();
                                            if (content.Contains(searckkey)) {
                                                int GridIndex = this.dataGridView1.Rows.Add();
                                                this.dataGridView1.Rows[GridIndex].Cells[0].Value = GridIndex + 1;
                                                this.dataGridView1.Rows[GridIndex].Cells[1].Value = file.Name;
                                                this.dataGridView1.Rows[GridIndex].Cells[2].Value = path + "\\" + file.Name;
                                                break;
                                            }
                                        }
                                        pdf = null;//釋放資源
                                    }
                                    catch (Exception err) {

                                    }
                                }
                                #endregion

                                #region 讀取其他文本文件
                                else
                                {
                                    Encoding codingType = Encoding.Default;
                                    if (!string.IsNullOrEmpty(coding))
                                    {
                                        codingType = Encoding.GetEncoding(coding.ToUpper());
                                    }
                                    else
                                    {
                                        codingType = common.GetType(path + "\\" + file.Name);
                                    }
                                    StreamReader sr = new StreamReader(fs, codingType);
                                    String str;
                                    while ((str = sr.ReadLine()) != null)
                                    {
                                        if (str.Contains(searckkey))
                                        {
                                            int index = this.dataGridView1.Rows.Add();
                                            this.dataGridView1.Rows[index].Cells[0].Value = index + 1;
                                            this.dataGridView1.Rows[index].Cells[1].Value = file.Name;
                                            this.dataGridView1.Rows[index].Cells[2].Value = path + "\\" + file.Name;
                                            sr.Close();
                                            fs.Close();
                                            break;
                                        }
                                    }
                                }
                                #endregion

                            }
                        }

                        #endregion
                    }
                }
            }
             //遍歷文件夾
             foreach (DirectoryInfo NextFolder in theFolder.GetDirectories())
             {
                if ((NextFolder.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden) {
                    listDirectory(NextFolder.FullName,extension, coding,searckkey);
                }
            }
         }

        private void OpenFolderAndSelectFile(String fileFullName)
        {
            System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("Explorer.exe");
            psi.Arguments = "/e,/select," + fileFullName;
            System.Diagnostics.Process.Start(psi);
        }
        private void dataGridView1_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
        {

        }
        //刪除文件,這裡是一個偽刪除了,直接把文件移動到deleteData文件夾中,如果需要刪除手動刪除
        private void button3_Click(object sender, EventArgs e)
        { 
            try
            {
                int count = 0;
                int totalCount = dataGridView1.RowCount;
                string foldPath = textBox1.Text;
                string filderPath = @foldPath + "\\DeleteData";
                string fileName = "";
                if (Directory.Exists(filderPath) == false)
                {
                    //如果不存
                    Directory.CreateDirectory(filderPath);
                }
                for (int i = 0; i < dataGridView1.RowCount; i++)
                {
                    lbmessage.Text = "正在刪除文件:" + dataGridView1.Rows[i].Cells[2].Value.ToString();
                    Application.DoEvents();
                    count += 1;
                    fileName = dataGridView1.Rows[i].Cells[1].Value.ToString();
                    File.Move(dataGridView1.Rows[i].Cells[2].Value.ToString(), filderPath + "\\" + fileName);
                }
                dataGridView1.Rows.Clear();
                lbmessage.Text = "";
                MessageBox.Show("刪除完畢");
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
            finally {
                lbmessage.Text = "";
            }
        }

        //清空列表
        private void button4_Click(object sender, EventArgs e)
        {
            dataGridView1.Rows.Clear();
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string extension = comboBox1.Text;
            if (!string.IsNullOrEmpty(extension))
            {
                extension = extension.ToUpper();
                switch (extension)
                {
                    case ".HTML":
                        comboBox2.SelectedIndex = comboBox2.Items.IndexOf("UTF-8");
                        break;
                    case ".DOC":
                        comboBox2.SelectedIndex = comboBox2.Items.IndexOf("Unicode");
                        break;
                    default:
                       
                        break;
                }
            }
        }

        //預設載入
        private void formMain_Load(object sender, EventArgs e)
        {
            //預設是全部搜索模式
            comboBox3.SelectedText = "全部";
            //從註冊表把選擇路徑讀取出來
            textBox1.Text = Application.UserAppDataRegistry.GetValue("ZMJASearchPath") as string;
        }

        //雙擊單元格打開文件所在位置
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.ColumnIndex < 0 || e.RowIndex < 0)
                {
                    MessageBox.Show("請選擇要打開的文件");
                    return;
                }
                int index = dataGridView1.CurrentCell.RowIndex;
                System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("Explorer.exe");
                psi.Arguments = "/e,/select," + dataGridView1.Rows[index].Cells[2].Value.ToString();
                System.Diagnostics.Process.Start(psi);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }
        //右鍵快捷菜單打開文件所在位置
        private void 打開文件所在位置ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (dataGridView1.CurrentRow == null)
                {
                    MessageBox.Show("請選擇要打開的文件");
                    return;
                }
                int index = dataGridView1.CurrentCell.RowIndex;
                System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("Explorer.exe");
                psi.Arguments = "/e,/select," + dataGridView1.Rows[index].Cells[2].Value.ToString();
                System.Diagnostics.Process.Start(psi);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }

        //雙擊文本框選擇路徑
        private void textBox1_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                FolderBrowserDialog dialog = new FolderBrowserDialog();
                dialog.Description = "請選擇文件路徑";
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    string foldPath = dialog.SelectedPath;
                    textBox1.Text = foldPath;
                    //把選擇路徑存儲在註冊表
                    Application.UserAppDataRegistry.SetValue("ZMJASearchPath", foldPath);
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }
    }
}

參考博客園裡獲取文件編碼格式的類

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Search
{
    public class common
    {
        //編碼問題目前為止,基本上沒人解決,就連windows的IE的自動識別有時還識別錯編碼呢
        //如果文件有BOM則判斷,如果沒有就用系統預設編碼,缺點:沒有BOM的非系統編碼文件會顯示亂碼。   
        //調用方法: common.GetType(filename)    
        public static System.Text.Encoding GetType(string FILE_NAME)
        {
            using (FileStream fs = new FileStream(FILE_NAME, FileMode.Open, FileAccess.Read))
            {
                System.Text.Encoding r = GetType(fs);
                fs.Close();
                return r;
            }
        }
        /// <summary> 
        /// 通過給定的文件流,判斷文件的編碼類型 
        /// </summary> 
        /// <param name="fs">文件流</param> 
        /// <returns>文件的編碼類型</returns> 
        public static System.Text.Encoding GetType(FileStream fs)
        {
            byte[] Unicode = new byte[] { 0xFF, 0xFE, 0x41 };
            byte[] UnicodeBIG = new byte[] { 0xFE, 0xFF, 0x00 };
            byte[] UTF8 = new byte[] { 0xEF, 0xBB, 0xBF }; //帶BOM 
            Encoding reVal = Encoding.Default;

            BinaryReader r = new BinaryReader(fs, System.Text.Encoding.Default);
            int i;
            int.TryParse(fs.Length.ToString(), out i);
            byte[] ss = r.ReadBytes(i);
            if (IsUTF8Bytes(ss) || (ss[0] == 0xEF && ss[1] == 0xBB && ss[2] == 0xBF))
            {
                reVal = Encoding.UTF8;
            }
            else if (ss[0] == 0xFE && ss[1] == 0xFF && ss[2] == 0x00)
            {
                reVal = Encoding.BigEndianUnicode;
            }
            else if (ss[0] == 0xFF && ss[1] == 0xFE && ss[2] == 0x41)
            {
                reVal = Encoding.Unicode;
            }
            r.Close();
            return reVal;

        }

        /// <summary> 
        /// 判斷是否是不帶 BOM 的 UTF8 格式 
        /// </summary> 
        /// <param name=“data“></param> 
        /// <returns></returns> 
        private static bool IsUTF8Bytes(byte[] data)
        {
            int charByteCounter = 1; //計算當前正分析的字元應還有的位元組數 
            byte curByte; //當前分析的位元組. 
            for (int i = 0; i < data.Length; i++)
            {
                curByte = data[i];
                if (charByteCounter == 1)
                {
                    if (curByte >= 0x80)
                    {
                        //判斷當前 
                        while (((curByte <<= 1) & 0x80) != 0)
                        {
                            charByteCounter++;
                        }
                        //標記位首位若為非0 則至少以2個1開始 如:110XXXXX...........1111110X 
                        if (charByteCounter == 1 || charByteCounter > 6)
                        {
                            return false;
                        }
                    }
                }
                else
                {
                    //若是UTF-8 此時第一位必須為1 
                    if ((curByte & 0xC0) != 0x80)
                    {
                        return false;
                    }
                    charByteCounter--;
                }
            }
            if (charByteCounter > 1)
            {
                throw new Exception("非預期的byte格式");
            }
            return true;
        }
    }
}

 


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 第一部分 Flask簡介 前言:想熟練掌握一門web框架,為以後即將誕生的測試工具集做準備。為什麼選擇flask要做熟練掌握的一門框架,而不是其他的,最主要的原因是可以隨意定製。 特別提醒:這本書的代碼會提交在github,有基礎的人可以直接看github的代碼來學習flask。基礎差還是建議買書來 ...
  • 上一章我們講了pod的hostip模式,但在生產環境中,我們都是通過service來訪問k8s集群的,service有兩種模式來暴漏埠,今天我們來分享一下 1.clusterIP模式 我們在創建service的時候,預設創建的時clusterIP模式,clusterIP模式的特點是只能在node節 ...
  • 大概看了下C#官方提供的IObservable介面以及IObserver介面來實現發佈和訂閱,寫的很標準,很有代表性,做下筆記,以後要是項目需要用到發佈訂閱再基於自己的需求改: public class BaggageInfo { private int flightNo; private stri ...
  • 問題:bootstrap-table載入數據不顯示 @{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Layout.cshtml";}<script> $(function () { InitMainTable(); document.onk ...
  • 使用NPOI 操作Excel 個人使用的電腦基本預設安裝Excel 操作起來 調用Excel的組件便可.如果是一臺伺服器.沒有安裝Excel,也就無法調用Excel組件. 在此推薦第三方插件.NPOI 支持XLS(2007)和XLSX(2012)讀寫. 讀: 寫: 消息在Rabbit中.A接觸Rab ...
  • 事件系統用途廣泛,對處理玩家數據有很大幫助(玩家金幣,經驗,等級),讓數據多次調用,降低耦合 在unity中應用(以玩家金幣發生變化來演示); 1).註冊監聽 2).移出監聽 3).金幣發生變化的時候,通知每個界面 操作: 1.將Event三個腳本導入工程中; 2.寫一個腳本,PlayerInfor ...
  • 在我們Winform開發中,往往需要涉及到附件的統一管理,因此我傾向於把它們獨立出來作為一個附件管理模塊,這樣各個模塊都可以使用這個附件管理模塊,更好的實現模塊重用的目的。在涉及附件管理的場景中,一個數據記錄可能對應多個附件組場景,每個附件組則涉及附件多個文件,往往這些附件可能放置的目錄會有所不同,... ...
  • 2.1 控制器的角色 MVC模式中的控制器(Controller)主要負責響應用戶的輸入,冰球在響應時修改模型(Model)。通過這種方式,MVC模式中的控制器主要關註的是應用程式流、輸入數據的處理,以及對相關視圖(View)輸出數據的提供。 URL首先告知陸游機制去實例化哪個控制器,調用哪個操作方 ...
一周排行
    -Advertisement-
    Play Games
  • 示例項目結構 在 Visual Studio 中創建一個 WinForms 應用程式後,項目結構如下所示: MyWinFormsApp/ │ ├───Properties/ │ └───Settings.settings │ ├───bin/ │ ├───Debug/ │ └───Release/ ...
  • [STAThread] 特性用於需要與 COM 組件交互的應用程式,尤其是依賴單線程模型(如 Windows Forms 應用程式)的組件。在 STA 模式下,線程擁有自己的消息迴圈,這對於處理用戶界面和某些 COM 組件是必要的。 [STAThread] static void Main(stri ...
  • 在WinForm中使用全局異常捕獲處理 在WinForm應用程式中,全局異常捕獲是確保程式穩定性的關鍵。通過在Program類的Main方法中設置全局異常處理,可以有效地捕獲並處理未預見的異常,從而避免程式崩潰。 註冊全局異常事件 [STAThread] static void Main() { / ...
  • 前言 給大家推薦一款開源的 Winform 控制項庫,可以幫助我們開發更加美觀、漂亮的 WinForm 界面。 項目介紹 SunnyUI.NET 是一個基於 .NET Framework 4.0+、.NET 6、.NET 7 和 .NET 8 的 WinForm 開源控制項庫,同時也提供了工具類庫、擴展 ...
  • 說明 該文章是屬於OverallAuth2.0系列文章,每周更新一篇該系列文章(從0到1完成系統開發)。 該系統文章,我會儘量說的非常詳細,做到不管新手、老手都能看懂。 說明:OverallAuth2.0 是一個簡單、易懂、功能強大的許可權+可視化流程管理系統。 有興趣的朋友,請關註我吧(*^▽^*) ...
  • 一、下載安裝 1.下載git 必須先下載並安裝git,再TortoiseGit下載安裝 git安裝參考教程:https://blog.csdn.net/mukes/article/details/115693833 2.TortoiseGit下載與安裝 TortoiseGit,Git客戶端,32/6 ...
  • 前言 在項目開發過程中,理解數據結構和演算法如同掌握蓋房子的秘訣。演算法不僅能幫助我們編寫高效、優質的代碼,還能解決項目中遇到的各種難題。 給大家推薦一個支持C#的開源免費、新手友好的數據結構與演算法入門教程:Hello演算法。 項目介紹 《Hello Algo》是一本開源免費、新手友好的數據結構與演算法入門 ...
  • 1.生成單個Proto.bat內容 @rem Copyright 2016, Google Inc. @rem All rights reserved. @rem @rem Redistribution and use in source and binary forms, with or with ...
  • 一:背景 1. 講故事 前段時間有位朋友找到我,說他的窗體程式在客戶這邊出現了卡死,讓我幫忙看下怎麼回事?dump也生成了,既然有dump了那就上 windbg 分析吧。 二:WinDbg 分析 1. 為什麼會卡死 窗體程式的卡死,入口門檻很低,後續往下分析就不一定了,不管怎麼說先用 !clrsta ...
  • 前言 人工智慧時代,人臉識別技術已成為安全驗證、身份識別和用戶交互的關鍵工具。 給大家推薦一款.NET 開源提供了強大的人臉識別 API,工具不僅易於集成,還具備高效處理能力。 本文將介紹一款如何利用這些API,為我們的項目添加智能識別的亮點。 項目介紹 GitHub 上擁有 1.2k 星標的 C# ...