mirror of
https://github.com/CharaChorder/DeviceManager.git
synced 2026-01-07 02:22:52 +00:00
feat: chord backup import
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
import type {
|
import type {
|
||||||
CharaBackupFile,
|
CharaBackupFile,
|
||||||
CharaChordFile,
|
CharaChordFile,
|
||||||
CharaSettingsFile,
|
|
||||||
CharaLayoutFile,
|
|
||||||
CharaFile,
|
CharaFile,
|
||||||
|
CharaLayoutFile,
|
||||||
|
CharaSettingsFile,
|
||||||
} from "$lib/share/chara-file.js"
|
} from "$lib/share/chara-file.js"
|
||||||
import {changes, ChangeType, chords, layout, settings} from "$lib/undo-redo.js"
|
|
||||||
import type {Change} from "$lib/undo-redo.js"
|
import type {Change} from "$lib/undo-redo.js"
|
||||||
|
import {changes, ChangeType, chords, layout, settings} from "$lib/undo-redo.js"
|
||||||
import {get} from "svelte/store"
|
import {get} from "svelte/store"
|
||||||
import {serialPort} from "../serial/connection"
|
import {serialPort} from "../serial/connection"
|
||||||
import {csvLayoutToJson, isCsvLayout} from "$lib/backup/compat/legacy-layout"
|
import {csvLayoutToJson, isCsvLayout} from "$lib/backup/compat/legacy-layout"
|
||||||
@@ -109,7 +109,14 @@ export function restoreFromFile(
|
|||||||
|
|
||||||
export function getChangesFromChordFile(file: CharaChordFile) {
|
export function getChangesFromChordFile(file: CharaChordFile) {
|
||||||
const changes: Change[] = []
|
const changes: Change[] = []
|
||||||
// TODO...
|
for (const [input, output] of file.chords) {
|
||||||
|
changes.push({
|
||||||
|
type: ChangeType.Chord,
|
||||||
|
actions: input,
|
||||||
|
phrase: output,
|
||||||
|
id: input,
|
||||||
|
})
|
||||||
|
}
|
||||||
return changes
|
return changes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user