@l1yp/file-viewer 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -6
- package/dist/assets/step.worker-CfDTYOf_.js.map +1 -0
- package/dist/components/CertViewer.js +1 -1
- package/dist/components/CertViewer.js.map +1 -1
- package/dist/components/CertViewer.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/DocxNavigationPane.js +1 -1
- package/dist/components/DocxNavigationPane.js.map +1 -1
- package/dist/components/DocxNavigationPane.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/DocxViewer.js +1 -1
- package/dist/components/DocxViewer.js.map +1 -1
- package/dist/components/DocxViewer.vue.d.ts +1 -1
- package/dist/components/DocxViewer.vue_vue_type_script_setup_true_lang.js +80 -78
- package/dist/components/DocxViewer.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/EplViewer.js +1 -1
- package/dist/components/EplViewer.js.map +1 -1
- package/dist/components/EplViewer.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/FileViewerBody.js +1 -1
- package/dist/components/FileViewerBody.js.map +1 -1
- package/dist/components/FileViewerBody.vue_vue_type_script_setup_true_lang.js +265 -257
- package/dist/components/FileViewerBody.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/FileViewerPanel.js +1 -1
- package/dist/components/FileViewerPanel.js.map +1 -1
- package/dist/components/FileViewerPanel.vue.d.ts +6 -1
- package/dist/components/FileViewerPanel.vue_vue_type_script_setup_true_lang.js +42 -40
- package/dist/components/FileViewerPanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/HarViewer.js +1 -1
- package/dist/components/HarViewer.js.map +1 -1
- package/dist/components/HarViewer.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/JksViewer.js +1 -1
- package/dist/components/JksViewer.js.map +1 -1
- package/dist/components/JksViewer.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/ModelViewModes.js +9 -0
- package/dist/components/ModelViewModes.js.map +1 -0
- package/dist/components/ModelViewModes.vue.d.ts +11 -0
- package/dist/components/ModelViewModes.vue_vue_type_script_setup_true_lang.js +49 -0
- package/dist/components/ModelViewModes.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/ModelViewer.js +1 -1
- package/dist/components/ModelViewer.js.map +1 -1
- package/dist/components/ModelViewer.vue.d.ts +2 -1
- package/dist/components/ModelViewer.vue_vue_type_script_setup_true_lang.js +183 -96
- package/dist/components/ModelViewer.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/PdfNavigationPane.js +1 -1
- package/dist/components/PdfNavigationPane.js.map +1 -1
- package/dist/components/PdfNavigationPane.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/PdfViewer.js +1 -1
- package/dist/components/PdfViewer.js.map +1 -1
- package/dist/components/PdfViewer.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/PptxNavigationPane.js +1 -1
- package/dist/components/PptxNavigationPane.js.map +1 -1
- package/dist/components/PptxNavigationPane.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/PsdViewer.js +1 -1
- package/dist/components/PsdViewer.js.map +1 -1
- package/dist/components/PsdViewer.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/SqliteViewer.js +1 -1
- package/dist/components/SqliteViewer.js.map +1 -1
- package/dist/components/SqliteViewer.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/ViewerLoadError.js +9 -0
- package/dist/components/ViewerLoadError.js.map +1 -0
- package/dist/components/ViewerLoadError.vue.d.ts +17 -0
- package/dist/components/ViewerLoadError.vue_vue_type_script_setup_true_lang.js +58 -0
- package/dist/components/ViewerLoadError.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/XlsxChart.js +1 -1
- package/dist/components/XlsxChart.js.map +1 -1
- package/dist/components/XlsxChart.vue_vue_type_script_setup_true_lang.js +9 -9
- package/dist/components/XlsxChart.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/XlsxImageLayer.js +9 -0
- package/dist/components/XlsxImageLayer.js.map +1 -0
- package/dist/components/XlsxImageLayer.vue.d.ts +9 -0
- package/dist/components/XlsxImageLayer.vue_vue_type_script_setup_true_lang.js +46 -0
- package/dist/components/XlsxImageLayer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/XlsxViewer.js +1 -1
- package/dist/components/XlsxViewer.js.map +1 -1
- package/dist/components/XlsxViewer.vue_vue_type_script_setup_true_lang.js +230 -216
- package/dist/components/XlsxViewer.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/epl/EplResource.js +1 -1
- package/dist/components/epl/EplResource.js.map +1 -1
- package/dist/components/epl/EplResource.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/optionalViewer.d.ts +3 -2
- package/dist/components/optionalViewer.js +6 -3
- package/dist/components/optionalViewer.js.map +1 -1
- package/dist/composables/useFileViewer.d.ts +11 -3
- package/dist/composables/useFileViewer.js.map +1 -1
- package/dist/composables/useTeleportTheme.d.ts +7 -0
- package/dist/composables/useTeleportTheme.js +42 -0
- package/dist/composables/useTeleportTheme.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +29 -28
- package/dist/lib/docxTheme.d.ts +6 -0
- package/dist/lib/docxTheme.js +64 -0
- package/dist/lib/docxTheme.js.map +1 -0
- package/dist/lib/epl/code/structures.js +82 -0
- package/dist/lib/epl/code/structures.js.map +1 -0
- package/dist/lib/epl/code/variable.js +16 -0
- package/dist/lib/epl/code/variable.js.map +1 -0
- package/dist/lib/epl/eplDocument.js +28 -22
- package/dist/lib/epl/eplDocument.js.map +1 -1
- package/dist/lib/epl/index.d.ts +2 -1
- package/dist/lib/epl/index.js.map +1 -1
- package/dist/lib/epl/sections/code.js +37 -0
- package/dist/lib/epl/sections/code.js.map +1 -0
- package/dist/lib/epl/sections/esystemInfo.js +29 -0
- package/dist/lib/epl/sections/esystemInfo.js.map +1 -0
- package/dist/lib/epl/sections/losable.js +33 -0
- package/dist/lib/epl/sections/losable.js.map +1 -0
- package/dist/lib/epl/sections/projectConfig.js +39 -0
- package/dist/lib/epl/sections/projectConfig.js.map +1 -0
- package/dist/lib/epl/sections/resource.js +84 -0
- package/dist/lib/epl/sections/resource.js.map +1 -0
- package/dist/lib/fileType.d.ts +3 -1
- package/dist/lib/fileType.js +150 -137
- package/dist/lib/fileType.js.map +1 -1
- package/dist/lib/modelAppearance.d.ts +7 -0
- package/dist/lib/modelAppearance.js +41 -0
- package/dist/lib/modelAppearance.js.map +1 -0
- package/dist/lib/step.d.ts +10 -0
- package/dist/lib/step.js +35 -0
- package/dist/lib/step.js.map +1 -0
- package/dist/lib/step.worker.d.ts +1 -0
- package/dist/lib/step.worker.js +18 -0
- package/dist/lib/step.worker.js.map +1 -0
- package/dist/lib/stepObject.d.ts +4 -0
- package/dist/lib/stepObject.js +52 -0
- package/dist/lib/stepObject.js.map +1 -0
- package/dist/lib/stepTypes.d.ts +60 -0
- package/dist/lib/viewerKind.js +10 -5
- package/dist/lib/viewerKind.js.map +1 -1
- package/dist/lib/xlsx.d.ts +1 -1
- package/dist/lib/xlsx.js +106 -89
- package/dist/lib/xlsx.js.map +1 -1
- package/dist/lib/xlsxCharts.js +71 -119
- package/dist/lib/xlsxCharts.js.map +1 -1
- package/dist/lib/xlsxImages.d.ts +43 -0
- package/dist/lib/xlsxImages.js +114 -0
- package/dist/lib/xlsxImages.js.map +1 -0
- package/dist/lib/xlsxParts.d.ts +17 -0
- package/dist/lib/xlsxParts.js +86 -0
- package/dist/lib/xlsxParts.js.map +1 -0
- package/dist/style.css +1 -1
- package/package.json +8 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/lib/epl/index.ts"],"sourcesContent":["/**\n * Public entry for the e-language (易语言) `.e`/`.ec` reader — the only module the UI imports.\n *\n * {@link decompileEpl} turns the raw bytes into a preview: project metadata + a structured {@link EplProgram}\n * (classes / methods / variables / structs / DLL declares / constants / forms / libraries, with method bodies\n * reconstructed by the code-data decompiler) that the IDE-style viewer renders directly. Throws\n * {@link EplEncryptedError} for encrypted files and {@link NotEplFileError} when the bytes aren't a project\n * file — the viewer turns those into friendly messages.\n */\nimport { loadEpl, type EplDocument
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/lib/epl/index.ts"],"sourcesContent":["/**\n * Public entry for the e-language (易语言) `.e`/`.ec` reader — the only module the UI imports.\n *\n * {@link decompileEpl} turns the raw bytes into a preview: project metadata + a structured {@link EplProgram}\n * (classes / methods / variables / structs / DLL declares / constants / forms / libraries, with method bodies\n * reconstructed by the code-data decompiler) that the IDE-style viewer renders directly. Throws\n * {@link EplEncryptedError} for encrypted files and {@link NotEplFileError} when the bytes aren't a project\n * file — the viewer turns those into friendly messages.\n */\nimport { loadEpl, type EplDocument } from './eplDocument'\n// Import errors from their definition: routing them through eplDocument makes the current Rolldown\n// preserveModules build drop that loader's parser/encoding imports while keeping their references.\nimport { EplEncryptedError, NotEplFileError } from './projectFileReader'\nimport { buildProgram, type EplProgram } from './program'\n\nexport interface EplLibrary {\n name: string\n fileName: string\n version: string\n}\n\nexport interface EplProjectInfo {\n name: string\n description: string\n author: string\n version: string\n copyright: string\n email: string\n homepage: string\n}\n\nexport interface EplMeta {\n /** 1=源码(.e), 3=模块(.ec). */\n fileType: 'source' | 'module' | 'unknown'\n /** The e-language IDE version that wrote the file, e.g. `5.71`. */\n systemVersion: string\n project: EplProjectInfo | null\n libraries: EplLibrary[]\n counts: {\n classes: number\n methods: number\n globalVariables: number\n structs: number\n dllDeclares: number\n }\n}\n\nexport interface EplPreview {\n meta: EplMeta\n /** Structured program model (classes / tables) rendered by the IDE-style viewer. */\n program: EplProgram\n}\n\nfunction ver(parts: number[]): string {\n return parts.join('.')\n}\n\nfunction buildMeta(doc: EplDocument): EplMeta {\n const si = doc.systemInfo\n const pc = doc.projectConfig\n const cs = doc.code\n const fileType = si?.fileType === 1 ? 'source' : si?.fileType === 3 ? 'module' : 'unknown'\n return {\n fileType,\n systemVersion: si ? ver(si.esystemVersion) : '',\n project: pc\n ? {\n name: pc.name,\n description: pc.description,\n author: pc.author,\n version: ver(pc.version),\n copyright: pc.copyright,\n email: pc.email,\n homepage: pc.homepage,\n }\n : null,\n libraries: (cs?.libraries ?? []).map((l) => ({\n name: l.name,\n fileName: l.fileName,\n version: ver(l.version),\n })),\n counts: {\n classes: cs?.classes.length ?? 0,\n methods: cs?.methods.length ?? 0,\n globalVariables: cs?.globalVariables.length ?? 0,\n structs: cs?.structs.length ?? 0,\n dllDeclares: cs?.dllDeclares.length ?? 0,\n },\n }\n}\n\n/** Parse + decompile a `.e`/`.ec` byte buffer into a preview (metadata + structured program model). */\nexport function decompileEpl(bytes: Uint8Array): EplPreview {\n const doc = loadEpl(bytes)\n return { meta: buildMeta(doc), program: buildProgram(doc) }\n}\n\nexport { loadEpl, EplEncryptedError, NotEplFileError }\nexport type { EplDocument, EplProgram }\nexport type {\n EplClassView,\n EplClassKind,\n EplMethodView,\n EplVarRow,\n EplStructView,\n EplDllView,\n EplConstantRow,\n EplResourceRow,\n EplFormView,\n EplLibraryView,\n} from './program'\nexport type { CodeLine, GuideSeg } from './code/codeLines'\nexport { parseEplImageList } from './imageList'\nexport type { EplImageList, EplImageFrame } from './imageList'\n"],"mappings":";;;;;AAqDA,SAAS,EAAI,GAAyB;CACpC,OAAO,EAAM,KAAK,GAAG;AACvB;AAEA,SAAS,EAAU,GAA2B;CAC5C,IAAM,IAAK,EAAI,YACT,IAAK,EAAI,eACT,IAAK,EAAI;CAEf,OAAO;EACL,UAFe,GAAI,aAAa,IAAI,WAAW,GAAI,aAAa,IAAI,WAAW;EAG/E,eAAe,IAAK,EAAI,EAAG,cAAc,IAAI;EAC7C,SAAS,IACL;GACE,MAAM,EAAG;GACT,aAAa,EAAG;GAChB,QAAQ,EAAG;GACX,SAAS,EAAI,EAAG,OAAO;GACvB,WAAW,EAAG;GACd,OAAO,EAAG;GACV,UAAU,EAAG;EACf,IACA;EACJ,YAAY,GAAI,aAAa,CAAC,EAAA,CAAG,KAAK,OAAO;GAC3C,MAAM,EAAE;GACR,UAAU,EAAE;GACZ,SAAS,EAAI,EAAE,OAAO;EACxB,EAAE;EACF,QAAQ;GACN,SAAS,GAAI,QAAQ,UAAU;GAC/B,SAAS,GAAI,QAAQ,UAAU;GAC/B,iBAAiB,GAAI,gBAAgB,UAAU;GAC/C,SAAS,GAAI,QAAQ,UAAU;GAC/B,aAAa,GAAI,YAAY,UAAU;EACzC;CACF;AACF;AAGA,SAAgB,EAAa,GAA+B;CAC1D,IAAM,IAAM,EAAQ,CAAK;CACzB,OAAO;EAAE,MAAM,EAAU,CAAG;EAAG,SAAS,EAAa,CAAG;CAAE;AAC5D"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BinaryReader as e } from "../io/binaryReader.js";
|
|
2
|
+
import { readVariables as t } from "../code/variable.js";
|
|
3
|
+
import { applyCompatibilityInfo as n, readClasses as r, readDllDeclares as i, readLibraries as a, readMethods as o, readStructs as s } from "../code/structures.js";
|
|
4
|
+
//#region src/lib/epl/sections/code.ts
|
|
5
|
+
var c = 50361113, l = "程序段", u = {
|
|
6
|
+
key: c,
|
|
7
|
+
name: l,
|
|
8
|
+
isOptional: !1,
|
|
9
|
+
parse(u, d) {
|
|
10
|
+
let f = new e(u, d.dec), p = f.readInt32();
|
|
11
|
+
f.readInt32();
|
|
12
|
+
let m = f.readInt32sWithByteSizePrefix(), h, g = 0, _ = 0, v, y;
|
|
13
|
+
d.cryptEC ? (f.readInt32(), f.readInt32(), v = f.readInt16sWithByteSizePrefix(), g = f.readInt32(), _ = f.readInt32(), h = a(f), y = f.readInt16sWithByteSizePrefix()) : (v = f.readInt16sWithByteSizePrefix(), y = f.readInt16sWithByteSizePrefix(), h = a(f), g = f.readInt32(), _ = f.readInt32()), n(h, m, v, y), g & 1 && f.readBytes(16);
|
|
14
|
+
let b = f.readBytesWithLengthPrefix(), x = f.readStringWithLengthPrefix(), S, C, w, T, E;
|
|
15
|
+
return d.cryptEC ? (f.readBytes(12), C = o(f), E = i(f), w = t(f, "global"), S = r(f), T = s(f)) : (S = r(f), C = o(f), w = t(f, "global"), T = s(f), E = i(f)), {
|
|
16
|
+
kind: "code",
|
|
17
|
+
sectionKey: c,
|
|
18
|
+
sectionName: l,
|
|
19
|
+
isOptional: !1,
|
|
20
|
+
allocatedIdNum: p,
|
|
21
|
+
libraries: h,
|
|
22
|
+
flag: g,
|
|
23
|
+
mainMethod: _,
|
|
24
|
+
iconData: b,
|
|
25
|
+
debugCommandParameters: x,
|
|
26
|
+
classes: S,
|
|
27
|
+
methods: C,
|
|
28
|
+
globalVariables: w,
|
|
29
|
+
structs: T,
|
|
30
|
+
dllDeclares: E
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
export { u as CodeSectionKey };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code.js","names":[],"sources":["../../../../src/lib/epl/sections/code.ts"],"sourcesContent":["/**\n * Code section (程序段, key 0x03007319) — port of `Sections/CodeSection.cs` (read path).\n *\n * The core structural section: the project's libraries, classes, methods, global variables, structs and DLL\n * declares. The EC-encrypted layout reorders several fields and the structure blocks (handled by the\n * `ctx.cryptEC` branches, mirroring the C#). Read order within each branch is preserved exactly.\n */\nimport { BinaryReader } from '../io/binaryReader'\nimport type { ParserContext, SectionBase, SectionType } from '../model/section'\nimport { type EplVariable, readVariables } from '../code/variable'\nimport {\n applyCompatibilityInfo,\n type ClassInfo,\n type DllDeclareInfo,\n type LibraryRefInfo,\n type MethodInfo,\n readClasses,\n readDllDeclares,\n readLibraries,\n readMethods,\n readStructs,\n type StructInfo,\n} from '../code/structures'\n\nconst KEY = 0x03007319\nconst NAME = '程序段'\n\nexport interface CodeSection extends SectionBase {\n kind: 'code'\n /** Max allocated Id number (new Ids are this + 1); defaults to 0xFFFF. */\n allocatedIdNum: number\n libraries: LibraryRefInfo[]\n flag: number\n /** \"_启动子程序\" Id (EC files without editor info). */\n mainMethod: number\n iconData: Uint8Array\n debugCommandParameters: string\n classes: ClassInfo[]\n methods: MethodInfo[]\n globalVariables: EplVariable[]\n structs: StructInfo[]\n dllDeclares: DllDeclareInfo[]\n}\n\nexport const CodeSectionKey: SectionType<CodeSection> = {\n key: KEY,\n name: NAME,\n isOptional: false,\n parse(data: Uint8Array, ctx: ParserContext): CodeSection {\n const r = new BinaryReader(data, ctx.dec)\n const allocatedIdNum = r.readInt32()\n r.readInt32() // confirmed on V5.71\n const minRequiredCmds = r.readInt32sWithByteSizePrefix()\n\n let libraries: LibraryRefInfo[]\n let flag = 0\n let mainMethod = 0\n let minRequiredDataTypes: number[]\n let minRequiredConstants: number[]\n if (ctx.cryptEC) {\n r.readInt32()\n r.readInt32()\n minRequiredDataTypes = r.readInt16sWithByteSizePrefix()\n flag = r.readInt32()\n mainMethod = r.readInt32()\n libraries = readLibraries(r)\n minRequiredConstants = r.readInt16sWithByteSizePrefix()\n } else {\n minRequiredDataTypes = r.readInt16sWithByteSizePrefix()\n minRequiredConstants = r.readInt16sWithByteSizePrefix()\n libraries = readLibraries(r)\n flag = r.readInt32()\n mainMethod = r.readInt32()\n }\n applyCompatibilityInfo(libraries, minRequiredCmds, minRequiredDataTypes, minRequiredConstants)\n\n if ((flag & 1) !== 0) {\n r.readBytes(16) // UnknownBeforeIconData\n }\n const iconData = r.readBytesWithLengthPrefix()\n const debugCommandParameters = r.readStringWithLengthPrefix()\n\n let classes: ClassInfo[]\n let methods: MethodInfo[]\n let globalVariables: EplVariable[]\n let structs: StructInfo[]\n let dllDeclares: DllDeclareInfo[]\n if (ctx.cryptEC) {\n r.readBytes(12) // Unknown (12 zeros)\n methods = readMethods(r)\n dllDeclares = readDllDeclares(r)\n globalVariables = readVariables(r, 'global')\n classes = readClasses(r)\n structs = readStructs(r)\n } else {\n classes = readClasses(r)\n methods = readMethods(r)\n globalVariables = readVariables(r, 'global')\n structs = readStructs(r)\n dllDeclares = readDllDeclares(r)\n }\n\n return {\n kind: 'code',\n sectionKey: KEY,\n sectionName: NAME,\n isOptional: false,\n allocatedIdNum,\n libraries,\n flag,\n mainMethod,\n iconData,\n debugCommandParameters,\n classes,\n methods,\n globalVariables,\n structs,\n dllDeclares,\n }\n },\n}\n"],"mappings":";;;;AAwBA,IAAM,IAAM,UACN,IAAO,OAmBA,IAA2C;CACtD,KAAK;CACL,MAAM;CACN,YAAY;CACZ,MAAM,GAAkB,GAAiC;EACvD,IAAM,IAAI,IAAI,EAAa,GAAM,EAAI,GAAG,GAClC,IAAiB,EAAE,UAAU;EACnC,EAAE,UAAU;EACZ,IAAM,IAAkB,EAAE,6BAA6B,GAEnD,GACA,IAAO,GACP,IAAa,GACb,GACA;EAkBJ,AAjBI,EAAI,WACN,EAAE,UAAU,GACZ,EAAE,UAAU,GACZ,IAAuB,EAAE,6BAA6B,GACtD,IAAO,EAAE,UAAU,GACnB,IAAa,EAAE,UAAU,GACzB,IAAY,EAAc,CAAC,GAC3B,IAAuB,EAAE,6BAA6B,MAEtD,IAAuB,EAAE,6BAA6B,GACtD,IAAuB,EAAE,6BAA6B,GACtD,IAAY,EAAc,CAAC,GAC3B,IAAO,EAAE,UAAU,GACnB,IAAa,EAAE,UAAU,IAE3B,EAAuB,GAAW,GAAiB,GAAsB,CAAoB,GAExF,IAAO,KACV,EAAE,UAAU,EAAE;EAEhB,IAAM,IAAW,EAAE,0BAA0B,GACvC,IAAyB,EAAE,2BAA2B,GAExD,GACA,GACA,GACA,GACA;EAgBJ,OAfI,EAAI,WACN,EAAE,UAAU,EAAE,GACd,IAAU,EAAY,CAAC,GACvB,IAAc,EAAgB,CAAC,GAC/B,IAAkB,EAAc,GAAG,QAAQ,GAC3C,IAAU,EAAY,CAAC,GACvB,IAAU,EAAY,CAAC,MAEvB,IAAU,EAAY,CAAC,GACvB,IAAU,EAAY,CAAC,GACvB,IAAkB,EAAc,GAAG,QAAQ,GAC3C,IAAU,EAAY,CAAC,GACvB,IAAc,EAAgB,CAAC,IAG1B;GACL,MAAM;GACN,YAAY;GACZ,aAAa;GACb,YAAY;GACZ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;CACF;AACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BinaryReader as e } from "../io/binaryReader.js";
|
|
2
|
+
//#region src/lib/epl/sections/esystemInfo.ts
|
|
3
|
+
var t = 33583897, n = "系统信息段", r = {
|
|
4
|
+
key: t,
|
|
5
|
+
name: n,
|
|
6
|
+
isOptional: !1,
|
|
7
|
+
parse(r, i) {
|
|
8
|
+
let a = new e(r, i.dec), o = a.readInt16(), s = a.readInt16();
|
|
9
|
+
a.readInt32();
|
|
10
|
+
let c = a.readInt32(), l = a.readInt16(), u = a.readInt16(), d = a.readInt32();
|
|
11
|
+
a.readInt32();
|
|
12
|
+
let f = a.readInt32();
|
|
13
|
+
return {
|
|
14
|
+
kind: "systemInfo",
|
|
15
|
+
sectionKey: t,
|
|
16
|
+
sectionName: n,
|
|
17
|
+
isOptional: !1,
|
|
18
|
+
esystemVersion: [o, s],
|
|
19
|
+
language: c,
|
|
20
|
+
eprojectFormatVersion: [l, u],
|
|
21
|
+
fileType: d,
|
|
22
|
+
projectType: f
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { r as ESystemInfoKey };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=esystemInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esystemInfo.js","names":[],"sources":["../../../../src/lib/epl/sections/esystemInfo.ts"],"sourcesContent":["/**\n * System-info section (系统信息段, key 0x02007319) — port of `Sections/ESystemInfoSection.cs`.\n *\n * Critical: its `Language` field decides the codepage the REST of the document is decoded with (see\n * {@link decoderForLanguage}), and `FileType` distinguishes 源码(1) from 模块(3). Layout is a fixed run of\n * int16/int32 (no strings), so the decoder is irrelevant here.\n */\nimport { BinaryReader } from '../io/binaryReader'\nimport type { ParserContext, SectionBase, SectionType } from '../model/section'\n\nconst KEY = 0x02007319\nconst NAME = '系统信息段'\n\nexport interface ESystemInfoSection extends SectionBase {\n kind: 'systemInfo'\n /** [major, minor] of the e-language system that wrote the file. */\n esystemVersion: [number, number]\n /** 1=中文(GBK), 2=英语(ASCII), 3=中文(BIG5), 4=日文(SJIS). Drives {@link decoderForLanguage}. */\n language: number\n /** [major, minor] of the .e project format. */\n eprojectFormatVersion: [number, number]\n /** 1=源码(.e), 3=模块(.ec). */\n fileType: number\n projectType: number\n}\n\nexport const ESystemInfoKey: SectionType<ESystemInfoSection> = {\n key: KEY,\n name: NAME,\n isOptional: false,\n parse(data: Uint8Array, ctx: ParserContext): ESystemInfoSection {\n const r = new BinaryReader(data, ctx.dec)\n const sysMajor = r.readInt16()\n const sysMinor = r.readInt16()\n r.readInt32() // skip Unknown\n const language = r.readInt32()\n const fmtMajor = r.readInt16()\n const fmtMinor = r.readInt16()\n const fileType = r.readInt32()\n r.readInt32() // skip Unknown\n const projectType = r.readInt32()\n return {\n kind: 'systemInfo',\n sectionKey: KEY,\n sectionName: NAME,\n isOptional: false,\n esystemVersion: [sysMajor, sysMinor],\n language,\n eprojectFormatVersion: [fmtMajor, fmtMinor],\n fileType,\n projectType,\n }\n },\n}\n"],"mappings":";;AAUA,IAAM,IAAM,UACN,IAAO,SAeA,IAAkD;CAC7D,KAAK;CACL,MAAM;CACN,YAAY;CACZ,MAAM,GAAkB,GAAwC;EAC9D,IAAM,IAAI,IAAI,EAAa,GAAM,EAAI,GAAG,GAClC,IAAW,EAAE,UAAU,GACvB,IAAW,EAAE,UAAU;EAC7B,EAAE,UAAU;EACZ,IAAM,IAAW,EAAE,UAAU,GACvB,IAAW,EAAE,UAAU,GACvB,IAAW,EAAE,UAAU,GACvB,IAAW,EAAE,UAAU;EAC7B,EAAE,UAAU;EACZ,IAAM,IAAc,EAAE,UAAU;EAChC,OAAO;GACL,MAAM;GACN,YAAY;GACZ,aAAa;GACb,YAAY;GACZ,gBAAgB,CAAC,GAAU,CAAQ;GACnC;GACA,uBAAuB,CAAC,GAAU,CAAQ;GAC1C;GACA;EACF;CACF;AACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BinaryReader as e } from "../io/binaryReader.js";
|
|
2
|
+
//#region src/lib/epl/sections/losable.ts
|
|
3
|
+
var t = 83915545, n = "可丢失程序段";
|
|
4
|
+
function r(e) {
|
|
5
|
+
let t = e.readInt32(), n = e.readInt32(), r = e.pos + n, i = e.readInt32sWithFixedLength(t);
|
|
6
|
+
e.readInt32sWithFixedLength(t);
|
|
7
|
+
let a = e.readInt32sWithFixedLength(t), o = e.pos, s = [];
|
|
8
|
+
for (let n = 0; n < t; n++) e.pos = o + a[n], s.push({
|
|
9
|
+
id: i[n],
|
|
10
|
+
name: e.readCStyleString()
|
|
11
|
+
});
|
|
12
|
+
return e.pos = r, s;
|
|
13
|
+
}
|
|
14
|
+
var i = {
|
|
15
|
+
key: t,
|
|
16
|
+
name: n,
|
|
17
|
+
isOptional: !0,
|
|
18
|
+
parse(i, a) {
|
|
19
|
+
let o = new e(i, a.dec);
|
|
20
|
+
return {
|
|
21
|
+
kind: "losable",
|
|
22
|
+
sectionKey: t,
|
|
23
|
+
sectionName: n,
|
|
24
|
+
isOptional: !0,
|
|
25
|
+
outFile: o.readStringWithLengthPrefix(),
|
|
26
|
+
removedItems: r(o)
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { i as LosableSectionKey };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=losable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"losable.js","names":[],"sources":["../../../../src/lib/epl/sections/losable.ts"],"sourcesContent":["/**\n * Losable section (可丢失程序段, key 0x05007319) — port of `Sections/LosableSection.cs` (read path).\n *\n * Records id→name for items removed via delete/undo. The IDE keeps these so a still-referenced id can recover\n * its old name; IdToNameMap folds them in as a FALLBACK (only when the id isn't already named by the code /\n * resource sections), which is why some local/sub names in source files come from here.\n *\n * `RemovedDefinedItems` is an id+offset block table with an extra per-item name-code column (a checksum we\n * don't need to verify for read-only). After it, trailing bytes are ignored.\n */\nimport { BinaryReader } from '../io/binaryReader'\nimport type { ParserContext, SectionBase, SectionType } from '../model/section'\n\nconst KEY = 0x05007319\nconst NAME = '可丢失程序段'\n\nexport interface RemovedItem {\n id: number\n name: string\n}\n\nexport interface LosableSection extends SectionBase {\n kind: 'losable'\n outFile: string\n removedItems: RemovedItem[]\n}\n\n// count, size, int32[count] ids, int32[count] nameCodes (skipped), int32[count] offsets, then each name at\n// (start + offset) as a CString. (Like the generic block table but with the extra nameCode column.)\nfunction readRemovedItems(r: BinaryReader): RemovedItem[] {\n const count = r.readInt32()\n const size = r.readInt32()\n const endPos = r.pos + size\n const ids = r.readInt32sWithFixedLength(count)\n r.readInt32sWithFixedLength(count) // nameCode checksums — not needed for read-only\n const offsets = r.readInt32sWithFixedLength(count)\n const startPos = r.pos\n const result: RemovedItem[] = []\n for (let i = 0; i < count; i++) {\n r.pos = startPos + offsets[i]\n result.push({ id: ids[i], name: r.readCStyleString() })\n }\n r.pos = endPos\n return result\n}\n\nexport const LosableSectionKey: SectionType<LosableSection> = {\n key: KEY,\n name: NAME,\n isOptional: true,\n parse(data: Uint8Array, ctx: ParserContext): LosableSection {\n const r = new BinaryReader(data, ctx.dec)\n const outFile = r.readStringWithLengthPrefix()\n const removedItems = readRemovedItems(r)\n return {\n kind: 'losable',\n sectionKey: KEY,\n sectionName: NAME,\n isOptional: true,\n outFile,\n removedItems,\n }\n },\n}\n"],"mappings":";;AAaA,IAAM,IAAM,UACN,IAAO;AAeb,SAAS,EAAiB,GAAgC;CACxD,IAAM,IAAQ,EAAE,UAAU,GACpB,IAAO,EAAE,UAAU,GACnB,IAAS,EAAE,MAAM,GACjB,IAAM,EAAE,0BAA0B,CAAK;CAC7C,EAAE,0BAA0B,CAAK;CACjC,IAAM,IAAU,EAAE,0BAA0B,CAAK,GAC3C,IAAW,EAAE,KACb,IAAwB,CAAC;CAC/B,KAAK,IAAI,IAAI,GAAG,IAAI,GAAO,KAEzB,AADA,EAAE,MAAM,IAAW,EAAQ,IAC3B,EAAO,KAAK;EAAE,IAAI,EAAI;EAAI,MAAM,EAAE,iBAAiB;CAAE,CAAC;CAGxD,OADA,EAAE,MAAM,GACD;AACT;AAEA,IAAa,IAAiD;CAC5D,KAAK;CACL,MAAM;CACN,YAAY;CACZ,MAAM,GAAkB,GAAoC;EAC1D,IAAM,IAAI,IAAI,EAAa,GAAM,EAAI,GAAG;EAGxC,OAAO;GACL,MAAM;GACN,YAAY;GACZ,aAAa;GACb,YAAY;GACZ,SAPc,EAAE,2BAOhB;GACA,cAPmB,EAAiB,CAOpC;EACF;CACF;AACF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { BinaryReader as e } from "../io/binaryReader.js";
|
|
2
|
+
//#region src/lib/epl/sections/projectConfig.ts
|
|
3
|
+
var t = 16806681, n = "用户信息段", r = {
|
|
4
|
+
key: t,
|
|
5
|
+
name: n,
|
|
6
|
+
isOptional: !1,
|
|
7
|
+
parse(r, i) {
|
|
8
|
+
let a = new e(r, i.dec), o = a.readStringWithLengthPrefix(), s = a.readStringWithLengthPrefix(), c = a.readStringWithLengthPrefix(), l = a.readStringWithLengthPrefix(), u = a.readStringWithLengthPrefix(), d = a.readStringWithLengthPrefix(), f = a.readStringWithLengthPrefix(), p = a.readStringWithLengthPrefix(), m = a.readStringWithLengthPrefix(), h = a.readStringWithLengthPrefix(), g = [
|
|
9
|
+
a.readInt32(),
|
|
10
|
+
a.readInt32(),
|
|
11
|
+
a.readInt32(),
|
|
12
|
+
a.readInt32()
|
|
13
|
+
], _ = a.readInt32() === 0, v = a.readStringWithFixedLength(20), y = a.readInt32() !== 0;
|
|
14
|
+
return a.readInt32(), {
|
|
15
|
+
kind: "projectConfig",
|
|
16
|
+
sectionKey: t,
|
|
17
|
+
sectionName: n,
|
|
18
|
+
isOptional: !1,
|
|
19
|
+
name: o,
|
|
20
|
+
description: s,
|
|
21
|
+
author: c,
|
|
22
|
+
zipCode: l,
|
|
23
|
+
address: u,
|
|
24
|
+
telephoneNumber: d,
|
|
25
|
+
faxNumber: f,
|
|
26
|
+
email: p,
|
|
27
|
+
homepage: m,
|
|
28
|
+
copyright: h,
|
|
29
|
+
version: g,
|
|
30
|
+
writeVersion: _,
|
|
31
|
+
compilePlugins: v,
|
|
32
|
+
exportPublicClassMethod: y
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { r as ProjectConfigKey };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=projectConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projectConfig.js","names":[],"sources":["../../../../src/lib/epl/sections/projectConfig.ts"],"sourcesContent":["/**\n * User-info / project-config section (用户信息段, key 0x01007319) — port of `Sections/ProjectConfigSection.cs`.\n *\n * Holds the project's metadata: name, description, author + contact fields, copyright, a 4-part version, and a\n * couple of flags. All strings are length-prefixed and decoded with the document codepage.\n */\nimport { BinaryReader } from '../io/binaryReader'\nimport type { ParserContext, SectionBase, SectionType } from '../model/section'\n\nconst KEY = 0x01007319\nconst NAME = '用户信息段'\n\nexport interface ProjectConfigSection extends SectionBase {\n kind: 'projectConfig'\n /** Project name (NOT the section name). */\n name: string\n description: string\n author: string\n zipCode: string\n address: string\n telephoneNumber: string\n faxNumber: string\n email: string\n homepage: string\n copyright: string\n /** [major, minor, build, revision]. */\n version: [number, number, number, number]\n /** Whether the compiled output writes the version resource (C#: stored as `ReadInt32() == 0`). */\n writeVersion: boolean\n /** Compile-plugins field (fixed 20-byte string). */\n compilePlugins: string\n exportPublicClassMethod: boolean\n}\n\nexport const ProjectConfigKey: SectionType<ProjectConfigSection> = {\n key: KEY,\n name: NAME,\n isOptional: false,\n parse(data: Uint8Array, ctx: ParserContext): ProjectConfigSection {\n const r = new BinaryReader(data, ctx.dec)\n const name = r.readStringWithLengthPrefix()\n const description = r.readStringWithLengthPrefix()\n const author = r.readStringWithLengthPrefix()\n const zipCode = r.readStringWithLengthPrefix()\n const address = r.readStringWithLengthPrefix()\n const telephoneNumber = r.readStringWithLengthPrefix()\n const faxNumber = r.readStringWithLengthPrefix()\n const email = r.readStringWithLengthPrefix()\n const homepage = r.readStringWithLengthPrefix()\n const copyright = r.readStringWithLengthPrefix()\n const version: [number, number, number, number] = [\n r.readInt32(),\n r.readInt32(),\n r.readInt32(),\n r.readInt32(),\n ]\n const writeVersion = r.readInt32() === 0\n const compilePlugins = r.readStringWithFixedLength(20)\n const exportPublicClassMethod = r.readInt32() !== 0\n r.readInt32() // skip Unknown\n return {\n kind: 'projectConfig',\n sectionKey: KEY,\n sectionName: NAME,\n isOptional: false,\n name,\n description,\n author,\n zipCode,\n address,\n telephoneNumber,\n faxNumber,\n email,\n homepage,\n copyright,\n version,\n writeVersion,\n compilePlugins,\n exportPublicClassMethod,\n }\n },\n}\n"],"mappings":";;AASA,IAAM,IAAM,UACN,IAAO,SAwBA,IAAsD;CACjE,KAAK;CACL,MAAM;CACN,YAAY;CACZ,MAAM,GAAkB,GAA0C;EAChE,IAAM,IAAI,IAAI,EAAa,GAAM,EAAI,GAAG,GAClC,IAAO,EAAE,2BAA2B,GACpC,IAAc,EAAE,2BAA2B,GAC3C,IAAS,EAAE,2BAA2B,GACtC,IAAU,EAAE,2BAA2B,GACvC,IAAU,EAAE,2BAA2B,GACvC,IAAkB,EAAE,2BAA2B,GAC/C,IAAY,EAAE,2BAA2B,GACzC,IAAQ,EAAE,2BAA2B,GACrC,IAAW,EAAE,2BAA2B,GACxC,IAAY,EAAE,2BAA2B,GACzC,IAA4C;GAChD,EAAE,UAAU;GACZ,EAAE,UAAU;GACZ,EAAE,UAAU;GACZ,EAAE,UAAU;EACd,GACM,IAAe,EAAE,UAAU,MAAM,GACjC,IAAiB,EAAE,0BAA0B,EAAE,GAC/C,IAA0B,EAAE,UAAU,MAAM;EAElD,OADA,EAAE,UAAU,GACL;GACL,MAAM;GACN,YAAY;GACZ,aAAa;GACb,YAAY;GACZ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;CACF;AACF"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { BinaryReader as e } from "../io/binaryReader.js";
|
|
2
|
+
//#region src/lib/epl/sections/resource.ts
|
|
3
|
+
var t = 67138329, n = "程序资源段";
|
|
4
|
+
function r(e) {
|
|
5
|
+
return e.readBlocksWithIdAndOffest((e, t) => {
|
|
6
|
+
let n = e.readInt32();
|
|
7
|
+
return e.skip(20), {
|
|
8
|
+
id: t,
|
|
9
|
+
dataType: n,
|
|
10
|
+
name: e.readCStyleString()
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function i(e) {
|
|
15
|
+
return e.readBlocksWithIdAndMemoryAddress((e, t, n) => (e.readInt32(), {
|
|
16
|
+
id: t,
|
|
17
|
+
memoryAddress: n,
|
|
18
|
+
classId: e.readInt32(),
|
|
19
|
+
name: e.readStringWithLengthPrefix(),
|
|
20
|
+
comment: e.readStringWithLengthPrefix(),
|
|
21
|
+
elements: r(e)
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
function a(e, t) {
|
|
25
|
+
switch (t >>> 28) {
|
|
26
|
+
case 1: switch (e.readByte()) {
|
|
27
|
+
case 23: return {
|
|
28
|
+
kind: "double",
|
|
29
|
+
value: e.readFloat64()
|
|
30
|
+
};
|
|
31
|
+
case 24: return {
|
|
32
|
+
kind: "bool",
|
|
33
|
+
value: e.readInt32() !== 0
|
|
34
|
+
};
|
|
35
|
+
case 25: return {
|
|
36
|
+
kind: "datetime",
|
|
37
|
+
oa: e.readFloat64()
|
|
38
|
+
};
|
|
39
|
+
case 26: return {
|
|
40
|
+
kind: "string",
|
|
41
|
+
value: e.readBStr() ?? ""
|
|
42
|
+
};
|
|
43
|
+
default: return { kind: "null" };
|
|
44
|
+
}
|
|
45
|
+
case 2: return {
|
|
46
|
+
kind: "image",
|
|
47
|
+
bytes: e.readBytesWithLengthPrefix()
|
|
48
|
+
};
|
|
49
|
+
case 3: return {
|
|
50
|
+
kind: "sound",
|
|
51
|
+
bytes: e.readBytesWithLengthPrefix()
|
|
52
|
+
};
|
|
53
|
+
default: return { kind: "null" };
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function o(e) {
|
|
57
|
+
return e.readBlocksWithIdAndOffest((e, t) => ({
|
|
58
|
+
id: t,
|
|
59
|
+
flags: e.readInt16(),
|
|
60
|
+
name: e.readCStyleString(),
|
|
61
|
+
comment: e.readCStyleString(),
|
|
62
|
+
value: a(e, t)
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
var s = {
|
|
66
|
+
key: t,
|
|
67
|
+
name: n,
|
|
68
|
+
isOptional: !1,
|
|
69
|
+
parse(r, a) {
|
|
70
|
+
let s = new e(r, a.dec);
|
|
71
|
+
return {
|
|
72
|
+
kind: "resource",
|
|
73
|
+
sectionKey: t,
|
|
74
|
+
sectionName: n,
|
|
75
|
+
isOptional: !1,
|
|
76
|
+
forms: i(s),
|
|
77
|
+
constants: o(s)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
//#endregion
|
|
82
|
+
export { s as ResourceSectionKey };
|
|
83
|
+
|
|
84
|
+
//# sourceMappingURL=resource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource.js","names":[],"sources":["../../../../src/lib/epl/sections/resource.ts"],"sourcesContent":["/**\n * Resource section (程序资源段, key 0x04007319) — port of `Sections/ResourceSection.cs` (read path).\n *\n * Holds the windows (FormInfo + its controls/menus) and the project constants (ConstantInfo). We parse the\n * NAMES (the main thing the decompiler needs: a code reference like `#常量` / `窗口.控件` resolves through the\n * name map) plus enough geometry-free shape to walk the bytes. Form elements and constants use the id+offset\n * block table (each block is offset-addressed), so we read just the leading fields (id / dataType / name —\n * value, geometry and extension data are skipped via the per-block offsets), which keeps this robust.\n */\nimport { BinaryReader } from '../io/binaryReader'\nimport type { ParserContext, SectionBase, SectionType } from '../model/section'\n\nconst KEY = 0x04007319\nconst NAME = '程序资源段'\n\n/**\n * A constant's typed value. The high nibble of the constant `id` picks the family: 1 ⇒ 普通常量 (a type-tagged\n * scalar — null / double / bool / DateTime / text), 2 ⇒ 图片资源, 3 ⇒ 声音资源 (both raw resource bytes).\n */\nexport type EplConstantValue =\n | { kind: 'null' }\n | { kind: 'double'; value: number }\n | { kind: 'bool'; value: boolean }\n /** OLE Automation date (days since 1899-12-30), rendered to `yyyy年MM月dd日…` for display. */\n | { kind: 'datetime'; oa: number }\n | { kind: 'string'; value: string }\n | { kind: 'image'; bytes: Uint8Array }\n | { kind: 'sound'; bytes: Uint8Array }\n\n/** A project constant / image / sound resource (the high nibble of `id` distinguishes them). */\nexport interface EplConstant {\n id: number\n flags: number\n name: string\n comment: string\n value: EplConstantValue\n}\n\n/** A control or menu on a form (only id/dataType/name kept — enough for name resolution). */\nexport interface EplFormElement {\n id: number\n dataType: number\n name: string\n}\n\nexport interface EplForm {\n id: number\n memoryAddress: number\n /** The associated window class id. */\n classId: number\n name: string\n comment: string\n elements: EplFormElement[]\n}\n\nexport interface ResourceSection extends SectionBase {\n kind: 'resource'\n forms: EplForm[]\n constants: EplConstant[]\n}\n\n// Each element block starts [dataType:int32][UnknownBeforeName:20][Name:CString]… — identical for controls and\n// menus, so we read the name uniformly and let the block offsets skip the rest.\nfunction readFormElements(r: BinaryReader): EplFormElement[] {\n return r.readBlocksWithIdAndOffest((reader, id) => {\n const dataType = reader.readInt32()\n reader.skip(20) // UnknownBeforeName\n const name = reader.readCStyleString()\n return { id, dataType, name }\n })\n}\n\nfunction readForms(r: BinaryReader): EplForm[] {\n return r.readBlocksWithIdAndMemoryAddress((reader, id, memoryAddress) => {\n reader.readInt32() // UnknownBeforeClass\n const classId = reader.readInt32()\n const name = reader.readStringWithLengthPrefix()\n const comment = reader.readStringWithLengthPrefix()\n const elements = readFormElements(reader)\n return { id, memoryAddress, classId, name, comment, elements }\n })\n}\n\n// Constant blocks: int16 flags, CString name, CString comment, then a value whose layout depends on the\n// id's high nibble (port of ConstantInfo's per-block read; see EProjectFile ConstantInfo.cs):\n// nibble 1 (常量): a type byte then 22⇒null · 23⇒double · 24⇒bool(int32≠0) · 25⇒DateTime(OADate double) ·\n// 26⇒text(BStr); nibble 2/3 (图片/声音): length-prefixed raw bytes (no type byte).\n// Any trailing extension bytes are skipped via the block offset (each block is offset-addressed, so a misread\n// value can never desync the following blocks).\nfunction readConstantValue(r: BinaryReader, id: number): EplConstantValue {\n switch (id >>> 28) {\n case 1: {\n const type = r.readByte()\n switch (type) {\n case 23:\n return { kind: 'double', value: r.readFloat64() }\n case 24:\n return { kind: 'bool', value: r.readInt32() !== 0 }\n case 25:\n return { kind: 'datetime', oa: r.readFloat64() }\n case 26:\n return { kind: 'string', value: r.readBStr() ?? '' }\n default: // 22 (null) or any unknown tag\n return { kind: 'null' }\n }\n }\n case 2:\n return { kind: 'image', bytes: r.readBytesWithLengthPrefix() }\n case 3:\n return { kind: 'sound', bytes: r.readBytesWithLengthPrefix() }\n default:\n return { kind: 'null' }\n }\n}\n\nfunction readConstants(r: BinaryReader): EplConstant[] {\n return r.readBlocksWithIdAndOffest((reader, id) => {\n const flags = reader.readInt16()\n const name = reader.readCStyleString()\n const comment = reader.readCStyleString()\n const value = readConstantValue(reader, id)\n return { id, flags, name, comment, value }\n })\n}\n\nexport const ResourceSectionKey: SectionType<ResourceSection> = {\n key: KEY,\n name: NAME,\n isOptional: false,\n parse(data: Uint8Array, ctx: ParserContext): ResourceSection {\n const r = new BinaryReader(data, ctx.dec)\n const forms = readForms(r)\n const constants = readConstants(r)\n return {\n kind: 'resource',\n sectionKey: KEY,\n sectionName: NAME,\n isOptional: false,\n forms,\n constants,\n }\n },\n}\n"],"mappings":";;AAYA,IAAM,IAAM,UACN,IAAO;AAkDb,SAAS,EAAiB,GAAmC;CAC3D,OAAO,EAAE,2BAA2B,GAAQ,MAAO;EACjD,IAAM,IAAW,EAAO,UAAU;EAGlC,OAFA,EAAO,KAAK,EAAE,GAEP;GAAE;GAAI;GAAU,MADV,EAAO,iBACG;EAAK;CAC9B,CAAC;AACH;AAEA,SAAS,EAAU,GAA4B;CAC7C,OAAO,EAAE,kCAAkC,GAAQ,GAAI,OACrD,EAAO,UAAU,GAKV;EAAE;EAAI;EAAe,SAJZ,EAAO,UAIK;EAAS,MAHxB,EAAO,2BAGiB;EAAM,SAF3B,EAAO,2BAEoB;EAAS,UADnC,EAAiB,CACkB;CAAS,EAC9D;AACH;AAQA,SAAS,EAAkB,GAAiB,GAA8B;CACxE,QAAQ,MAAO,IAAf;EACE,KAAK,GAEH,QADa,EAAE,SACP,GAAR;GACE,KAAK,IACH,OAAO;IAAE,MAAM;IAAU,OAAO,EAAE,YAAY;GAAE;GAClD,KAAK,IACH,OAAO;IAAE,MAAM;IAAQ,OAAO,EAAE,UAAU,MAAM;GAAE;GACpD,KAAK,IACH,OAAO;IAAE,MAAM;IAAY,IAAI,EAAE,YAAY;GAAE;GACjD,KAAK,IACH,OAAO;IAAE,MAAM;IAAU,OAAO,EAAE,SAAS,KAAK;GAAG;GACrD,SACE,OAAO,EAAE,MAAM,OAAO;EAC1B;EAEF,KAAK,GACH,OAAO;GAAE,MAAM;GAAS,OAAO,EAAE,0BAA0B;EAAE;EAC/D,KAAK,GACH,OAAO;GAAE,MAAM;GAAS,OAAO,EAAE,0BAA0B;EAAE;EAC/D,SACE,OAAO,EAAE,MAAM,OAAO;CAC1B;AACF;AAEA,SAAS,EAAc,GAAgC;CACrD,OAAO,EAAE,2BAA2B,GAAQ,OAKnC;EAAE;EAAI,OAJC,EAAO,UAIR;EAAO,MAHP,EAAO,iBAGA;EAAM,SAFV,EAAO,iBAEG;EAAS,OADrB,EAAkB,GAAQ,CACL;CAAM,EAC1C;AACH;AAEA,IAAa,IAAmD;CAC9D,KAAK;CACL,MAAM;CACN,YAAY;CACZ,MAAM,GAAkB,GAAqC;EAC3D,IAAM,IAAI,IAAI,EAAa,GAAM,EAAI,GAAG;EAGxC,OAAO;GACL,MAAM;GACN,YAAY;GACZ,aAAa;GACb,YAAY;GACZ,OAPY,EAAU,CAOtB;GACA,WAPgB,EAAc,CAO9B;EACF;CACF;AACF"}
|
package/dist/lib/fileType.d.ts
CHANGED
|
@@ -268,8 +268,10 @@ export declare function isGeoFile(name: string, mime?: string | null): boolean;
|
|
|
268
268
|
* a concrete non-subtitle media mime rules it out, blank/octet-stream/text defers to the extension.
|
|
269
269
|
*/
|
|
270
270
|
export declare function isSubtitleFile(name: string, mime?: string | null): boolean;
|
|
271
|
+
/** STEP is textual CAD data; a text/plain MIME must not send it to the source/log viewer. */
|
|
272
|
+
export declare function isStepFile(name: string, mime?: string | null): boolean;
|
|
271
273
|
/**
|
|
272
|
-
* Is this a 3D model (`.stl`/`.obj`/`.ply`/`.glb`/`.gltf`)?
|
|
274
|
+
* Is this a 3D model (`.stl`/`.obj`/`.ply`/`.glb`/`.gltf`/`.stp`/`.step`)? Opens the model viewer,
|
|
273
275
|
* which renders them with three.js in-browser (see ModelViewer.vue) — auto-framed, lit, with orbit controls.
|
|
274
276
|
* Prefer `mime` (`model/*`), fall back to the extension; a concrete text/image/audio/video mime rules it out.
|
|
275
277
|
*/
|