This commit is contained in:
Silent YANG 2024-07-10 20:38:53 +08:00
parent ca3a01ef2e
commit fc8eacd2be

View file

@ -204,16 +204,19 @@
const selectFile = () => { const selectFile = () => {
const input = document.createElement('input'); const input = document.createElement('input');
input.type = 'file'; input.type = 'file';
input.multiple = true;
input.onchange = async () => { input.onchange = async () => {
if(input.files){ if(input.files){
const blob = new Blob([input.files[0]], { type: 'application/octet-stream' }); for(let i = 0; i < input.files.length; i++){
const rawEEPROM = new Uint8Array(await blob.arrayBuffer()); const blob = new Blob([input.files[i]], { type: 'application/octet-stream' });
const firmware = { const rawEEPROM = new Uint8Array(await blob.arrayBuffer());
binaryFile: unpack(rawEEPROM), const firmware = {
binaryName: input.files[0].name, binaryFile: unpack(rawEEPROM),
color: getColor() binaryName: input.files[i].name,
color: getColor()
}
state.rom.push(firmware)
} }
state.rom.push(firmware)
} }
}; };
input.click(); input.click();
@ -293,7 +296,7 @@
} }
const changeName = (val: any) => { const changeName = (val: any) => {
state.rom[val].binaryName = state.rom[val].binaryName.replace(/[^\a-\z\A-\Z0-9.]/g, '') state.rom[val].binaryName = state.rom[val].binaryName.replace(/[^\x00-\xff]/g, '')
}; };
</script> </script>