完成 load view

This commit is contained in:
锦恢 2024-10-21 23:46:18 +08:00
parent 07ecfb9845
commit 67b008fa31

View File

@ -79,48 +79,53 @@ export async function recoverFromInputFile(inputFile, inputViewFile) {
globalLookup.originVcdFile = inputFile;
// 先尝试从 inputViewFile 中寻找,如果找不到,则从同名的 .view 中寻找
const recoverJson = await attemptRecover(inputFile, inputViewFile);
recoverFromJson(recoverJson);
}
if (recoverJson) {
// 加载 waves
const waves = recoverJson.waves;
if (waves instanceof Array && waves.length > 0) {
for (const wave of waves) {
const name = wave.name;
const option = wave.option;
if (name === undefined || option === undefined || recoverConfig.waves.has(name)) {
continue;
}
recoverConfig.waves.set(name, option);
function recoverFromJson(recoverJson) {
if (recoverJson === undefined) {
return;
}
// 加载 waves
const waves = recoverJson.waves;
if (waves instanceof Array && waves.length > 0) {
for (const wave of waves) {
const name = wave.name;
const option = wave.option;
if (name === undefined || option === undefined || recoverConfig.waves.has(name)) {
continue;
}
}
// 加载 views
const views = recoverJson.views;
if (views instanceof Array && views.length > 0) {
recoverConfig.views = recoverJson.views;
}
// 加载 state
recoverConfig.state = recoverJson.state;
// 加载 pivots
const pivots = recoverJson.pivots;
if (pivots instanceof Array && pivots.length > 0) {
recoverConfig.pivots = pivots;
}
// 加载 treeviewExpands
const treeviewExpands = recoverJson.treeviewExpands;
if (treeviewExpands instanceof Array && treeviewExpands.length > 0) {
recoverConfig.treeviewExpands = treeviewExpands;
}
// 加载 rightNavIndex
const rightNavIndex = recoverJson.rightNavIndex;
if (rightNavIndex !== undefined) {
recoverConfig.rightNavIndex = rightNavIndex;
recoverConfig.waves.set(name, option);
}
}
// 加载 views
const views = recoverJson.views;
if (views instanceof Array && views.length > 0) {
recoverConfig.views = recoverJson.views;
}
// 加载 state
recoverConfig.state = recoverJson.state;
// 加载 pivots
const pivots = recoverJson.pivots;
if (pivots instanceof Array && pivots.length > 0) {
recoverConfig.pivots = pivots;
}
// 加载 treeviewExpands
const treeviewExpands = recoverJson.treeviewExpands;
if (treeviewExpands instanceof Array && treeviewExpands.length > 0) {
recoverConfig.treeviewExpands = treeviewExpands;
}
// 加载 rightNavIndex
const rightNavIndex = recoverJson.rightNavIndex;
if (rightNavIndex !== undefined) {
recoverConfig.rightNavIndex = rightNavIndex;
}
}
class PrefixNode {