C# WPF 實現讀取文件夾中的PDF并顯示其頁數

文章目錄

      • 技術選型
      • 第一步:創建項目并安裝依賴庫
      • 第二步:定義數據模型 (Model)
      • 第三步:創建視圖模型 (ViewModel)
      • 第四步:設計用戶界面 (View)
      • 總結與解釋
      • 后記
        • 關于轉換器的錯誤

工作中需要整理一些PDF格式文件,程序員的存在就是為了讓大家可以“更高效地工作”,而AI的出現就可以讓程序更“高效地工作”,于是求助于很長(我指上下文)的Gemini,它幫助了我快速搭建項目,但也給我留下了坑(見本文“后記”部分),于是我把這個開發過程記錄了下來。

技術選型

  • UI框架: WPF (.NET 6/7/8 或 .NET Framework 4.7.2+) - 用于構建現代化的Windows桌面應用。
  • PDF處理: iText (替代了舊版的 iTextSharp 及 iText7) - 一個強大且流行的開源PDF處理庫。
  • Excel導出: NPOI - 一個開源的.NET庫,可以讀寫Office文檔,無需安裝Microsoft Office。
  • 設計模式: MVVM - 使UI和業務邏輯分離,提高代碼的可測試性和復用性。

第一步:創建項目并安裝依賴庫

  1. 打開 Visual Studio,創建一個新的 WPF 應用程序 項目(本文為.net 8.0項目)。
    項目類型

  2. 通過 NuGet 包管理器安裝以下必要的庫。在“解決方案資源管理器”中右鍵點擊你的項目,選擇“管理NuGet程序包”,然后搜索并安裝:

    • iText
    • NPOI
    • Microsoft.WindowsAPICodePack-Shell (為了一個更好看的文件夾選擇對話框)
      主要NuGet包

第二步:定義數據模型 (Model)

這是我們用來存儲每個PDF文件信息的類。

PdfFileInfo.cs

namespace PdfFileScanner
{public class PdfFileInfo{public string FileName { get; set; } = string.Empty;public int PageCount { get; set; }public string FileSize { get; set; } = string.Empty;}
}

第三步:創建視圖模型 (ViewModel)

ViewModel 是連接視圖和模型的橋梁,包含了所有的業務邏輯和UI狀態,在這里,我按照AI的提示創建了MainViewModel類。

MainViewModel.cs

