diff --git a/src/common/ClientConnection.ts b/src/common/ClientConnection.ts index 237b2d8..97e1df6 100644 --- a/src/common/ClientConnection.ts +++ b/src/common/ClientConnection.ts @@ -1483,6 +1483,42 @@ export default class ClientConnection { } this.ws = null; } + public async getFileListFileManager(dir_path:string) { + try { + return await this.doRpc( + new Protocol.RpcFileManagerGetFileListRequest(dir_path) + ); + } catch (e) { + console.error(e); + } + } + public async RenameFileManager(base_dir:string,file_name:string,new_file_name:string) { + try { + return await this.doRpc( + new Protocol.RpcFileManagerRenameRequest(base_dir,file_name,new_file_name) + ); + } catch (e) { + console.error(e); + } + } + public async DeleteFileManager(base_dir:string,file_name:string) { + try { + return await this.doRpc( + new Protocol.RpcFileManagerDeleteRequest(base_dir,file_name) + ); + } catch (e) { + console.error(e); + } + } + public async CreateDirectoryFileManager(base_dir:string,dir_name:string) { + try { + return await this.doRpc( + new Protocol.RpcFileManagerCreateDirectoryRequest(base_dir,dir_name) + ); + } catch (e) { + console.error(e); + } + } } export interface NotifyMessage { diff --git a/src/components/FileManageDialog.vue b/src/components/FileManageDialog.vue index 5b198bb..a7bd06b 100644 --- a/src/components/FileManageDialog.vue +++ b/src/components/FileManageDialog.vue @@ -1,1346 +1,1297 @@ - - - - - + + + + + diff --git a/src/entities/WSProtocol.ts b/src/entities/WSProtocol.ts index b572001..5922bce 100644 --- a/src/entities/WSProtocol.ts +++ b/src/entities/WSProtocol.ts @@ -521,7 +521,19 @@ export namespace Protocol { public static get kSaveBlendingConfig() { return Commands.PROTOCOL_PREFIX + "SaveBlendingConfig"; } + public static get kRpcFileManagerGetFileList() { + return Commands.PROTOCOL_PREFIX + "RpcFileManagerGetFileList"; + } + public static get kRpcFileManagerRename() { + return Commands.PROTOCOL_PREFIX + "RpcFileManagerRename"; + } + public static get kRpcFileManagerDelete() { + return Commands.PROTOCOL_PREFIX + "RpcFileManagerDelete"; + } + public static get kRpcFileManagerCreateDirectory() { + return Commands.PROTOCOL_PREFIX + "RpcFileManagerCreateDirectory"; + } static _all_commands = new Set([ Commands.kUnKnowCommand, Commands.kSearchDevice, @@ -652,6 +664,10 @@ export namespace Protocol { Commands.kSaveBlendingConfig, Commands.kRpcSetMagicWallGridState, Commands.kRpcGetMagicWallGridState, + Commands.kRpcFileManagerGetFileList, + Commands.kRpcFileManagerRename, + Commands.kRpcFileManagerDelete, + Commands.kRpcFileManagerCreateDirectory, ]); public static get AllCommands() { return this._all_commands; @@ -3438,4 +3454,91 @@ export namespace Protocol { } name = ""; } + export class RpcFileManagerGetFileListRequest extends PacketEntity{ + dir_path:string="" + constructor(dir_path:string,rpc_id = 0) { + super(); + super.command = Commands.kRpcFileManagerGetFileList; + super.flag = PacketEntity.FLAG_REQUEST; + super.rpc_id = rpc_id; + this.dir_path=dir_path + } + } + export class RpcFileManagerGetFileListResponse extends PacketEntity{ + constructor() { + super(); + super.flag = PacketEntity.FLAG_RESPONSE; + } + error_code=0; + success = false; + error_message="" + free=0; + files:FileEntry[]=[] + } + export class RpcFileManagerRenameRequest extends PacketEntity{ + constructor(base_dir:string,file_name:string,new_file_name:string,rpc_id = 0) { + super(); + super.command = Commands.kRpcFileManagerRename; + super.flag = PacketEntity.FLAG_REQUEST; + super.rpc_id = rpc_id; + this.base_dir=base_dir + this.file_name=file_name + this.new_file_name=new_file_name + } + base_dir="" + file_name="" + new_file_name="" + } + export class RpcFileManagerRenameResponse extends PacketEntity{ + constructor() { + super(); + super.flag = PacketEntity.FLAG_RESPONSE; + } + success = false; + error_code=0; + error_message="" + } + export class RpcFileManagerDeleteRequest extends PacketEntity{ + constructor(base_dir:string,file_name:string,rpc_id = 0) { + super(); + super.command = Commands.kRpcFileManagerDelete; + super.flag = PacketEntity.FLAG_REQUEST; + super.rpc_id = rpc_id; + this.base_dir=base_dir + this.file_name=file_name + } + base_dir="" + file_name="" + } + export class RpcFileManagerDeleteResponse extends PacketEntity{ + constructor() { + super(); + super.flag = PacketEntity.FLAG_RESPONSE; + } + success = false; + delete_count="" + error_code=0; + error_message="" + } + export class RpcFileManagerCreateDirectoryRequest extends PacketEntity{ + constructor(base_dir:string,dir_name:string,rpc_id = 0) { + super(); + super.command = Commands.kRpcFileManagerCreateDirectory; + super.flag = PacketEntity.FLAG_REQUEST; + super.rpc_id = rpc_id; + this.base_dir=base_dir + this.dir_name=dir_name + } + base_dir="" + dir_name="" + } + export class RpcFileManagerCreateDirectoryResponse extends PacketEntity{ + constructor() { + super(); + super.flag = PacketEntity.FLAG_RESPONSE; + } + success = false; + error_message="" + error_code=0; + } } diff --git a/src/pages/TopToolBar.vue b/src/pages/TopToolBar.vue index bcb83ef..b5b625c 100644 --- a/src/pages/TopToolBar.vue +++ b/src/pages/TopToolBar.vue @@ -505,6 +505,7 @@