[fix] csv export codec
This commit is contained in:
@@ -51,7 +51,7 @@
|
||||
},
|
||||
"productName": "CS工具箱",
|
||||
"mainBinaryName": "cstb",
|
||||
"version": "0.0.6-beta.4",
|
||||
"version": "0.0.6-beta.5",
|
||||
"identifier": "upup.cool",
|
||||
"plugins": {
|
||||
"deep-link": {
|
||||
|
||||
@@ -32,7 +32,18 @@ import {
|
||||
DropdownItem,
|
||||
} from "@heroui/react"
|
||||
import { useState, useEffect, useRef, useCallback } from "react"
|
||||
import { TestTube, Power, List, Delete, Play, Edit, Check, Close, Square, DownloadOne } from "@icon-park/react"
|
||||
import {
|
||||
TestTube,
|
||||
Power,
|
||||
List,
|
||||
Delete,
|
||||
Play,
|
||||
Edit,
|
||||
Check,
|
||||
Close,
|
||||
Square,
|
||||
DownloadOne,
|
||||
} from "@icon-park/react"
|
||||
import { allSysInfo, type AllSystemInfo } from "tauri-plugin-system-info-api"
|
||||
import { ToolButton } from "../window/ToolButton"
|
||||
import { save } from "@tauri-apps/plugin-dialog"
|
||||
@@ -215,7 +226,11 @@ export function FpsTest() {
|
||||
const [resolutionWidth, setResolutionWidth] = useState<string>("") // 分辨率宽度
|
||||
const [resolutionHeight, setResolutionHeight] = useState<string>("") // 分辨率高度
|
||||
const [isFullscreen, setIsFullscreen] = useState<boolean>(true) // 全屏模式(默认全屏)
|
||||
const { isOpen: isNoteModalOpen, onOpen: onNoteModalOpen, onClose: onNoteModalClose } = useDisclosure()
|
||||
const {
|
||||
isOpen: isNoteModalOpen,
|
||||
onOpen: onNoteModalOpen,
|
||||
onClose: onNoteModalClose,
|
||||
} = useDisclosure()
|
||||
const monitoringIntervalRef = useRef<NodeJS.Timeout | null>(null)
|
||||
const timeoutRef = useRef<NodeJS.Timeout | null>(null)
|
||||
// 记录测试开始的时间戳(用于过滤旧数据)
|
||||
@@ -357,7 +372,8 @@ export function FpsTest() {
|
||||
const mapConfig = BENCHMARK_MAPS[selectedMapIndex]
|
||||
|
||||
// 使用测试开始时的视频设置(如果有的话),否则使用当前的
|
||||
const currentVideoSetting = testStartVideoSettingRef.current || tool.store.state.videoSetting
|
||||
const currentVideoSetting =
|
||||
testStartVideoSettingRef.current || tool.store.state.videoSetting
|
||||
|
||||
fpsTest.addResult({
|
||||
id: `${now.getTime()}-${Math.random().toString(36).slice(2, 11)}`,
|
||||
@@ -434,7 +450,14 @@ export function FpsTest() {
|
||||
return false
|
||||
}
|
||||
},
|
||||
[steam.state.cs2Dir, selectedMapIndex, fpsTest, tool.store, hardwareInfo, tool.state.autoCloseGame]
|
||||
[
|
||||
steam.state.cs2Dir,
|
||||
selectedMapIndex,
|
||||
fpsTest,
|
||||
tool.store,
|
||||
hardwareInfo,
|
||||
tool.state.autoCloseGame,
|
||||
]
|
||||
)
|
||||
|
||||
// 开始监控文件更新
|
||||
@@ -600,10 +623,13 @@ export function FpsTest() {
|
||||
const canStartTest = !tool.state.autoCloseGame ? !isGameRunning : true
|
||||
|
||||
// 格式化视频设置摘要
|
||||
const formatVideoSettingSummary = (videoSetting: typeof tool.state.videoSetting | null): string => {
|
||||
const formatVideoSettingSummary = (
|
||||
videoSetting: typeof tool.state.videoSetting | null
|
||||
): string => {
|
||||
if (!videoSetting) return "N/A"
|
||||
const resolution = `${videoSetting.defaultres}x${videoSetting.defaultresheight}`
|
||||
const refreshRate = videoSetting.refreshrate_denominator === "1"
|
||||
const refreshRate =
|
||||
videoSetting.refreshrate_denominator === "1"
|
||||
? videoSetting.refreshrate_numerator
|
||||
: `${videoSetting.refreshrate_numerator}/${videoSetting.refreshrate_denominator}`
|
||||
const msaa = videoSetting.msaa_samples === "0" ? "无" : `${videoSetting.msaa_samples}x`
|
||||
@@ -640,7 +666,7 @@ export function FpsTest() {
|
||||
const headers = [
|
||||
"测试时间",
|
||||
"测试地图",
|
||||
"AVG平均帧",
|
||||
"平均帧",
|
||||
"P1低帧",
|
||||
"CPU",
|
||||
"系统版本",
|
||||
@@ -674,6 +700,9 @@ export function FpsTest() {
|
||||
|
||||
const csvContent = csvRows.join("\n")
|
||||
|
||||
// 添加UTF-8 BOM以确保Excel等软件正确识别编码
|
||||
const csvContentWithBOM = "\uFEFF" + csvContent
|
||||
|
||||
// 使用文件保存对话框
|
||||
const filePath = await save({
|
||||
filters: [
|
||||
@@ -686,7 +715,7 @@ export function FpsTest() {
|
||||
})
|
||||
|
||||
if (filePath) {
|
||||
await writeTextFile(filePath, csvContent)
|
||||
await writeTextFile(filePath, csvContentWithBOM)
|
||||
addToast({ title: "导出成功", color: "success" })
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -796,7 +825,7 @@ export function FpsTest() {
|
||||
<TableHeader>
|
||||
<TableColumn>测试时间</TableColumn>
|
||||
<TableColumn>测试地图</TableColumn>
|
||||
<TableColumn>AVG平均帧</TableColumn>
|
||||
<TableColumn>平均帧</TableColumn>
|
||||
<TableColumn>P1低帧</TableColumn>
|
||||
<TableColumn>CPU</TableColumn>
|
||||
<TableColumn>系统版本</TableColumn>
|
||||
@@ -817,17 +846,26 @@ export function FpsTest() {
|
||||
<TableCell className="text-xs">
|
||||
{result.p1 !== null ? `${result.p1.toFixed(1)}` : "N/A"}
|
||||
</TableCell>
|
||||
<TableCell className="text-xs max-w-[200px]" title={result.hardwareInfo?.cpu || undefined}>
|
||||
<TableCell
|
||||
className="text-xs max-w-[160px]"
|
||||
title={result.hardwareInfo?.cpu || undefined}
|
||||
>
|
||||
<div className="truncate whitespace-nowrap">
|
||||
{result.hardwareInfo?.cpu || "N/A"}
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell className="text-xs max-w-[180px]" title={result.hardwareInfo?.os || undefined}>
|
||||
<TableCell
|
||||
className="text-xs max-w-[160px]"
|
||||
title={result.hardwareInfo?.os || undefined}
|
||||
>
|
||||
<div className="truncate whitespace-nowrap">
|
||||
{result.hardwareInfo?.os || "N/A"}
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell className="text-xs max-w-[180px]" title={result.hardwareInfo?.gpu || undefined}>
|
||||
<TableCell
|
||||
className="text-xs max-w-[180px]"
|
||||
title={result.hardwareInfo?.gpu || undefined}
|
||||
>
|
||||
<div className="truncate whitespace-nowrap">
|
||||
{result.hardwareInfo?.gpu || "N/A"}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user