import { invoke } from '@tauri-apps/api/core'; /** * Tauri IPC 通信层 */ export class TauriAPI { /** * 打招呼(测试命令) */ static async greet(name: string): Promise { return await invoke('greet', { name }); } static async openProjectDialog(): Promise { return await invoke('open_project_dialog'); } static async openProject(path: string): Promise { return await invoke('open_project', { path }); } /** * 保存项目 */ static async saveProject(path: string, data: string): Promise { return await invoke('save_project', { path, data }); } /** * 导出二进制数据 */ static async exportBinary(data: Uint8Array, outputPath: string): Promise { return await invoke('export_binary', { data: Array.from(data), outputPath }); } /** * 扫描目录查找匹配模式的文件 */ static async scanDirectory(path: string, pattern: string): Promise { return await invoke('scan_directory', { path, pattern }); } /** * 读取文件内容 */ static async readFileContent(path: string): Promise { return await invoke('read_file_content', { path }); } } /** * 项目信息 */ export interface ProjectInfo { name: string; path: string; version: string; } /** * 编辑器配置 */ export interface EditorConfig { theme: string; autoSave: boolean; recentProjects: string[]; }