Skip to content

Commit

Permalink
Merge pull request #569 from silentrald/feat/76
Browse files Browse the repository at this point in the history
[feat-76] support drag and drop of mod files (zip/dll files only)
  • Loading branch information
Zagrios authored Dec 8, 2024
2 parents f73b1cd + c3a1a61 commit cfae1d9
Show file tree
Hide file tree
Showing 16 changed files with 356 additions and 21 deletions.
16 changes: 16 additions & 0 deletions assets/jsons/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"latest": "Neueste",
"description": "Beschreibung",
"dropdown": {
"import-mods": "Mods importieren",
"uninstall-all": "Alle deinstallieren",
"unselect-all": "Alle abwählen"
}
Expand All @@ -116,6 +117,10 @@
"title": "Mods bereits installiert",
"description": "Alle ausgewählten Mods sind bereits installiert"
}
},
"drop-zone": {
"text": "Importiere deine Mods",
"subtext": "Ziehe deine \"zip\"- oder \"dll\"-Dateien hierher, um sie zu importieren"
}
},
"dropdown": {
Expand Down Expand Up @@ -526,6 +531,17 @@
"no-mods": "Keine Mods sind in dieser Version installiert 😑"
}
}
},
"import-mod": {
"titles": {
"success": "Mod-Import abgeschlossen",
"error": "Es ist ein Fehler beim Importieren der Mods aufgetreten"
},
"msgs": {
"success": "Mods erfolgreich importiert.",
"some-success": "Einige Mods wurden erfolgreich importiert.",
"no-dlls": "Die Datei(en) enthalten keine \"dll\"-Dateien."
}
}
},
"maps": {
Expand Down
16 changes: 16 additions & 0 deletions assets/jsons/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"latest": "Latest",
"description": "Description",
"dropdown": {
"import-mods": "Import mods",
"uninstall-all": "Uninstall all",
"unselect-all": "Unselect all"
}
Expand All @@ -116,6 +117,10 @@
"title": "Mods already installed",
"description": "All selected mods are already installed"
}
},
"drop-zone": {
"text": "Import your mods",
"subtext": "Drop your \"zip\" or \"dll\" files here to import them"
}
},
"dropdown": {
Expand Down Expand Up @@ -526,6 +531,17 @@
"no-mods": "No mods are installed in this version 😑"
}
}
},
"import-mod": {
"titles": {
"success": "Mods import completed",
"error": "An error occurred during the mods import"
},
"msgs": {
"success": "Mods successfully imported.",
"some-success": "Some mods were successfully imported.",
"no-dlls": "The file(s) do not contain any \"dll\" files."
}
}
},
"maps": {
Expand Down
16 changes: 16 additions & 0 deletions assets/jsons/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"latest": "Último",
"description": "Descripción",
"dropdown": {
"import-mods": "Importar mods",
"uninstall-all": "Desinstalar todos",
"unselect-all": "Deseleccionar todo"
}
Expand All @@ -116,6 +117,10 @@
"title": "Mods ya instalados",
"description": "Todos los mods seleccionados ya están instalados"
}
},
"drop-zone": {
"text": "Importa tus mods",
"subtext": "Coloca tus archivos \"zip\" o \"dll\" aquí para importarlos"
}
},
"dropdown": {
Expand Down Expand Up @@ -526,6 +531,17 @@
"no-mods": "No hay mods instalados en esta versión 😑"
}
}
},
"import-mod": {
"titles": {
"success": "Importación de mods completada",
"error": "Ocurrió un error durante la importación de mods"
},
"msgs": {
"success": "Mods importados con éxito.",
"some-success": "Algunos mods fueron importados con éxito.",
"no-dlls": "El(los) archivo(s) no contienen archivos \"dll\"."
}
}
},
"maps": {
Expand Down
16 changes: 16 additions & 0 deletions assets/jsons/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"latest": "Récent",
"description": "Description",
"dropdown": {
"import-mods": "Importer des mods",
"uninstall-all": "Tout désinstaller",
"unselect-all": "Tout désélectionner"
}
Expand All @@ -116,6 +117,10 @@
"title": "Mods déjà installées",
"description": "Tous les mods séléctionnées sont déjà installées"
}
},
"drop-zone": {
"text": "Importez vos mods",
"subtext": "Déposez vos fichiers \"zip\" ou \"dll\" ici pour les importer"
}
},
"dropdown": {
Expand Down Expand Up @@ -526,6 +531,17 @@
"no-mods": "Aucun mod n'est installé dans dans cette version 😑"
}
}
},
"import-mod": {
"titles": {
"success": "Importation des mods terminée",
"error": "Une erreur est survenue lors de l'importation des mods"
},
"msgs": {
"success": "Mods importés avec succès.",
"some-success": "Certains mods ont été importés avec succès.",
"no-dlls": "Le(s) fichier(s) ne contient(ent) aucun fichier \"dll\"."
}
}
},
"maps": {
Expand Down
16 changes: 16 additions & 0 deletions assets/jsons/translations/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"latest": "最新",
"description": "說明",
"dropdown": {
"import-mods": "モッドをインポート",
"uninstall-all": "全てアンインストールする",
"unselect-all": "すべて選択解除"
}
Expand All @@ -116,6 +117,10 @@
"title": "すでにインストール済みのMOD",
"description": "選択したすべてのMODはすでにインストールされています"
}
},
"drop-zone": {
"text": "モッドをインポートする",
"subtext": "「zip」または「dll」ファイルをここにドロップしてインポートする"
}
},
"dropdown": {
Expand Down Expand Up @@ -526,6 +531,17 @@
"no-mods": "このバージョンのModはインストールされていません 😑"
}
}
},
"import-mod": {
"titles": {
"success": "モッドのインポートが完了しました",
"error": "モッドのインポート中にエラーが発生しました"
},
"msgs": {
"success": "モッドが正常にインポートされました。",
"some-success": "一部のモッドが正常にインポートされました。",
"no-dlls": "ファイルに \"dll\" ファイルが含まれていません。"
}
}
},
"maps": {
Expand Down
16 changes: 16 additions & 0 deletions assets/jsons/translations/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"latest": "최신",
"description": "설명",
"dropdown": {
"import-mods": "모드 가져오기",
"uninstall-all": "모두 제거",
"unselect-all": "모두 선택 해제"
}
Expand All @@ -116,6 +117,10 @@
"title": "이미 설치된 모드",
"description": "선택한 모든 모드가 이미 설치되었습니다."
}
},
"drop-zone": {
"text": "모드를 가져오기",
"subtext": "\"zip\" 또는 \"dll\" 파일을 여기에 드롭하여 가져오기"
}
},
"dropdown": {
Expand Down Expand Up @@ -526,6 +531,17 @@
"no-mods": "이 버전에 설치된 Mod가 없습니다 😑"
}
}
},
"import-mod": {
"titles": {
"success": "모드 임포트 완료",
"error": "모드 임포트 중 오류가 발생했습니다"
},
"msgs": {
"success": "모드가 성공적으로 임포트되었습니다.",
"some-success": "일부 모드가 성공적으로 임포트되었습니다.",
"no-dlls": "파일에 \"dll\" 파일이 포함되어 있지 않습니다."
}
}
},
"maps": {
Expand Down
16 changes: 16 additions & 0 deletions assets/jsons/translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"latest": "Latest",
"description": "Описание",
"dropdown": {
"import-mods": "Импортировать моды",
"uninstall-all": "Удалить всё",
"unselect-all": "Снять все выделения"
}
Expand All @@ -116,6 +117,10 @@
"title": "Моды уже установлены",
"description": "Все выбранные моды уже установлены"
}
},
"drop-zone": {
"text": "Импортируйте свои моды",
"subtext": "Перетащите ваши файлы \"zip\" или \"dll\" сюда для импорта"
}
},
"dropdown": {
Expand Down Expand Up @@ -526,6 +531,17 @@
"no-mods": "Для этой версии не было установлено модов 😑"
}
}
},
"import-mod": {
"titles": {
"success": "Импорт модов завершен",
"error": "Произошла ошибка при импорте модов"
},
"msgs": {
"success": "Моды успешно импортированы.",
"some-success": "Некоторые моды были успешно импортированы.",
"no-dlls": "Файл(ы) не содержат файлов \"dll\"."
}
}
},
"maps": {
Expand Down
16 changes: 16 additions & 0 deletions assets/jsons/translations/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"latest": "最新",
"description": "描述",
"dropdown": {
"import-mods": "導入模組",
"uninstall-all": "全部移除",
"unselect-all": "取消全選"
}
Expand All @@ -116,6 +117,10 @@
"title": "模組已安裝",
"description": "所有選中的模組已經安裝"
}
},
"drop-zone": {
"text": "匯入你的模組",
"subtext": "將你的 \"zip\"\"dll\" 檔案拖放到這裡以進行匯入"
}
},
"dropdown": {
Expand Down Expand Up @@ -526,6 +531,17 @@
"no-mods": "該版本中沒有安裝 Mod 😑"
}
}
},
"import-mod": {
"titles": {
"success": "模組匯入完成",
"error": "模組匯入過程中發生錯誤"
},
"msgs": {
"success": "模組成功匯入。",
"some-success": "一些模組已成功匯入。",
"no-dlls": "檔案中不包含任何 \"dll\" 檔案。"
}
}
},
"maps": {
Expand Down
16 changes: 16 additions & 0 deletions assets/jsons/translations/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"latest": "最新",
"description": "描述",
"dropdown": {
"import-mods": "导入模组",
"uninstall-all": "全部卸载",
"unselect-all": "取消全选"
}
Expand All @@ -116,6 +117,10 @@
"title": "模组已安装",
"description": "所有选中的模组已经安装"
}
},
"drop-zone": {
"text": "导入你的模组",
"subtext": "将你的 \"zip\"\"dll\" 文件拖放到这里进行导入"
}
},
"dropdown": {
Expand Down Expand Up @@ -526,6 +531,17 @@
"no-mods": "该版本中没有安装 Mod 😑"
}
}
},
"import-mod": {
"titles": {
"success": "模组导入完成",
"error": "模组导入过程中发生错误"
},
"msgs": {
"success": "模组成功导入。",
"some-success": "一些模组已成功导入。",
"no-dlls": "文件中不包含任何 \"dll\" 文件。"
}
}
},
"maps": {
Expand Down
15 changes: 10 additions & 5 deletions src/main/ipcs/bs-mods-ipcs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,32 @@ import { from } from "rxjs";

const ipc = IpcService.getInstance();

ipc.on("get-available-mods", (args, reply) => {
ipc.on("bs-mods.get-available-mods", (args, reply) => {
const modsManager = BsModsManagerService.getInstance();
reply(from(modsManager.getAvailableMods(args)));
});

ipc.on("get-installed-mods", (args, reply) => {
ipc.on("bs-mods.get-installed-mods", (args, reply) => {
const modsManager = BsModsManagerService.getInstance();
reply(from(modsManager.getInstalledMods(args)));
});

ipc.on("install-mods", (args, reply) => {
ipc.on("bs-mods.import-mods", (args, reply) => {
const modsManager = BsModsManagerService.getInstance();
reply(modsManager.importMods(args.paths, args.version));
});

ipc.on("bs-mods.install-mods", (args, reply) => {
const modsManager = BsModsManagerService.getInstance();
reply(modsManager.installMods(args.mods, args.version));
});

ipc.on("uninstall-mods", (args, reply) => {
ipc.on("bs-mods.uninstall-mods", (args, reply) => {
const modsManager = BsModsManagerService.getInstance();
reply(modsManager.uninstallMods(args.mods, args.version));
});

ipc.on("uninstall-all-mods", (args, reply) => {
ipc.on("bs-mods.uninstall-all-mods", (args, reply) => {
const modsManager = BsModsManagerService.getInstance();
reply(modsManager.uninstallAllMods(args));
});
Loading

0 comments on commit cfae1d9

Please sign in to comment.