优化:尝试修复错误的图纸

pull/2527/head
ChenX 10 months ago
parent cb8258e3a2
commit e360f2855c

@ -150,18 +150,27 @@ export class FileServer extends Singleton
}
catch (error)
{
if (error.message.indexOf("at position") === -1)
let pos: number;
if (error.message.indexOf("at position") !== -1)
pos = Number(/at position[ ]+(\d+)/.exec(error.message)[1]);
else if (error.message.indexOf("Unexpected token") !== -1)
{
let pos1 = error.message.indexOf("\"");
let pos2 = error.message.indexOf("\"", pos1 + 1);
let subStr = error.message.substring(pos1 + 1, pos2);
pos = info.file.indexOf(subStr);
}
if (pos === undefined || pos === -1)
{
AppToaster.show({
message: "图纸损坏!您现在可以打开历史记录修复图纸!",
message: "图纸损坏!您现在可以打开历史记录修复图纸!或者将图纸发给我们进行修复!",
timeout: 3000,
intent: Intent.DANGER
}, 'canelfix');
break;
}
else
{
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);
@ -190,7 +199,6 @@ export class FileServer extends Singleton
}
}
}
}
app.OpenFile(new CADFiler(fileData));

Loading…
Cancel
Save