|
|
|
@ -183,6 +183,7 @@ export class FileServer extends Singleton
|
|
|
|
|
|
|
|
|
|
return status;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//读取文件列表
|
|
|
|
|
async ReadFileList(): Promise<IFileInfo[]>
|
|
|
|
|
{
|
|
|
|
@ -195,6 +196,13 @@ export class FileServer extends Singleton
|
|
|
|
|
}
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 读取文件信息,如果md5等于缓存,则直接打开,否则请求服务器并缓存文件信息
|
|
|
|
|
* @param fid 文件id
|
|
|
|
|
* @param [code] md5值
|
|
|
|
|
* @returns
|
|
|
|
|
*/
|
|
|
|
|
async GetFileInfo(fid: string, code?: string): Promise<IFileInfo>
|
|
|
|
|
{
|
|
|
|
|
if (!code)
|
|
|
|
@ -226,17 +234,19 @@ export class FileServer extends Singleton
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//缓存文件到db
|
|
|
|
|
async CacheFileInfo(fid: string, info: IFileInfo)
|
|
|
|
|
{
|
|
|
|
|
let dbStore = await IndexedDbStore.CADStore();
|
|
|
|
|
let key = GetIndexDBID(fid);
|
|
|
|
|
|
|
|
|
|
let fileInfo = await dbStore.Get(StoreName.Dwg, key);
|
|
|
|
|
if (!fileInfo)
|
|
|
|
|
fileInfo = {};
|
|
|
|
|
let fileInfo = await dbStore.Get(StoreName.Dwg, key) ?? {};
|
|
|
|
|
|
|
|
|
|
dbStore.Put(StoreName.Dwg, GetIndexDBID(fid), Object.assign(fileInfo, info));
|
|
|
|
|
dbStore.Put(StoreName.Dwg, key, Object.assign(fileInfo, info));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//上传文件(新建)
|
|
|
|
|
async UploadFile(fileInfo: IFileInfo, rawFile?: string)
|
|
|
|
|
{
|
|
|
|
|
let info: IFileInfo = {
|
|
|
|
@ -261,6 +271,7 @@ export class FileServer extends Singleton
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//更新文件(修改)
|
|
|
|
|
async UpdateFile(fileInfo: IFileInfo, rawFile?: string)
|
|
|
|
|
{
|
|
|
|
|
this.SaveCurrentFileInfo(fileInfo);
|
|
|
|
|