功能:当图纸损坏时,提供快捷修复的功能

pull/2499/MERGE
ChenX 10 months ago
parent 96989664da
commit 47f78b13e7

@ -138,7 +138,50 @@ export class FileServer extends Singleton
let info = await this.GetFileInfo(fid, md5); let info = await this.GetFileInfo(fid, md5);
if (info) if (info)
{ {
app.OpenFile(new CADFiler(JSON.parse(info.file)));
//上次错误 , 变成了 )
let fileData: any[];
while (true)
{
try
{
fileData = JSON.parse(info.file);
break;
}
catch (error)
{
let pos = Number(/at position[ ]+(\d+)/.exec(error.message)[1]);
let startPos = Math.max(0, pos - 100);
let endPos = Math.min(pos + 100, info.file.length - 1);
let newStr = prompt(`数据损坏,请修复数据,下面数据中,第${pos - startPos + 1}个字符出错了(如果您不会修复,请发送给售后工程师!)点击取消可以直接放弃修复,您可以打开历史记录还原图纸!`, info.file.substring(startPos, endPos));
if (newStr)
{
try
{
info.file = info.file.substring(0, startPos) + newStr + info.file.substring(endPos);
fileData = JSON.parse(info.file);
break;
}
catch (error)
{
}
}
else
{
AppToaster.show({
message: "你放弃了修复,你现在可以打开历史记录修复图纸!",
timeout: 3000,
intent: Intent.SUCCESS
}, 'canelfix');
break;
}
}
}
app.OpenFile(new CADFiler(fileData));
if (file && file !== "/") if (file && file !== "/")
this._CurrentFilePath = file; this._CurrentFilePath = file;
this.m_CurFileId = fid; this.m_CurFileId = fid;

Loading…
Cancel
Save