using iText.Kernel.Pdf;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using Microsoft.Win32;
using Microsoft.WindowsAPICodePack.Dialogs; // For modern folder browsernamespace PdfFileScanner
{public class MainViewModel : INotifyPropertyChanged{// INotifyPropertyChanged 實現,用于通知UI屬性已更改public event PropertyChangedEventHandler? PropertyChanged;protected virtual void OnPropertyChanged(string propertyName){PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));}// 存儲PDF文件信息的集合,ObservableCollection能自動通知UI更新public ObservableCollection<PdfFileInfo> PdfFiles { get; } = new ObservableCollection<PdfFileInfo>();private string _statusText = "請選擇一個文件夾...";public string StatusText{get => _statusText;set { _statusText = value; OnPropertyChanged(nameof(StatusText)); }}private double _progressValue;public double ProgressValue{get => _progressValue;set { _progressValue = value; OnPropertyChanged(nameof(ProgressValue)); }}private bool _isBusy;public bool IsBusy{get => _isBusy;set{_isBusy = value;OnPropertyChanged(nameof(IsBusy));// 當IsBusy狀態改變時,通知命令重新評估其能否執行((RelayCommand)SelectFolderCommand).RaiseCanExecuteChanged();((RelayCommand)ExportToExcelCommand).RaiseCanExecuteChanged();}}// 命令綁定public ICommand SelectFolderCommand { get; }public ICommand ExportToExcelCommand { get; }public MainViewModel(){SelectFolderCommand = new RelayCommand(async () => await ProcessFolderAsync(), () => !IsBusy);ExportToExcelCommand = new RelayCommand(ExportToExcel, () => PdfFiles.Count > 0 && !IsBusy);}private async Task ProcessFolderAsync(){// 使用現代化的文件夾選擇對話框var dialog = new CommonOpenFileDialog{IsFolderPicker = true,Title = "請選擇包含PDF文件的文件夾"};if (dialog.ShowDialog() == CommonFileDialogResult.Ok){string selectedPath = dialog.FileName;IsBusy = true;StatusText = "正在準備處理...";PdfFiles.Clear();ProgressValue = 0;await Task.Run(() => // 在后臺線程執行耗時操作,避免UI卡死{var files = Directory.GetFiles(selectedPath, "*.pdf");int processedCount = 0;foreach (var file in files){processedCount++;var progressPercentage = (double)processedCount / files.Length * 100;// 更新UI元素必須在UI線程上執行Application.Current.Dispatcher.Invoke(() =>{StatusText = $"正在處理: {Path.GetFileName(file)} ({processedCount}/{files.Length})";ProgressValue = progressPercentage;});try{// 獲取文件信息var fileInfo = new FileInfo(file);int pageCount = 0;// 使用 iText7 讀取PDF頁數using (var pdfReader = new PdfReader(file)){using (var pdfDoc = new PdfDocument(pdfReader)){pageCount = pdfDoc.GetNumberOfPages();}}// 創建模型對象并添加到集合中var pdfData = new PdfFileInfo{FileName = fileInfo.Name,PageCount = pageCount,FileSize = $"{fileInfo.Length / 1024.0:F2} KB" // 格式化文件大小};Application.Current.Dispatcher.Invoke(() => PdfFiles.Add(pdfData));}catch (System.Exception ex){// 如果某個PDF文件損壞,記錄錯誤并繼續Application.Current.Dispatcher.Invoke(() =>{StatusText = $"處理文件 {Path.GetFileName(file)} 時出錯: {ex.Message}";});}}});StatusText = $"處理完成!共找到 {PdfFiles.Count} 個PDF文件。";IsBusy = false;}}private void ExportToExcel(){var saveFileDialog = new SaveFileDialog{Filter = "Excel 工作簿 (*.xlsx)|*.xlsx",FileName = $"PDF文件列表_{System.DateTime.Now:yyyyMMddHHmmss}.xlsx"};if (saveFileDialog.ShowDialog() == true){try{// 使用 NPOI 創建 ExcelIWorkbook workbook = new XSSFWorkbook();ISheet sheet = workbook.CreateSheet("PDF文件信息");// 創建表頭IRow headerRow = sheet.CreateRow(0);headerRow.CreateCell(0).SetCellValue("文件名");headerRow.CreateCell(1).SetCellValue("頁數");headerRow.CreateCell(2).SetCellValue("文件大小 (KB)");// 填充數據for (int i = 0; i < PdfFiles.Count; i++){IRow dataRow = sheet.CreateRow(i + 1);dataRow.CreateCell(0).SetCellValue(PdfFiles[i].FileName);dataRow.CreateCell(1).SetCellValue(PdfFiles[i].PageCount);dataRow.CreateCell(2).SetCellValue(PdfFiles[i].FileSize);}// 自動調整列寬sheet.AutoSizeColumn(0);sheet.AutoSizeColumn(1);sheet.AutoSizeColumn(2);// 寫入文件using (var fs = new FileStream(saveFileDialog.FileName, FileMode.Create, FileAccess.Write)){workbook.Write(fs);}MessageBox.Show("成功導出到Excel!", "導出成功", MessageBoxButton.OK, MessageBoxImage.Information);}catch (System.Exception ex){MessageBox.Show($"導出失敗: {ex.Message}", "錯誤", MessageBoxButton.OK, MessageBoxImage.Error);}}}}// 一個簡單的ICommand實現public class RelayCommand : ICommand{private readonly System.Action _execute;private readonly System.Func<bool>? _canExecute;public event System.EventHandler? CanExecuteChanged{add { CommandManager.RequerySuggested += value; }remove { CommandManager.RequerySuggested -= value; }}public RelayCommand(System.Action execute, System.Func<bool>? canExecute = null){_execute = execute;_canExecute = canExecute;}public bool CanExecute(object? parameter) => _canExecute == null || _canExecute();public void Execute(object? parameter) => _execute();public void RaiseCanExecuteChanged() => CommandManager.InvalidateRequerySuggested();}
}

第四步:設計用戶界面 (View)

這是 MainWindow.xaml 文件,定義了程序窗口的布局和控件,并將它們綁定到 ViewModel。

MainWindow.xaml

<Window x:Class="PdfFileScanner.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:local="clr-namespace:PdfFileScanner"mc:Ignorable="d"Title="PDF文件掃描器" Height="600" Width="800" MinHeight="400" MinWidth="600"><!-- 設置窗口的數據上下文為ViewModel --><Window.DataContext><local:MainViewModel/></Window.DataContext><Grid Margin="10"><Grid.RowDefinitions><RowDefinition Height="Auto"/><RowDefinition Height="*"/><RowDefinition Height="Auto"/></Grid.RowDefinitions><!-- 頂部操作欄 --><StackPanel Grid.Row="0" Orientation="Horizontal" Margin="0,0,0,10"><Button Content="選擇文件夾" Command="{Binding SelectFolderCommand}" Padding="15,5" FontSize="14" IsEnabled="{Binding !IsBusy}"/><Button Content="導出到Excel" Command="{Binding ExportToExcelCommand}" Margin="10,0,0,0" Padding="15,5" FontSize="14" IsEnabled="{Binding !IsBusy}"/></StackPanel><!-- 文件列表 --><DataGrid Grid.Row="1" ItemsSource="{Binding PdfFiles}" AutoGenerateColumns="False" CanUserAddRows="False" IsReadOnly="True" FontSize="14"><DataGrid.Columns><DataGridTextColumn Header="文件名" Binding="{Binding FileName}" Width="*"/><DataGridTextColumn Header="頁數" Binding="{Binding PageCount}" Width="Auto"/><DataGridTextColumn Header="文件大小" Binding="{Binding FileSize}" Width="Auto"/></DataGrid.Columns></DataGrid><!-- 底部狀態欄和進度條 --><Grid Grid.Row="2" Margin="0,10,0,0"><Grid.ColumnDefinitions><ColumnDefinition Width="*"/><ColumnDefinition Width="200"/></Grid.ColumnDefinitions><TextBlock Grid.Column="0" Text="{Binding StatusText}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis"/><ProgressBar Grid.Column="1" Value="{Binding ProgressValue}" Maximum="100" Height="20"Visibility="{Binding IsBusy, Converter={StaticResource BooleanToVisibilityConverter}}"/></Grid></Grid>
</Window>

MainWindow.xaml.cs (代碼隱藏文件)
這里我們只需要確保 DataContext 被正確設置。上面的XAML已經通過 <local:MainViewModel/> 標簽完成了這一步,所以代碼隱藏文件非常干凈。

using System.Windows;namespace PdfFileScanner
{public partial class MainWindow : Window{public MainWindow(){InitializeComponent();// DataContext 在 XAML 中設置,這里無需代碼}}
}

總結與解釋

  1. 文件夾選擇: 點擊“選擇文件夾”按鈕,會觸發 SelectFolderCommand。我們使用了 Microsoft.WindowsAPICodePack-Shell 庫,它提供了一個比默認的 FolderBrowserDialog 更現代、更友好的對話框。
  2. 后臺處理與進度更新:
    • 核心的PDF文件處理邏輯被包裹在 Task.Run() 中,這會將其放到一個后臺線程上執行,防止UI線程(負責渲染窗口和響應用戶操作的線程)被阻塞而導致程序“未響應”。
    • 在后臺線程中,我們不能直接修改UI控件(如 ProgressBarTextBlock)或綁定到UI的集合(如 ObservableCollection)。因此,我們使用 Application.Current.Dispatcher.Invoke() 將這些更新操作“派發”回UI線程執行,這是WPF中進行跨線程UI更新的標準做法。
    • IsBusy 屬性用來控制UI狀態。當 IsBusytrue 時,按鈕會被禁用,進度條會顯示。
  3. 信息提取:
    • 文件名和大小: 使用 System.IO.FileInfo 類可以輕松獲取。
    • PDF頁數: 使用 iText 7 庫。我們通過 PdfReaderPdfDocument 對象打開PDF文件,然后調用 GetNumberOfPages() 方法。using 語句確保文件流被正確關閉和釋放。
  4. 列表展示:
    • WPF的 DataGrid 控件的 ItemsSource 屬性被綁定到 ViewModel 中的 ObservableCollection<PdfFileInfo> 集合。
    • ObservableCollection 的美妙之處在于,每當你向其中 AddRemove 一個項時,它會自動通知綁定的 DataGrid 更新,無需手動刷新。
  5. Excel導出:
    • 點擊“導出到Excel”按鈕會觸發 ExportToExcelCommand
    • 該命令首先會彈出一個標準的“文件保存”對話框,讓用戶選擇保存位置和文件名。
    • 然后,它使用 NPOI 庫在內存中創建一個Excel工作簿 (XSSFWorkbook 對應 .xlsx格式),創建工作表、表頭行,然后遍歷 PdfFiles 集合,將每條數據寫入新的一行。
    • 最后,將內存中的工作簿寫入到用戶選擇的文件流中。

這個方案完整地實現了你要求的所有功能,并且采用了現代C#和WPF的最佳實踐,代碼結構清晰,易于擴展和維護。

后記

關于轉換器的錯誤

Visibility="{Binding IsBusy, Converter={StaticResource BooleanToVisibilityConverter}}" 改代碼因沒有轉換器Converter而出錯,故需自定義一個轉換器:

添加轉換器類BooleanToVisibilityConverter

using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;public class BooleanToVisibilityConverter : IValueConverter
{public object Convert(object value, Type targetType, object parameter, CultureInfo culture){if (value is bool booleanValue){if (booleanValue){return Visibility.Visible;}else{// Default to Collapsed, or Hidden based on 'parameter' or another propertyreturn Visibility.Collapsed;}}return Visibility.Visible; // Default if not a boolean}public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture){throw new NotImplementedException(); // Usually not needed for Visibility conversion}
}

然后在 MainWindow.xaml 中注冊這個轉換器:

    <!-- 在這里添加資源定義 --><Window.Resources><BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/></Window.Resources>

修改后的MainWindow.xaml文件如下:

<Window x:Class="PdfFileScanner.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:local="clr-namespace:PdfFileScanner"mc:Ignorable="d"Title="PDF文件掃描器" Height="600" Width="800" MinHeight="400" MinWidth="600"><!-- 設置窗口的數據上下文為ViewModel --><Window.DataContext><local:MainViewModel/></Window.DataContext><!-- 在這里添加資源定義 --><Window.Resources><BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/></Window.Resources><Grid Margin="10"><Grid.RowDefinitions><RowDefinition Height="Auto"/><RowDefinition Height="*"/><RowDefinition Height="Auto"/></Grid.RowDefinitions><!-- 頂部操作欄 --><StackPanel Grid.Row="0" Orientation="Horizontal" Margin="0,0,0,10"><Button Content="選擇文件夾" Command="{Binding SelectFolderCommand}" Padding="15,5" FontSize="14" IsEnabled="{Binding !IsBusy}"/><Button Content="導出到Excel" Command="{Binding ExportToExcelCommand}" Margin="10,0,0,0" Padding="15,5" FontSize="14" IsEnabled="{Binding !IsBusy}"/></StackPanel><!-- 文件列表 --><DataGrid Grid.Row="1" ItemsSource="{Binding PdfFiles}" AutoGenerateColumns="False" CanUserAddRows="False" IsReadOnly="True" FontSize="14"><DataGrid.Columns><DataGridTextColumn Header="文件名" Binding="{Binding FileName}" Width="*"/><DataGridTextColumn Header="頁數" Binding="{Binding PageCount}" Width="Auto"/><DataGridTextColumn Header="文件大小" Binding="{Binding FileSize}" Width="Auto"/></DataGrid.Columns></DataGrid><!-- 底部狀態欄和進度條 --><Grid Grid.Row="2" Margin="0,10,0,0"><Grid.ColumnDefinitions><ColumnDefinition Width="*"/><ColumnDefinition Width="200"/></Grid.ColumnDefinitions><TextBlock Grid.Column="0" Text="{Binding StatusText}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis"/><ProgressBar Grid.Column="1" Value="{Binding ProgressValue}" Maximum="100" Height="20"Visibility="{Binding IsBusy, Converter={StaticResource BooleanToVisibilityConverter}}"/></Grid></Grid>
</Window>

問題解決!

運行效果如下:

軟件界面

文件識別

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/pingmian/91061.shtml
繁體地址,請注明出處:http://hk.pswp.cn/pingmian/91061.shtml
英文地址,請注明出處:http://en.pswp.cn/pingmian/91061.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

設計模式(五)創建型:原型模式詳解

設計模式&#xff08;五&#xff09;創建型&#xff1a;原型模式詳解原型模式&#xff08;Prototype Pattern&#xff09;是 GoF 23 種設計模式中的創建型模式之一&#xff0c;其核心價值在于通過復制現有對象來創建新對象&#xff0c;而不是通過 new 關鍵字調用構造函數。它特…

K8S 八 數據存儲-高級存儲PV PVC 生命周期;配置存儲ConfigMap Secret

目錄數據存儲 Volume8.1 基本存儲8.1.1 EmptyDir8.1.2 HostPath 掛載目錄8.1.3 NFSnfs的服務8.2 高級存儲8.2.1 PV和PVC8.2.2 PV 持久化卷申請8.2.3 PVC 資源申請PVC的配置參數8.2.4 生命周期配置存儲8.3.1 ConfigMap8.3.2 Secret數據存儲 Volume Kubernetes的Volume支持多種類…

Baumer工業相機堡盟工業相機如何通過YoloV8深度學習模型實現輪船檢測識別(C#代碼UI界面版)

Baumer工業相機堡盟工業相機如何通過YoloV8深度學習模型實現輪船檢測識別&#xff08;C#代碼UI界面版&#xff09;工業相機使用YoloV8模型實現輪船檢測識別工業相機通過YoloV8模型實現輪船檢測識別的技術背景在相機SDK中獲取圖像轉換圖像的代碼分析工業相機圖像轉換Bitmap圖像格…

自習室預約小程序的設計與實現

自習室預約小程序的設計與實現現代學習環境對高效、便捷的預約系統需求日益增長。自習室預約小程序結合前沿技術棧&#xff0c;提供流暢的用戶體驗和強大的后臺管理功能&#xff0c;滿足學生、職場人士等群體的自習需求。技術架構與核心功能Vue.js 構建動態前端界面 采用 Vue.j…

Docker 實戰大綱

文章目錄Docker 實戰 – Mysql &#xff08;敬請期待……&#xff09;

從一個“詭異“的C++程序理解狀態機、防抖與系統交互

引言 在編程世界中&#xff0c;有時一個看似簡單的代碼片段可能隱藏著令人驚訝的復雜性。本文將從一個"故意設計"的C程序出發&#xff0c;深入探討其背后涉及的狀態機模式、防抖機制以及操作系統與控制臺的交互原理。通過這個案例&#xff0c;我們不僅能理解這些核心…

NAS-Bench-101: Towards Reproducible Neural Architecture Search

概述這篇題為"NAS-Bench-101: Towards Reproducible Neural Architecture Search"的論文由Chris Ying等人合作完成&#xff0c;旨在解決神經網絡架構搜索(NAS)領域面臨的重大挑戰&#xff1a;計算資源需求高和實驗難以復現的問題。論文提出了NAS-Bench-101&#xff0…

SpringBoot整合Fastexcel/EasyExcel導出Excel導出多個圖片

整個工具的代碼都在Gitee或者Github地址內 gitee&#xff1a;solomon-parent: 這個項目主要是總結了工作上遇到的問題以及學習一些框架用于整合例如:rabbitMq、reids、Mqtt、S3協議的文件服務器、mongodb、xxl-job、powerjob還有用Docker compose部署各類中間組件。如果大家有…

網絡原理--HTTPHTTPS

目錄 一、HTTP 1.1 HTTP是什么 1.2 HTTP協議的工作過程 1.3 HTTP協議格式 1.3.1 抓包工具的使用 1.3.2 抓包結果 1.4 HTTP請求 1.4.1 URL 1.4.2 認識“方法” (method) 1.4.3 認識請求“報頭”(header) 1.4.4 認識請求“正文”(body) 1.5 HTTP 響應詳解 1.5.1 HTTP…

『 C++ 入門到放棄 』- 哈希表

一、哈希的概念 哈希&#xff0c;也稱「 散列 」是一種用來進行高效查找的數據結構&#xff0c;查找的時間復雜度平均為O(1)&#xff0c;其本質就是依賴哈希函數這個算法來將 key 和該 key 存儲位置建立一個映射關系。 而因為是有著映射關系&#xff0c;所以哈希的事件復雜度為…

零售收銀系統開源代碼全解析:連鎖門店一體化解決方案(含POS+進銷存+商城)

過去10年&#xff0c;收銀系統技術經歷了從單機版到云服務、從單純結算到全渠道整合的快速演進。面對連鎖多門店、AI稱重、智能分賬、跨店庫存同步等新需求&#xff0c;很多企業的現有傳統saas系統已顯乏力。本文將梳理收銀系統關鍵技術指標&#xff0c;助您在系統升級時做出明…

能源高效利用如何實現?樓宇自控系統智能化監管建筑設備

隨著全球能源危機日益嚴峻和“雙碳”目標的持續推進&#xff0c;建筑領域作為能耗大戶&#xff08;約占社會總能耗的40%&#xff09;&#xff0c;其節能潛力備受關注。樓宇自控系統&#xff08;Building Automation System&#xff0c;簡稱BAS&#xff09;作為建筑智能化的核心…

校園二手交易小程序的設計與實現

文章目錄前言詳細視頻演示具體實現截圖后端框架SpringBoot微信小程序持久層框架MyBaits成功系統案例&#xff1a;參考代碼數據庫源碼獲取前言 博主介紹:CSDN特邀作者、985高校計算機專業畢業、現任某互聯網大廠高級全棧開發工程師、Gitee/掘金/華為云/阿里云/GitHub等平臺持續…

Redis(二):Redis高級特性和應用(慢查詢、Pipeline、事務)

Redis的慢查詢 許多存儲系統&#xff08;例如 MySQL)提供慢查詢日志幫助開發和運維人員定位系統存在的慢操作。所謂慢查詢日志就是系統在命令執行前后計算每條命令的執行時間&#xff0c;當超過預設閥值,就將這條命令的相關信息&#xff08;例如:發生時間&#xff0c;耗時&…

如何為你的WordPress網站選擇合適的安全插件

在管理WordPress網站時&#xff0c;安全因素至關重要。由于WordPress的廣泛使用&#xff0c;它也成為了黑客攻擊的首要目標。為了避免潛在的安全風險&#xff0c;選擇合適的安全插件至關重要。而Wordfence和iThemes&#xff0c;作為兩款頗具人氣的WordPress安全插件&#xff0c…

我們使用Rust開發的AI知識庫應用

這段時間陸陸續續的開發了2個AI知識庫應用&#xff0c;一個面向企業&#xff0c;一個面向C端用戶。 飛樹智庫&#xff1a;一個安全高效的面向 企業的知識庫平臺&#xff08;https://fskb.coderbox.cn/&#xff09;。 小飛樹&#xff1a;一個專注于個人知識管理的AI應用&#…

自動化測試實戰篇

目錄 1. 自動化實施步驟 1.1 編寫web測試用例 1.2 自動化測試腳本開發 1.3 將自動化測試補充至測試報告 1. 自動化實施步驟 1.1 編寫web測試用例 1.2 自動化測試腳本開發 TestDevelopment: 測試用例 - Gitee.comhttps://gitee.com/Axurea/test-development/tree/master/2…

idea 服務器Debug端口啟動設置

一&#xff1a;在阿里云服務器安全組已經設置了端口授權對象&#xff1a;正確命令&#xff1a;nohup java -Xdebug -Xrunjdwp:transportdt_socket,servery,suspendn,address9998 -jar -Duser.timezoneGMT08 -Xms256m -Xmx256m /opt/projects/*/*/*-starter-1.0-SNAPSHOT.jar -…

大模型量化004

Bert P-tuning BertPET、BertP-Tuning Chain of Thought Few shot Cot Auto-COT 解決手動編寫高質量CoT示例麻煩耗時的問題 Auto COT 自動思維鏈生成器 1.業務場景&#xff1a; 每天收到很多反饋&#xff0c;之前需要人工整理&#xff0c;找到重點&#xff0c;做判斷那些需要立…

C#(基本語法)

數據類型C#是一種強類型語言&#xff0c;變量必須聲明類型。基本數據類型包括整型&#xff08;int、long&#xff09;、浮點型&#xff08;float、double&#xff09;、布爾型&#xff08;bool&#xff09;、字符型&#xff08;char&#xff09;和字符串型&#xff08;string&a…