Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d58e76d821 | |||
| a4de02bc18 | |||
| a021658fa9 | |||
| 6b222bfa70 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,6 +3,7 @@ bin
|
|||||||
tests/
|
tests/
|
||||||
server/
|
server/
|
||||||
proxy/
|
proxy/
|
||||||
|
proto/
|
||||||
temp/
|
temp/
|
||||||
frontend/dist
|
frontend/dist
|
||||||
frontend/node_modules
|
frontend/node_modules
|
||||||
|
|||||||
7
Makefile
Normal file
7
Makefile
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
PROTO_SRC=./proto
|
||||||
|
GEN_DEST=./pkg
|
||||||
|
|
||||||
|
build_proto:
|
||||||
|
@echo Compiling Protobuf files...
|
||||||
|
protoc --go_out=${GEN_DEST} --go-grpc_out=${GEN_DEST} ${PROTO_SRC}/*.proto
|
||||||
|
@echo Done!
|
||||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,22 @@
|
|||||||
|
// @ts-check
|
||||||
|
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||||
|
// This file is automatically generated. DO NOT EDIT
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore: Unused imports
|
||||||
|
import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "@wailsio/runtime";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {number} timeout
|
||||||
|
* @returns {$CancellablePromise<[boolean, string]>}
|
||||||
|
*/
|
||||||
|
export function CloseAppAfterTimeout(timeout) {
|
||||||
|
return $Call.ByID(1705931481, timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {$CancellablePromise<[boolean, string]>}
|
||||||
|
*/
|
||||||
|
export function GetCurrentLauncherVersion() {
|
||||||
|
return $Call.ByID(3575133982);
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
// @ts-check
|
||||||
|
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||||
|
// This file is automatically generated. DO NOT EDIT
|
||||||
|
|
||||||
|
import * as AppService from "./appservice.js";
|
||||||
|
export {
|
||||||
|
AppService
|
||||||
|
};
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
// @ts-check
|
|
||||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
|
||||||
// This file is automatically generated. DO NOT EDIT
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-ignore: Unused imports
|
|
||||||
import {Call as $Call, Create as $Create} from "@wailsio/runtime";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {number} timeout
|
|
||||||
* @returns {Promise<[boolean, string]> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function CloseAppAfterTimeout(timeout) {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(982751559, timeout));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns {Promise<[boolean, string]> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function GetCurrentLauncherVersion() {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(2542090372));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
// @ts-check
|
||||||
|
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||||
|
// This file is automatically generated. DO NOT EDIT
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore: Unused imports
|
||||||
|
import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "@wailsio/runtime";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} patchPath
|
||||||
|
* @returns {$CancellablePromise<[boolean, string, string]>}
|
||||||
|
*/
|
||||||
|
export function CheckTypeHDiff(patchPath) {
|
||||||
|
return $Call.ByID(3717449114, patchPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} gamePath
|
||||||
|
* @returns {$CancellablePromise<[boolean, string]>}
|
||||||
|
*/
|
||||||
|
export function CutData(gamePath) {
|
||||||
|
return $Call.ByID(2019290107, gamePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} gamePath
|
||||||
|
* @param {string} patchPath
|
||||||
|
* @param {boolean} isSkipVerify
|
||||||
|
* @returns {$CancellablePromise<[boolean, string]>}
|
||||||
|
*/
|
||||||
|
export function DataExtract(gamePath, patchPath, isSkipVerify) {
|
||||||
|
return $Call.ByID(2161622254, gamePath, patchPath, isSkipVerify);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} gamePath
|
||||||
|
* @returns {$CancellablePromise<[boolean, string]>}
|
||||||
|
*/
|
||||||
|
export function DeleteFiles(gamePath) {
|
||||||
|
return $Call.ByID(1103091613, gamePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} gamePath
|
||||||
|
* @returns {$CancellablePromise<[boolean, string]>}
|
||||||
|
*/
|
||||||
|
export function HDiffPatchData(gamePath) {
|
||||||
|
return $Call.ByID(3944051994, gamePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} gamePath
|
||||||
|
* @returns {$CancellablePromise<[boolean, string]>}
|
||||||
|
*/
|
||||||
|
export function LDiffPatchData(gamePath) {
|
||||||
|
return $Call.ByID(360123238, gamePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} gamePath
|
||||||
|
* @param {string} patchPath
|
||||||
|
* @param {boolean} isNeedHDiff
|
||||||
|
* @returns {$CancellablePromise<[boolean, string]>}
|
||||||
|
*/
|
||||||
|
export function VersionValidate(gamePath, patchPath, isNeedHDiff) {
|
||||||
|
return $Call.ByID(2105077257, gamePath, patchPath, isNeedHDiff);
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
// @ts-check
|
||||||
|
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||||
|
// This file is automatically generated. DO NOT EDIT
|
||||||
|
|
||||||
|
import * as DiffService from "./diffservice.js";
|
||||||
|
export {
|
||||||
|
DiffService
|
||||||
|
};
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
// @ts-check
|
||||||
|
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||||
|
// This file is automatically generated. DO NOT EDIT
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore: Unused imports
|
||||||
|
import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "@wailsio/runtime";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} path
|
||||||
|
* @returns {$CancellablePromise<boolean>}
|
||||||
|
*/
|
||||||
|
export function DirExists(path) {
|
||||||
|
return $Call.ByID(1772289644, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} path
|
||||||
|
* @returns {$CancellablePromise<boolean>}
|
||||||
|
*/
|
||||||
|
export function FileExists(path) {
|
||||||
|
return $Call.ByID(1782610747, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} archivePath
|
||||||
|
* @param {string} fileInside
|
||||||
|
* @returns {$CancellablePromise<[boolean, string]>}
|
||||||
|
*/
|
||||||
|
export function FileExistsInZip(archivePath, fileInside) {
|
||||||
|
return $Call.ByID(2509699047, archivePath, fileInside);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} path
|
||||||
|
* @returns {$CancellablePromise<[boolean, string]>}
|
||||||
|
*/
|
||||||
|
export function OpenFolder(path) {
|
||||||
|
return $Call.ByID(1635714001, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} filter
|
||||||
|
* @returns {$CancellablePromise<string>}
|
||||||
|
*/
|
||||||
|
export function PickFile(filter) {
|
||||||
|
return $Call.ByID(3756474934, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {$CancellablePromise<string>}
|
||||||
|
*/
|
||||||
|
export function PickFolder() {
|
||||||
|
return $Call.ByID(3654471460);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} path
|
||||||
|
* @returns {$CancellablePromise<boolean>}
|
||||||
|
*/
|
||||||
|
export function StartApp(path) {
|
||||||
|
return $Call.ByID(1267568402, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} path
|
||||||
|
* @returns {$CancellablePromise<boolean>}
|
||||||
|
*/
|
||||||
|
export function StartWithConsole(path) {
|
||||||
|
return $Call.ByID(3249271428, path);
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
// @ts-check
|
||||||
|
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||||
|
// This file is automatically generated. DO NOT EDIT
|
||||||
|
|
||||||
|
import * as FSService from "./fsservice.js";
|
||||||
|
export {
|
||||||
|
FSService
|
||||||
|
};
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
// @ts-check
|
|
||||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
|
||||||
// This file is automatically generated. DO NOT EDIT
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-ignore: Unused imports
|
|
||||||
import {Call as $Call, Create as $Create} from "@wailsio/runtime";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} path
|
|
||||||
* @returns {Promise<boolean> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function DirExists(path) {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(1291974398, path));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} path
|
|
||||||
* @returns {Promise<boolean> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function FileExists(path) {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(3373618865, path));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} archivePath
|
|
||||||
* @param {string} fileInside
|
|
||||||
* @returns {Promise<[boolean, string]> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function FileExistsInZip(archivePath, fileInside) {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(1737012553, archivePath, fileInside));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} path
|
|
||||||
* @returns {Promise<[boolean, string]> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function OpenFolder(path) {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(2733319263, path));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns {Promise<string> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function PickFile() {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(2181012076));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns {Promise<string> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function PickFolder() {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(3906046322));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} path
|
|
||||||
* @returns {Promise<boolean> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function StartApp(path) {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(3825990132, path));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} path
|
|
||||||
* @returns {Promise<boolean> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function StartWithConsole(path) {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(2364569062, path));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
// @ts-check
|
||||||
|
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||||
|
// This file is automatically generated. DO NOT EDIT
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore: Unused imports
|
||||||
|
import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "@wailsio/runtime";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} version
|
||||||
|
* @returns {$CancellablePromise<[boolean, string]>}
|
||||||
|
*/
|
||||||
|
export function DownloadProxyProgress(version) {
|
||||||
|
return $Call.ByID(3559275334, version);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} version
|
||||||
|
* @returns {$CancellablePromise<[boolean, string]>}
|
||||||
|
*/
|
||||||
|
export function DownloadServerProgress(version) {
|
||||||
|
return $Call.ByID(1954767259, version);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {$CancellablePromise<[boolean, string, string]>}
|
||||||
|
*/
|
||||||
|
export function GetLatestLauncherVersion() {
|
||||||
|
return $Call.ByID(262637602);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {$CancellablePromise<[boolean, string, string]>}
|
||||||
|
*/
|
||||||
|
export function GetLatestProxyVersion() {
|
||||||
|
return $Call.ByID(289488362);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {$CancellablePromise<[boolean, string, string]>}
|
||||||
|
*/
|
||||||
|
export function GetLatestServerVersion() {
|
||||||
|
return $Call.ByID(2918980975);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {$CancellablePromise<void>}
|
||||||
|
*/
|
||||||
|
export function UnzipProxy() {
|
||||||
|
return $Call.ByID(2563246729);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {$CancellablePromise<void>}
|
||||||
|
*/
|
||||||
|
export function UnzipServer() {
|
||||||
|
return $Call.ByID(1126363284);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} version
|
||||||
|
* @returns {$CancellablePromise<[boolean, string]>}
|
||||||
|
*/
|
||||||
|
export function UpdateLauncherProgress(version) {
|
||||||
|
return $Call.ByID(97272861, version);
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
// @ts-check
|
||||||
|
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||||
|
// This file is automatically generated. DO NOT EDIT
|
||||||
|
|
||||||
|
import * as GitService from "./gitservice.js";
|
||||||
|
export {
|
||||||
|
GitService
|
||||||
|
};
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
// @ts-check
|
|
||||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
|
||||||
// This file is automatically generated. DO NOT EDIT
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-ignore: Unused imports
|
|
||||||
import {Call as $Call, Create as $Create} from "@wailsio/runtime";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} version
|
|
||||||
* @returns {Promise<[boolean, string]> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function DownloadProxyProgress(version) {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(1951249093, version));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} version
|
|
||||||
* @returns {Promise<[boolean, string]> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function DownloadServerProgress(version) {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(314135954, version));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns {Promise<[boolean, string, string]> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function GetLatestLauncherVersion() {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(3191972855));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns {Promise<[boolean, string, string]> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function GetLatestProxyVersion() {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(1462362449));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns {Promise<[boolean, string, string]> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function GetLatestServerVersion() {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(1447982978));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns {Promise<void> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function UnzipProxy() {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(4071181044));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns {Promise<void> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function UnzipServer() {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(4110296071));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} version
|
|
||||||
* @returns {Promise<[boolean, string]> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function UpdateLauncherProgress(version) {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(2648938152, version));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
// @ts-check
|
|
||||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
|
||||||
// This file is automatically generated. DO NOT EDIT
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-ignore: Unused imports
|
|
||||||
import {Call as $Call, Create as $Create} from "@wailsio/runtime";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} patchPath
|
|
||||||
* @returns {Promise<[boolean, string, string]> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function CheckTypeHDiff(patchPath) {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(1068035136, patchPath));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} gamePath
|
|
||||||
* @returns {Promise<[boolean, string]> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function CutData(gamePath) {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(3671642725, gamePath));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} gamePath
|
|
||||||
* @param {string} patchPath
|
|
||||||
* @param {boolean} isSkipVerify
|
|
||||||
* @returns {Promise<[boolean, string]> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function DataExtract(gamePath, patchPath, isSkipVerify) {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(1843136452, gamePath, patchPath, isSkipVerify));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} gamePath
|
|
||||||
* @returns {Promise<[boolean, string]> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function DeleteFiles(gamePath) {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(989019003, gamePath));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} gamePath
|
|
||||||
* @returns {Promise<[boolean, string]> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function PatchData(gamePath) {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(3608591627, gamePath));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} gamePath
|
|
||||||
* @param {string} patchPath
|
|
||||||
* @returns {Promise<[boolean, string]> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function VersionValidate(gamePath, patchPath) {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(3916254383, gamePath, patchPath));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
// @ts-check
|
|
||||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
|
||||||
// This file is automatically generated. DO NOT EDIT
|
|
||||||
|
|
||||||
import * as AppService from "./appservice.js";
|
|
||||||
import * as FSService from "./fsservice.js";
|
|
||||||
import * as GitService from "./gitservice.js";
|
|
||||||
import * as HdiffzService from "./hdiffzservice.js";
|
|
||||||
import * as LanguageService from "./languageservice.js";
|
|
||||||
export {
|
|
||||||
AppService,
|
|
||||||
FSService,
|
|
||||||
GitService,
|
|
||||||
HdiffzService,
|
|
||||||
LanguageService
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
// @ts-check
|
||||||
|
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||||
|
// This file is automatically generated. DO NOT EDIT
|
||||||
|
|
||||||
|
import * as LanguageService from "./languageservice.js";
|
||||||
|
export {
|
||||||
|
LanguageService
|
||||||
|
};
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
// @ts-check
|
||||||
|
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||||
|
// This file is automatically generated. DO NOT EDIT
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore: Unused imports
|
||||||
|
import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "@wailsio/runtime";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} path
|
||||||
|
* @returns {$CancellablePromise<[boolean, string, string, string]>}
|
||||||
|
*/
|
||||||
|
export function GetLanguage(path) {
|
||||||
|
return $Call.ByID(3574191687, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} path
|
||||||
|
* @param {string} text
|
||||||
|
* @param {string} voice
|
||||||
|
* @returns {$CancellablePromise<[boolean, string]>}
|
||||||
|
*/
|
||||||
|
export function SetLanguage(path, text, voice) {
|
||||||
|
return $Call.ByID(2768939795, path, text, voice);
|
||||||
|
}
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
// @ts-check
|
|
||||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
|
||||||
// This file is automatically generated. DO NOT EDIT
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-ignore: Unused imports
|
|
||||||
import {Call as $Call, Create as $Create} from "@wailsio/runtime";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} path
|
|
||||||
* @returns {Promise<[boolean, string, string, string]> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function GetLanguage(path) {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(3450750492, path));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} path
|
|
||||||
* @param {string} text
|
|
||||||
* @param {string} voice
|
|
||||||
* @returns {Promise<[boolean, string]> & { cancel(): void }}
|
|
||||||
*/
|
|
||||||
export function SetLanguage(path, text, voice) {
|
|
||||||
let $resultPromise = /** @type {any} */($Call.ByID(2793672496, path, text, voice));
|
|
||||||
return $resultPromise;
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
import useLauncherStore from "@/stores/launcherStore";
|
import useLauncherStore from "@/stores/launcherStore";
|
||||||
import { AppService, GitService } from "@bindings/firefly-launcher/internal";
|
import { AppService, } from "@bindings/firefly-launcher/internal/app-service";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
import { sleep } from "./sleep";
|
import { sleep } from "./sleep";
|
||||||
|
import { GitService } from "@bindings/firefly-launcher/internal/git-service";
|
||||||
|
|
||||||
export async function CheckUpdateLauncher(): Promise<{ isUpdate: boolean; isExists: boolean; version: string }> {
|
export async function CheckUpdateLauncher(): Promise<{ isUpdate: boolean; isExists: boolean; version: string }> {
|
||||||
const [currentOk, currentVersion] = await AppService.GetCurrentLauncherVersion()
|
const [currentOk, currentVersion] = await AppService.GetCurrentLauncherVersion()
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import useLauncherStore from "@/stores/launcherStore";
|
import useLauncherStore from "@/stores/launcherStore";
|
||||||
import useSettingStore from "@/stores/settingStore";
|
import useSettingStore from "@/stores/settingStore";
|
||||||
import { FSService, GitService } from "@bindings/firefly-launcher/internal";
|
import { FSService } from "@bindings/firefly-launcher/internal/fs-service";
|
||||||
|
import { GitService } from "@bindings/firefly-launcher/internal/git-service";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
|
|
||||||
export async function CheckUpdateProxy(proxyPath: string, proxyVersion: string) : Promise<{isUpdate: boolean, isExists: boolean, version: string}> {
|
export async function CheckUpdateProxy(proxyPath: string, proxyVersion: string) : Promise<{isUpdate: boolean, isExists: boolean, version: string}> {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import useLauncherStore from '@/stores/launcherStore';
|
import useLauncherStore from '@/stores/launcherStore';
|
||||||
import useSettingStore from '@/stores/settingStore';
|
import useSettingStore from '@/stores/settingStore';
|
||||||
import { FSService, GitService } from '@bindings/firefly-launcher/internal';
|
import { FSService } from '@bindings/firefly-launcher/internal/fs-service';
|
||||||
|
import { GitService } from '@bindings/firefly-launcher/internal/git-service';
|
||||||
import { toast } from 'react-toastify';
|
import { toast } from 'react-toastify';
|
||||||
|
|
||||||
export async function CheckUpdateServer(
|
export async function CheckUpdateServer(
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export function useGlobalEvents({
|
|||||||
setProgressDownload,
|
setProgressDownload,
|
||||||
setDownloadSpeed,
|
setDownloadSpeed,
|
||||||
setMessageUpdate,
|
setMessageUpdate,
|
||||||
|
setStageType,
|
||||||
|
|
||||||
}: {
|
}: {
|
||||||
setGameRunning: (v: boolean) => void;
|
setGameRunning: (v: boolean) => void;
|
||||||
@@ -20,8 +21,9 @@ export function useGlobalEvents({
|
|||||||
setProgressUpdate: (v: number) => void;
|
setProgressUpdate: (v: number) => void;
|
||||||
setMaxProgressUpdate: (v: number) => void;
|
setMaxProgressUpdate: (v: number) => void;
|
||||||
setProgressDownload: (v: number) => void;
|
setProgressDownload: (v: number) => void;
|
||||||
setDownloadSpeed: (v: number) => void;
|
setDownloadSpeed: (v: string) => void;
|
||||||
setMessageUpdate: (v: string) => void;
|
setMessageUpdate: (v: string) => void;
|
||||||
|
setStageType: (v: string) => void,
|
||||||
}) {
|
}) {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const onGameExit = () => setGameRunning(false);
|
const onGameExit = () => setGameRunning(false);
|
||||||
@@ -31,7 +33,7 @@ export function useGlobalEvents({
|
|||||||
const onDownload = (event: any) => {
|
const onDownload = (event: any) => {
|
||||||
const { percent, speed } = event.data[0];
|
const { percent, speed } = event.data[0];
|
||||||
setProgressDownload(Number(percent));
|
setProgressDownload(Number(percent));
|
||||||
setDownloadSpeed(Number(speed));
|
setDownloadSpeed(speed);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onUpdateProgress = (event: any) => {
|
const onUpdateProgress = (event: any) => {
|
||||||
@@ -45,14 +47,20 @@ export function useGlobalEvents({
|
|||||||
setMessageUpdate(message);
|
setMessageUpdate(message);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onStageUpdate = (event: any) => {
|
||||||
|
const { stage } = event.data[0];
|
||||||
|
setStageType(stage);
|
||||||
|
};
|
||||||
|
|
||||||
Events.On("download:server", onDownload);
|
Events.On("download:server", onDownload);
|
||||||
Events.On("download:proxy", onDownload);
|
Events.On("download:proxy", onDownload);
|
||||||
Events.On("game:exit", onGameExit);
|
Events.On("game:exit", onGameExit);
|
||||||
Events.On("server:exit", onServerExit);
|
Events.On("server:exit", onServerExit);
|
||||||
Events.On("proxy:exit", onProxyExit);
|
Events.On("proxy:exit", onProxyExit);
|
||||||
Events.On("hdiffz:progress", onUpdateProgress);
|
Events.On("diff:progress", onUpdateProgress);
|
||||||
Events.On("hdiffz:message", onMessageUpdate);
|
Events.On("diff:message", onMessageUpdate);
|
||||||
Events.On("hdiffz:error", (event: any) => {
|
Events.On("diff:stage", onStageUpdate);
|
||||||
|
Events.On("diff:error", (event: any) => {
|
||||||
const { message } = event.data[0];
|
const { message } = event.data[0];
|
||||||
toast.error(message);
|
toast.error(message);
|
||||||
});
|
});
|
||||||
@@ -63,8 +71,9 @@ export function useGlobalEvents({
|
|||||||
Events.Off("game:exit");
|
Events.Off("game:exit");
|
||||||
Events.Off("server:exit");
|
Events.Off("server:exit");
|
||||||
Events.Off("proxy:exit");
|
Events.Off("proxy:exit");
|
||||||
Events.Off("hdiffz:progress");
|
Events.Off("diff:progress")
|
||||||
Events.Off("hdiffz:message");
|
Events.Off("diff:message");
|
||||||
|
Events.Off("diff:stage");
|
||||||
Events.Off("version:check");
|
Events.Off("version:check");
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|||||||
@@ -2,11 +2,12 @@ import useSettingStore from "@/stores/settingStore"
|
|||||||
import { Check, Folder, File, X, Settings } from "lucide-react"
|
import { Check, Folder, File, X, Settings } from "lucide-react"
|
||||||
import { useEffect } from "react"
|
import { useEffect } from "react"
|
||||||
import { toast } from "react-toastify"
|
import { toast } from "react-toastify"
|
||||||
import { FSService, HdiffzService} from "@bindings/firefly-launcher/internal"
|
import { DiffService} from "@bindings/firefly-launcher/internal/diff-service"
|
||||||
|
import { FSService } from "@bindings/firefly-launcher/internal/fs-service"
|
||||||
import { motion } from "motion/react"
|
import { motion } from "motion/react"
|
||||||
import useHdiffzStore from "@/stores/hdiffzStore"
|
import useDiffStore from "@/stores/diffStore"
|
||||||
|
|
||||||
export default function HdiffzPage() {
|
export default function DiffPage() {
|
||||||
const { gameDir, setGameDir } = useSettingStore()
|
const { gameDir, setGameDir } = useSettingStore()
|
||||||
const {
|
const {
|
||||||
isLoading,
|
isLoading,
|
||||||
@@ -27,7 +28,7 @@ export default function HdiffzPage() {
|
|||||||
setStageType,
|
setStageType,
|
||||||
messageUpdate,
|
messageUpdate,
|
||||||
setMessageUpdate
|
setMessageUpdate
|
||||||
} = useHdiffzStore()
|
} = useDiffStore()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const getLanguage = async () => {
|
const getLanguage = async () => {
|
||||||
@@ -78,7 +79,7 @@ export default function HdiffzPage() {
|
|||||||
const handlePickDiffFile = async () => {
|
const handlePickDiffFile = async () => {
|
||||||
try {
|
try {
|
||||||
setIsLoading({game: false, diff: true})
|
setIsLoading({game: false, diff: true})
|
||||||
const basePath = await FSService.PickFile()
|
const basePath = await FSService.PickFile("")
|
||||||
if (basePath) {
|
if (basePath) {
|
||||||
if (!basePath.endsWith(".7z") && !basePath.endsWith(".zip") && !basePath.endsWith(".rar")) {
|
if (!basePath.endsWith(".7z") && !basePath.endsWith(".zip") && !basePath.endsWith(".rar")) {
|
||||||
toast.error('Not valid file type')
|
toast.error('Not valid file type')
|
||||||
@@ -86,13 +87,6 @@ export default function HdiffzPage() {
|
|||||||
setDiffDir('')
|
setDiffDir('')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const [exists, error] = await FSService.FileExistsInZip(basePath, "StarRail_Data\\StreamingAssets\\BinaryVersion.bytes")
|
|
||||||
if (!exists) {
|
|
||||||
toast.error(error)
|
|
||||||
setDiffCheckResult('error')
|
|
||||||
setDiffDir('')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
setDiffDir(basePath)
|
setDiffDir(basePath)
|
||||||
setDiffCheckResult('success')
|
setDiffCheckResult('success')
|
||||||
} else {
|
} else {
|
||||||
@@ -109,79 +103,81 @@ export default function HdiffzPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleUpdateGame = async () => {
|
const handleUpdateGame = async () => {
|
||||||
|
const handleResult = (ok: boolean, error: string) => {
|
||||||
|
if (!ok) {
|
||||||
|
toast.error(error)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setIsDiffLoading(true)
|
setIsDiffLoading(true)
|
||||||
|
|
||||||
if (!gameDir || !diffDir) {
|
if (!gameDir || !diffDir) {
|
||||||
toast.error('Please select game directory and diff file')
|
toast.error('Please select game directory and diff file')
|
||||||
setIsDiffLoading(false)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
setStageType('Check Type HDiff')
|
setStageType('Check Type HDiff')
|
||||||
setProgressUpdate(0)
|
setProgressUpdate(0)
|
||||||
setMaxProgressUpdate(1)
|
setMaxProgressUpdate(1)
|
||||||
const [isOk, validType, errorType] = await HdiffzService.CheckTypeHDiff(diffDir)
|
|
||||||
if (!isOk) {
|
const [isOk, validType, errorType] = await DiffService.CheckTypeHDiff(diffDir)
|
||||||
toast.error(errorType)
|
if (!handleResult(isOk, errorType)) return
|
||||||
setIsDiffLoading(false)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
setProgressUpdate(1)
|
setProgressUpdate(1)
|
||||||
|
|
||||||
if (validType === 'hdiffmap.json') {
|
if (['hdiffmap.json', 'hdifffiles.txt', 'hdifffiles.json'].includes(validType)) {
|
||||||
setStageType('Version Validate')
|
setStageType('Version Validate')
|
||||||
setProgressUpdate(0)
|
setProgressUpdate(0)
|
||||||
setMaxProgressUpdate(1)
|
setMaxProgressUpdate(1)
|
||||||
const [validVersion, errorVersion] = await HdiffzService.VersionValidate(gameDir, diffDir)
|
const isNeedHDiff = validType !== 'hdiffmap.json'
|
||||||
if (!validVersion) {
|
const [validVersion, errorVersion] = await DiffService.VersionValidate(gameDir, diffDir, isNeedHDiff)
|
||||||
toast.error(errorVersion)
|
if (!handleResult(validVersion, errorVersion)) return
|
||||||
setIsDiffLoading(false)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
setProgressUpdate(1)
|
setProgressUpdate(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isSkipVerify = ['manifest', 'hdifffiles.txt', 'hdifffiles.json'].includes(validType)
|
||||||
setStageType('Data Extract')
|
setStageType('Data Extract')
|
||||||
const [validData, errorData] = await HdiffzService.DataExtract(gameDir, diffDir, validType === 'hdifffiles.txt')
|
const [validData, errorData] = await DiffService.DataExtract(gameDir, diffDir, isSkipVerify)
|
||||||
if (!validData) {
|
if (!handleResult(validData, errorData)) return
|
||||||
toast.error(errorData)
|
|
||||||
setIsDiffLoading(false)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
setStageType('Cut Data')
|
setStageType('Cut Data')
|
||||||
setMessageUpdate('')
|
setMessageUpdate('')
|
||||||
const [validCut, errorCut] = await HdiffzService.CutData(gameDir)
|
const [validCut, errorCut] = await DiffService.CutData(gameDir)
|
||||||
if (!validCut) {
|
if (!handleResult(validCut, errorCut)) return
|
||||||
toast.error(errorCut)
|
|
||||||
setIsDiffLoading(false)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
|
switch (validType) {
|
||||||
|
case 'hdifffiles.txt':
|
||||||
|
case 'hdiffmap.json':
|
||||||
|
case 'hdifffiles.json': {
|
||||||
setStageType('Patch Data')
|
setStageType('Patch Data')
|
||||||
const [validPatch, errorPatch] = await HdiffzService.PatchData(gameDir)
|
const [validPatch, errorPatch] = await DiffService.HDiffPatchData(gameDir)
|
||||||
if (!validPatch) {
|
if (!handleResult(validPatch, errorPatch)) return
|
||||||
toast.error(errorPatch)
|
|
||||||
setIsDiffLoading(false)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
setStageType('Delete old files')
|
setStageType('Delete old files')
|
||||||
const [validDelete, errorDelete] = await HdiffzService.DeleteFiles(gameDir)
|
const [validDelete, errorDelete] = await DiffService.DeleteFiles(gameDir)
|
||||||
if (!validDelete) {
|
if (!handleResult(validDelete, errorDelete)) return
|
||||||
toast.error(errorDelete)
|
break
|
||||||
setIsDiffLoading(false)
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
case 'manifest': {
|
||||||
|
setStageType('Patch Data')
|
||||||
|
const [validPatch, errorPatch] = await DiffService.LDiffPatchData(gameDir)
|
||||||
|
if (!handleResult(validPatch, errorPatch)) return
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
toast.success('Update game completed')
|
toast.success('Update game completed')
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
toast.error('PickFile error:', err)
|
toast.error(`PickFile error: ${err}`)
|
||||||
setIsDiffLoading(false)
|
|
||||||
} finally {
|
} finally {
|
||||||
setIsDiffLoading(false)
|
setIsDiffLoading(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="p-2 mx-4">
|
<div className="p-2 mx-4">
|
||||||
<div className="max-w-4xl mx-auto">
|
<div className="max-w-4xl mx-auto">
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { Folder, Settings, Check, X, Globe, Mic } from 'lucide-react'
|
import { Folder, Settings, Check, X, Globe, Mic } from 'lucide-react'
|
||||||
import { FSService } from '@bindings/firefly-launcher/internal'
|
import { FSService } from '@bindings/firefly-launcher/internal/fs-service'
|
||||||
import { LanguageService } from '@bindings/firefly-launcher/internal'
|
import { LanguageService } from '@bindings/firefly-launcher/internal/language-service'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from 'react-toastify'
|
||||||
import useSettingStore from '@/stores/settingStore'
|
import useSettingStore from '@/stores/settingStore'
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { Play, Menu, FolderOpen, MessageCircleQuestionMark } from 'lucide-react';
|
import { Play, Menu, FolderOpen, MessageCircleQuestionMark } from 'lucide-react';
|
||||||
import { FSService, AppService } from '@bindings/firefly-launcher/internal';
|
import { AppService } from '@bindings/firefly-launcher/internal/app-service';
|
||||||
|
import { FSService } from '@bindings/firefly-launcher/internal/fs-service';
|
||||||
import { toast } from 'react-toastify';
|
import { toast } from 'react-toastify';
|
||||||
import path from 'path-browserify'
|
import path from 'path-browserify'
|
||||||
import useSettingStore from '@/stores/settingStore';
|
import useSettingStore from '@/stores/settingStore';
|
||||||
@@ -120,7 +121,7 @@ export default function LauncherPage() {
|
|||||||
const handlePickFile = async () => {
|
const handlePickFile = async () => {
|
||||||
try {
|
try {
|
||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
const basePath = await FSService.PickFile()
|
const basePath = await FSService.PickFile("exe")
|
||||||
if (basePath.endsWith("StarRail.exe") || basePath.endsWith("launcher.exe")) {
|
if (basePath.endsWith("StarRail.exe") || basePath.endsWith("launcher.exe")) {
|
||||||
const normalized = basePath.replace(/\\/g, '/')
|
const normalized = basePath.replace(/\\/g, '/')
|
||||||
const folderPath = path.dirname(normalized)
|
const folderPath = path.dirname(normalized)
|
||||||
@@ -404,7 +405,7 @@ export default function LauncherPage() {
|
|||||||
<div className="flex justify-center items-center text-sm text-white/80">
|
<div className="flex justify-center items-center text-sm text-white/80">
|
||||||
<span>{downloadType}</span>
|
<span>{downloadType}</span>
|
||||||
<div className="flex items-center gap-4 ml-4">
|
<div className="flex items-center gap-4 ml-4">
|
||||||
<span className="text-cyan-400 font-semibold">{downloadSpeed.toFixed(1)} MB/s</span>
|
<span className="text-cyan-400 font-semibold">{downloadSpeed}</span>
|
||||||
<span className="text-white font-bold">{progressDownload.toFixed(1)}%</span>
|
<span className="text-white font-bold">{progressDownload.toFixed(1)}%</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -413,7 +414,7 @@ export default function LauncherPage() {
|
|||||||
className="h-full bg-gradient-to-r from-cyan-400 to-blue-500 rounded-full"
|
className="h-full bg-gradient-to-r from-cyan-400 to-blue-500 rounded-full"
|
||||||
initial={{ width: 0 }}
|
initial={{ width: 0 }}
|
||||||
animate={{ width: `${progressDownload}%` }}
|
animate={{ width: `${progressDownload}%` }}
|
||||||
transition={{ duration: 0.3 }}
|
transition={{ type: "tween", ease: "linear", duration: 0.03 }}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="text-center text-xs text-white/60">
|
<div className="text-center text-xs text-white/60">
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { Route as rootRouteImport } from './routes/__root'
|
|||||||
import { Route as SrtoolsRouteImport } from './routes/srtools'
|
import { Route as SrtoolsRouteImport } from './routes/srtools'
|
||||||
import { Route as LanguageRouteImport } from './routes/language'
|
import { Route as LanguageRouteImport } from './routes/language'
|
||||||
import { Route as HowtoRouteImport } from './routes/howto'
|
import { Route as HowtoRouteImport } from './routes/howto'
|
||||||
import { Route as HdiffzRouteImport } from './routes/hdiffz'
|
import { Route as DiffRouteImport } from './routes/diff'
|
||||||
import { Route as AnalysisRouteImport } from './routes/analysis'
|
import { Route as AnalysisRouteImport } from './routes/analysis'
|
||||||
import { Route as AboutRouteImport } from './routes/about'
|
import { Route as AboutRouteImport } from './routes/about'
|
||||||
import { Route as IndexRouteImport } from './routes/index'
|
import { Route as IndexRouteImport } from './routes/index'
|
||||||
@@ -32,9 +32,9 @@ const HowtoRoute = HowtoRouteImport.update({
|
|||||||
path: '/howto',
|
path: '/howto',
|
||||||
getParentRoute: () => rootRouteImport,
|
getParentRoute: () => rootRouteImport,
|
||||||
} as any)
|
} as any)
|
||||||
const HdiffzRoute = HdiffzRouteImport.update({
|
const DiffRoute = DiffRouteImport.update({
|
||||||
id: '/hdiffz',
|
id: '/diff',
|
||||||
path: '/hdiffz',
|
path: '/diff',
|
||||||
getParentRoute: () => rootRouteImport,
|
getParentRoute: () => rootRouteImport,
|
||||||
} as any)
|
} as any)
|
||||||
const AnalysisRoute = AnalysisRouteImport.update({
|
const AnalysisRoute = AnalysisRouteImport.update({
|
||||||
@@ -57,7 +57,7 @@ export interface FileRoutesByFullPath {
|
|||||||
'/': typeof IndexRoute
|
'/': typeof IndexRoute
|
||||||
'/about': typeof AboutRoute
|
'/about': typeof AboutRoute
|
||||||
'/analysis': typeof AnalysisRoute
|
'/analysis': typeof AnalysisRoute
|
||||||
'/hdiffz': typeof HdiffzRoute
|
'/diff': typeof DiffRoute
|
||||||
'/howto': typeof HowtoRoute
|
'/howto': typeof HowtoRoute
|
||||||
'/language': typeof LanguageRoute
|
'/language': typeof LanguageRoute
|
||||||
'/srtools': typeof SrtoolsRoute
|
'/srtools': typeof SrtoolsRoute
|
||||||
@@ -66,7 +66,7 @@ export interface FileRoutesByTo {
|
|||||||
'/': typeof IndexRoute
|
'/': typeof IndexRoute
|
||||||
'/about': typeof AboutRoute
|
'/about': typeof AboutRoute
|
||||||
'/analysis': typeof AnalysisRoute
|
'/analysis': typeof AnalysisRoute
|
||||||
'/hdiffz': typeof HdiffzRoute
|
'/diff': typeof DiffRoute
|
||||||
'/howto': typeof HowtoRoute
|
'/howto': typeof HowtoRoute
|
||||||
'/language': typeof LanguageRoute
|
'/language': typeof LanguageRoute
|
||||||
'/srtools': typeof SrtoolsRoute
|
'/srtools': typeof SrtoolsRoute
|
||||||
@@ -76,7 +76,7 @@ export interface FileRoutesById {
|
|||||||
'/': typeof IndexRoute
|
'/': typeof IndexRoute
|
||||||
'/about': typeof AboutRoute
|
'/about': typeof AboutRoute
|
||||||
'/analysis': typeof AnalysisRoute
|
'/analysis': typeof AnalysisRoute
|
||||||
'/hdiffz': typeof HdiffzRoute
|
'/diff': typeof DiffRoute
|
||||||
'/howto': typeof HowtoRoute
|
'/howto': typeof HowtoRoute
|
||||||
'/language': typeof LanguageRoute
|
'/language': typeof LanguageRoute
|
||||||
'/srtools': typeof SrtoolsRoute
|
'/srtools': typeof SrtoolsRoute
|
||||||
@@ -87,7 +87,7 @@ export interface FileRouteTypes {
|
|||||||
| '/'
|
| '/'
|
||||||
| '/about'
|
| '/about'
|
||||||
| '/analysis'
|
| '/analysis'
|
||||||
| '/hdiffz'
|
| '/diff'
|
||||||
| '/howto'
|
| '/howto'
|
||||||
| '/language'
|
| '/language'
|
||||||
| '/srtools'
|
| '/srtools'
|
||||||
@@ -96,7 +96,7 @@ export interface FileRouteTypes {
|
|||||||
| '/'
|
| '/'
|
||||||
| '/about'
|
| '/about'
|
||||||
| '/analysis'
|
| '/analysis'
|
||||||
| '/hdiffz'
|
| '/diff'
|
||||||
| '/howto'
|
| '/howto'
|
||||||
| '/language'
|
| '/language'
|
||||||
| '/srtools'
|
| '/srtools'
|
||||||
@@ -105,7 +105,7 @@ export interface FileRouteTypes {
|
|||||||
| '/'
|
| '/'
|
||||||
| '/about'
|
| '/about'
|
||||||
| '/analysis'
|
| '/analysis'
|
||||||
| '/hdiffz'
|
| '/diff'
|
||||||
| '/howto'
|
| '/howto'
|
||||||
| '/language'
|
| '/language'
|
||||||
| '/srtools'
|
| '/srtools'
|
||||||
@@ -115,7 +115,7 @@ export interface RootRouteChildren {
|
|||||||
IndexRoute: typeof IndexRoute
|
IndexRoute: typeof IndexRoute
|
||||||
AboutRoute: typeof AboutRoute
|
AboutRoute: typeof AboutRoute
|
||||||
AnalysisRoute: typeof AnalysisRoute
|
AnalysisRoute: typeof AnalysisRoute
|
||||||
HdiffzRoute: typeof HdiffzRoute
|
DiffRoute: typeof DiffRoute
|
||||||
HowtoRoute: typeof HowtoRoute
|
HowtoRoute: typeof HowtoRoute
|
||||||
LanguageRoute: typeof LanguageRoute
|
LanguageRoute: typeof LanguageRoute
|
||||||
SrtoolsRoute: typeof SrtoolsRoute
|
SrtoolsRoute: typeof SrtoolsRoute
|
||||||
@@ -144,11 +144,11 @@ declare module '@tanstack/react-router' {
|
|||||||
preLoaderRoute: typeof HowtoRouteImport
|
preLoaderRoute: typeof HowtoRouteImport
|
||||||
parentRoute: typeof rootRouteImport
|
parentRoute: typeof rootRouteImport
|
||||||
}
|
}
|
||||||
'/hdiffz': {
|
'/diff': {
|
||||||
id: '/hdiffz'
|
id: '/diff'
|
||||||
path: '/hdiffz'
|
path: '/diff'
|
||||||
fullPath: '/hdiffz'
|
fullPath: '/diff'
|
||||||
preLoaderRoute: typeof HdiffzRouteImport
|
preLoaderRoute: typeof DiffRouteImport
|
||||||
parentRoute: typeof rootRouteImport
|
parentRoute: typeof rootRouteImport
|
||||||
}
|
}
|
||||||
'/analysis': {
|
'/analysis': {
|
||||||
@@ -179,7 +179,7 @@ const rootRouteChildren: RootRouteChildren = {
|
|||||||
IndexRoute: IndexRoute,
|
IndexRoute: IndexRoute,
|
||||||
AboutRoute: AboutRoute,
|
AboutRoute: AboutRoute,
|
||||||
AnalysisRoute: AnalysisRoute,
|
AnalysisRoute: AnalysisRoute,
|
||||||
HdiffzRoute: HdiffzRoute,
|
DiffRoute: DiffRoute,
|
||||||
HowtoRoute: HowtoRoute,
|
HowtoRoute: HowtoRoute,
|
||||||
LanguageRoute: LanguageRoute,
|
LanguageRoute: LanguageRoute,
|
||||||
SrtoolsRoute: SrtoolsRoute,
|
SrtoolsRoute: SrtoolsRoute,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import ThemeController from '../components/themeController'
|
|||||||
import { ToastContainer } from 'react-toastify'
|
import { ToastContainer } from 'react-toastify'
|
||||||
import { useGlobalEvents } from '@/hooks';
|
import { useGlobalEvents } from '@/hooks';
|
||||||
import useLauncherStore from '@/stores/launcherStore';
|
import useLauncherStore from '@/stores/launcherStore';
|
||||||
import useHdiffzStore from '@/stores/hdiffzStore';
|
import useDiffStore from '@/stores/diffStore';
|
||||||
|
|
||||||
export const Route = createRootRoute({
|
export const Route = createRootRoute({
|
||||||
component: RootLayout
|
component: RootLayout
|
||||||
@@ -11,7 +11,7 @@ export const Route = createRootRoute({
|
|||||||
|
|
||||||
function RootLayout() {
|
function RootLayout() {
|
||||||
const { setGameRunning, setServerRunning, setProxyRunning, setProgressDownload, setDownloadSpeed } = useLauncherStore()
|
const { setGameRunning, setServerRunning, setProxyRunning, setProgressDownload, setDownloadSpeed } = useLauncherStore()
|
||||||
const { setProgressUpdate, setMaxProgressUpdate, setMessageUpdate } = useHdiffzStore()
|
const { setProgressUpdate, setMaxProgressUpdate, setMessageUpdate, setStageType } = useDiffStore()
|
||||||
useGlobalEvents({
|
useGlobalEvents({
|
||||||
setGameRunning,
|
setGameRunning,
|
||||||
setServerRunning,
|
setServerRunning,
|
||||||
@@ -21,6 +21,7 @@ function RootLayout() {
|
|||||||
setProgressDownload,
|
setProgressDownload,
|
||||||
setDownloadSpeed,
|
setDownloadSpeed,
|
||||||
setMessageUpdate,
|
setMessageUpdate,
|
||||||
|
setStageType
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -40,7 +41,7 @@ function RootLayout() {
|
|||||||
<a>Tools</a>
|
<a>Tools</a>
|
||||||
<ul className="p-2">
|
<ul className="p-2">
|
||||||
<li><Link to="/language">Language</Link></li>
|
<li><Link to="/language">Language</Link></li>
|
||||||
<li><Link to="/hdiffz">Hdiffz</Link></li>
|
<li><Link to="/diff">Diff</Link></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@@ -77,7 +78,7 @@ function RootLayout() {
|
|||||||
<summary>Tools</summary>
|
<summary>Tools</summary>
|
||||||
<ul className="p-2">
|
<ul className="p-2">
|
||||||
<li><Link to="/language">Language</Link></li>
|
<li><Link to="/language">Language</Link></li>
|
||||||
<li><Link to="/hdiffz">Hdiffz</Link></li>
|
<li><Link to="/diff">Diff</Link></li>
|
||||||
</ul>
|
</ul>
|
||||||
</details>
|
</details>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
7
frontend/src/routes/diff.tsx
Normal file
7
frontend/src/routes/diff.tsx
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import DiffPage from '@/pages/diff'
|
||||||
|
import { createFileRoute } from '@tanstack/react-router'
|
||||||
|
|
||||||
|
export const Route = createFileRoute('/diff')({
|
||||||
|
component: DiffPage,
|
||||||
|
})
|
||||||
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
import HdiffzPage from '@/pages/hdiffz'
|
|
||||||
import { createFileRoute } from '@tanstack/react-router'
|
|
||||||
|
|
||||||
export const Route = createFileRoute('/hdiffz')({
|
|
||||||
component: HdiffzPage,
|
|
||||||
})
|
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
import { create } from 'zustand'
|
import { create } from 'zustand'
|
||||||
|
|
||||||
interface LauncherState {
|
interface DiffState {
|
||||||
folderCheckResult: 'success' | 'error' | null,
|
folderCheckResult: 'success' | 'error' | null,
|
||||||
isLoading: {game: boolean, diff: boolean},
|
isLoading: {game: boolean, diff: boolean},
|
||||||
diffDir: string,
|
diffDir: string,
|
||||||
@@ -22,7 +22,7 @@ interface LauncherState {
|
|||||||
setStageType: (value: string) => void,
|
setStageType: (value: string) => void,
|
||||||
}
|
}
|
||||||
|
|
||||||
const useLauncherStore = create<LauncherState>((set, get) => ({
|
const useDiffStore = create<DiffState>((set, get) => ({
|
||||||
isLoading: {game: false, diff: false},
|
isLoading: {game: false, diff: false},
|
||||||
folderCheckResult: null,
|
folderCheckResult: null,
|
||||||
diffDir: "",
|
diffDir: "",
|
||||||
@@ -43,4 +43,4 @@ const useLauncherStore = create<LauncherState>((set, get) => ({
|
|||||||
setStageType: (value: string) => set({ stageType: value }),
|
setStageType: (value: string) => set({ stageType: value }),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export default useLauncherStore;
|
export default useDiffStore;
|
||||||
@@ -11,7 +11,7 @@ interface LauncherState {
|
|||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
gameRunning: boolean;
|
gameRunning: boolean;
|
||||||
progressDownload: number;
|
progressDownload: number;
|
||||||
downloadSpeed: number;
|
downloadSpeed: string;
|
||||||
launcherVersion: string;
|
launcherVersion: string;
|
||||||
updateData: Record<'server' | 'proxy' | 'launcher', { isUpdate: boolean, isExists: boolean, version: string }>;
|
updateData: Record<'server' | 'proxy' | 'launcher', { isUpdate: boolean, isExists: boolean, version: string }>;
|
||||||
setDownloadType: (value: string) => void;
|
setDownloadType: (value: string) => void;
|
||||||
@@ -24,7 +24,7 @@ interface LauncherState {
|
|||||||
setGameRunning: (value: boolean) => void;
|
setGameRunning: (value: boolean) => void;
|
||||||
setProgressDownload: (value: number) => void;
|
setProgressDownload: (value: number) => void;
|
||||||
setLauncherVersion: (value: string) => void;
|
setLauncherVersion: (value: string) => void;
|
||||||
setDownloadSpeed: (value: number) => void;
|
setDownloadSpeed: (value: string) => void;
|
||||||
setUpdateData: (value: Record<'server' | 'proxy' | 'launcher', { isUpdate: boolean, isExists: boolean, version: string }>) => void;
|
setUpdateData: (value: Record<'server' | 'proxy' | 'launcher', { isUpdate: boolean, isExists: boolean, version: string }>) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ const useLauncherStore = create<LauncherState>((set, get) => ({
|
|||||||
proxyRunning: false,
|
proxyRunning: false,
|
||||||
gameRunning: false,
|
gameRunning: false,
|
||||||
progressDownload: 0,
|
progressDownload: 0,
|
||||||
downloadSpeed: 0,
|
downloadSpeed: "",
|
||||||
launcherVersion: "",
|
launcherVersion: "",
|
||||||
updateData: {
|
updateData: {
|
||||||
server: { isUpdate: false, isExists: false, version: "" },
|
server: { isUpdate: false, isExists: false, version: "" },
|
||||||
@@ -55,7 +55,7 @@ const useLauncherStore = create<LauncherState>((set, get) => ({
|
|||||||
setGameRunning: (value: boolean) => set({ gameRunning: value }),
|
setGameRunning: (value: boolean) => set({ gameRunning: value }),
|
||||||
setProgressDownload: (value: number) => set({ progressDownload: value }),
|
setProgressDownload: (value: number) => set({ progressDownload: value }),
|
||||||
setLauncherVersion: (value: string) => set({ launcherVersion: value }),
|
setLauncherVersion: (value: string) => set({ launcherVersion: value }),
|
||||||
setDownloadSpeed: (value: number) => set({ downloadSpeed: value }),
|
setDownloadSpeed: (value: string) => set({ downloadSpeed: value }),
|
||||||
setUpdateData: (value: Record<'server' | 'proxy' | 'launcher', { isUpdate: boolean, isExists: boolean, version: string }>) => set({ updateData: value }),
|
setUpdateData: (value: Record<'server' | 'proxy' | 'launcher', { isUpdate: boolean, isExists: boolean, version: string }>) => set({ updateData: value }),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|||||||
6
go.mod
6
go.mod
@@ -10,6 +10,7 @@ require (
|
|||||||
require (
|
require (
|
||||||
aead.dev/minisign v0.3.0 // indirect
|
aead.dev/minisign v0.3.0 // indirect
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
|
golang.org/x/crypto v0.41.0 // indirect
|
||||||
golang.org/x/text v0.28.0 // indirect
|
golang.org/x/text v0.28.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -33,6 +34,7 @@ require (
|
|||||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
||||||
github.com/jchv/go-winloader v0.0.0-20250406163304-c1995be93bd1 // indirect
|
github.com/jchv/go-winloader v0.0.0-20250406163304-c1995be93bd1 // indirect
|
||||||
github.com/kevinburke/ssh_config v1.4.0 // indirect
|
github.com/kevinburke/ssh_config v1.4.0 // indirect
|
||||||
|
github.com/klauspost/compress v1.18.0
|
||||||
github.com/leaanthony/go-ansi-parser v1.6.1 // indirect
|
github.com/leaanthony/go-ansi-parser v1.6.1 // indirect
|
||||||
github.com/leaanthony/u v1.1.1 // indirect
|
github.com/leaanthony/u v1.1.1 // indirect
|
||||||
github.com/lmittmann/tint v1.1.2 // indirect
|
github.com/lmittmann/tint v1.1.2 // indirect
|
||||||
@@ -48,9 +50,9 @@ require (
|
|||||||
github.com/wailsapp/go-webview2 v1.0.21 // indirect
|
github.com/wailsapp/go-webview2 v1.0.21 // indirect
|
||||||
github.com/wailsapp/mimetype v1.4.1 // indirect
|
github.com/wailsapp/mimetype v1.4.1 // indirect
|
||||||
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
||||||
golang.org/x/crypto v0.41.0 // indirect
|
golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b
|
||||||
golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b // indirect
|
|
||||||
golang.org/x/net v0.43.0 // indirect
|
golang.org/x/net v0.43.0 // indirect
|
||||||
|
google.golang.org/protobuf v1.36.8
|
||||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
4
go.sum
4
go.sum
@@ -55,6 +55,8 @@ github.com/jchv/go-winloader v0.0.0-20250406163304-c1995be93bd1 h1:njuLRcjAuMKr7
|
|||||||
github.com/jchv/go-winloader v0.0.0-20250406163304-c1995be93bd1/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
|
github.com/jchv/go-winloader v0.0.0-20250406163304-c1995be93bd1/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
|
||||||
github.com/kevinburke/ssh_config v1.4.0 h1:6xxtP5bZ2E4NF5tuQulISpTO2z8XbtH8cg1PWkxoFkQ=
|
github.com/kevinburke/ssh_config v1.4.0 h1:6xxtP5bZ2E4NF5tuQulISpTO2z8XbtH8cg1PWkxoFkQ=
|
||||||
github.com/kevinburke/ssh_config v1.4.0/go.mod h1:q2RIzfka+BXARoNexmF9gkxEX7DmvbW9P4hIVx2Kg4M=
|
github.com/kevinburke/ssh_config v1.4.0/go.mod h1:q2RIzfka+BXARoNexmF9gkxEX7DmvbW9P4hIVx2Kg4M=
|
||||||
|
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
|
||||||
|
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||||
@@ -147,6 +149,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
|||||||
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
|
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
|
||||||
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
|
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc=
|
||||||
|
google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package internal
|
package appService
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"firefly-launcher/pkg/constant"
|
"firefly-launcher/pkg/constant"
|
||||||
261
internal/diff-service/hdiffz.go
Normal file
261
internal/diff-service/hdiffz.go
Normal file
@@ -0,0 +1,261 @@
|
|||||||
|
package diffService
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"encoding/json"
|
||||||
|
"firefly-launcher/pkg/constant"
|
||||||
|
"firefly-launcher/pkg/hpatchz"
|
||||||
|
"firefly-launcher/pkg/models"
|
||||||
|
"firefly-launcher/pkg/sevenzip"
|
||||||
|
"firefly-launcher/pkg/verifier"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DiffService struct{}
|
||||||
|
|
||||||
|
func (h *DiffService) CheckTypeHDiff(patchPath string) (bool, string, string) {
|
||||||
|
if ok, err := sevenzip.IsFileIn7z(patchPath, "hdifffiles.txt"); err == nil && ok {
|
||||||
|
return true, "hdifffiles.txt", ""
|
||||||
|
}
|
||||||
|
if ok, err := sevenzip.IsFileIn7z(patchPath, "hdifffiles.txt"); err == nil && ok {
|
||||||
|
return true, "hdifffiles.json", ""
|
||||||
|
}
|
||||||
|
if ok, err := sevenzip.IsFileIn7z(patchPath, "hdiffmap.json"); err == nil && ok {
|
||||||
|
return true, "hdiffmap.json", ""
|
||||||
|
}
|
||||||
|
if ok, err := sevenzip.IsFileIn7z(patchPath, "manifest"); err == nil && ok {
|
||||||
|
return true, "manifest", ""
|
||||||
|
}
|
||||||
|
|
||||||
|
return false, "", "not found hdifffiles.txt or hdiffmap.json"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *DiffService) VersionValidate(gamePath, patchPath string, isNeedHDiff bool) (bool, string) {
|
||||||
|
oldBinPath := filepath.Join(gamePath, "StarRail_Data\\StreamingAssets\\BinaryVersion.bytes")
|
||||||
|
oldVersionData, err := models.ParseBinaryVersion(oldBinPath)
|
||||||
|
if err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := os.Stat(patchPath); err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := os.Stat(constant.TempUrl); os.IsNotExist(err) {
|
||||||
|
if err := os.MkdirAll(constant.TempUrl, os.ModePerm); err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !isNeedHDiff {
|
||||||
|
if err := sevenzip.ExtractAFileFromZip(patchPath, "StarRail_Data\\StreamingAssets\\BinaryVersion.bytes", constant.TempUrl); err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
binPath := filepath.Join(constant.TempUrl, "BinaryVersion.bytes")
|
||||||
|
newVersionData, err := models.ParseBinaryVersion(binPath)
|
||||||
|
if err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
defer os.Remove(binPath)
|
||||||
|
|
||||||
|
v := newVersionData.Subtract(oldVersionData)
|
||||||
|
if v != 0 && v != 1 {
|
||||||
|
return false, fmt.Sprintf("the diff version %s not valid with game version %s", newVersionData, oldVersionData)
|
||||||
|
}
|
||||||
|
|
||||||
|
return true, "validated"
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := sevenzip.ExtractAFileFromZip(patchPath, "StarRail_Data\\StreamingAssets\\BinaryVersion.bytes.hdiff", constant.TempUrl); err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
patchBinFile := filepath.Join(constant.TempUrl, "BinaryVersion.bytes.hdiff")
|
||||||
|
sourceBinFile := filepath.Join(gamePath, "StarRail_Data\\StreamingAssets\\BinaryVersion.bytes")
|
||||||
|
tempBinFile := filepath.Join(constant.TempUrl, "BinaryVersion.bytes")
|
||||||
|
if err := hpatchz.ApplyPatch(sourceBinFile, patchBinFile, tempBinFile); err != nil {
|
||||||
|
os.Remove(patchBinFile)
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
os.Remove(patchBinFile)
|
||||||
|
|
||||||
|
okFullPkg, err1 := sevenzip.IsFileIn7z(patchPath, "pkg_version")
|
||||||
|
okDiffPkg, err2 := sevenzip.IsFileIn7z(patchPath, "pkg_version.hdiff")
|
||||||
|
if err1 != nil && err2 != nil {
|
||||||
|
return false, err1.Error()
|
||||||
|
}
|
||||||
|
if okFullPkg {
|
||||||
|
if err := sevenzip.ExtractAFileFromZip(patchPath, "pkg_version", constant.TempUrl); err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if okDiffPkg {
|
||||||
|
|
||||||
|
if err := sevenzip.ExtractAFileFromZip(patchPath, "pkg_version.hdiff", constant.TempUrl); err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
patchPkgFile := filepath.Join(constant.TempUrl, "pkg_version.hdiff")
|
||||||
|
sourcePkgFile := filepath.Join(gamePath, "pkg_version")
|
||||||
|
tempPkgFile := filepath.Join(constant.TempUrl, "pkg_version")
|
||||||
|
if err := hpatchz.ApplyPatch(sourcePkgFile, patchPkgFile, tempPkgFile); err != nil {
|
||||||
|
os.Remove(patchPkgFile)
|
||||||
|
os.Remove(tempPkgFile)
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
os.Remove(patchPkgFile)
|
||||||
|
}
|
||||||
|
|
||||||
|
tempPkgFile := filepath.Join(constant.TempUrl, "pkg_version")
|
||||||
|
pkgDataList, err := models.LoadPkgVersion(tempPkgFile)
|
||||||
|
if err != nil {
|
||||||
|
os.Remove(tempPkgFile)
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
os.Remove(tempPkgFile)
|
||||||
|
|
||||||
|
for _, pkgData := range pkgDataList {
|
||||||
|
if filepath.ToSlash(pkgData.RemoteFile) == "StarRail_Data/StreamingAssets/BinaryVersion.bytes" {
|
||||||
|
md5, err := verifier.FileMD5(tempBinFile)
|
||||||
|
if err != nil {
|
||||||
|
os.Remove(tempBinFile)
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
if md5 != pkgData.MD5 {
|
||||||
|
os.Remove(tempBinFile)
|
||||||
|
return false, fmt.Sprintf("md5 mismatch for %s: expected %s, got %s",
|
||||||
|
tempBinFile, pkgData.MD5, md5)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = models.ParseBinaryVersion(tempBinFile)
|
||||||
|
if err != nil {
|
||||||
|
os.Remove(tempBinFile)
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
os.Remove(tempBinFile)
|
||||||
|
return true, "validated"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *DiffService) HDiffPatchData(gamePath string) (bool, string) {
|
||||||
|
hdiffMapPath := filepath.Join(gamePath, "hdiffmap.json")
|
||||||
|
hdiffFilesPath := filepath.Join(gamePath, "hdifffiles.txt")
|
||||||
|
hdifffilesJsonPath := filepath.Join(gamePath, "hdifffiles.json")
|
||||||
|
|
||||||
|
var jsonData struct {
|
||||||
|
DiffMap []*models.HDiffData `json:"diff_map"`
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := os.Stat(hdiffMapPath); err == nil {
|
||||||
|
data, err := os.ReadFile(hdiffMapPath)
|
||||||
|
if err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
var jsonDataDiffMap struct {
|
||||||
|
DiffMap []*models.DiffMapType `json:"diff_map"`
|
||||||
|
}
|
||||||
|
if err := json.Unmarshal(data, &jsonDataDiffMap); err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
for _, entry := range jsonDataDiffMap.DiffMap {
|
||||||
|
jsonData.DiffMap = append(jsonData.DiffMap, entry.ToHDiffData())
|
||||||
|
}
|
||||||
|
} else if _, err := os.Stat(hdifffilesJsonPath); err == nil {
|
||||||
|
data, err := os.ReadFile(hdifffilesJsonPath)
|
||||||
|
if err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
if err := json.Unmarshal(data, &jsonData); err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
} else if _, err := os.Stat(hdiffFilesPath); err == nil {
|
||||||
|
files, err := models.LoadHDiffFiles(hdiffFilesPath)
|
||||||
|
if err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
for _, entry := range files {
|
||||||
|
jsonData.DiffMap = append(jsonData.DiffMap, entry.ToHDiffData())
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false, "no hdiff entries map exist"
|
||||||
|
}
|
||||||
|
|
||||||
|
application.Get().Event.Emit("diff:stage", map[string]string{"stage": "Patching HDiff"})
|
||||||
|
for i, entry := range jsonData.DiffMap {
|
||||||
|
application.Get().Event.Emit(
|
||||||
|
"diff:progress", map[string]int{
|
||||||
|
"progress": i,
|
||||||
|
"maxProgress": len(jsonData.DiffMap),
|
||||||
|
})
|
||||||
|
|
||||||
|
sourceFile := filepath.Join(gamePath, entry.SourceFileName)
|
||||||
|
patchFile := filepath.Join(gamePath, entry.PatchFileName)
|
||||||
|
targetFile := filepath.Join(gamePath, entry.TargetFileName)
|
||||||
|
|
||||||
|
if _, err := os.Stat(patchFile); os.IsNotExist(err) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if entry.SourceFileName == "" {
|
||||||
|
hpatchz.ApplyPatchEmpty(patchFile, targetFile)
|
||||||
|
os.Remove(patchFile)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := os.Stat(sourceFile); os.IsNotExist(err) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
hpatchz.ApplyPatch(sourceFile, patchFile, targetFile)
|
||||||
|
if entry.SourceFileName != entry.TargetFileName {
|
||||||
|
os.Remove(sourceFile)
|
||||||
|
}
|
||||||
|
os.Remove(patchFile)
|
||||||
|
}
|
||||||
|
|
||||||
|
os.Remove(filepath.Join(gamePath, "hdiffmap.json"))
|
||||||
|
os.Remove(filepath.Join(gamePath, "hdifffiles.txt"))
|
||||||
|
os.Remove(filepath.Join(gamePath, "hdifffiles.json"))
|
||||||
|
return true, "patching completed"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *DiffService) DeleteFiles(gamePath string) (bool, string) {
|
||||||
|
var deleteFiles []string
|
||||||
|
|
||||||
|
file, err := os.Open(filepath.Join(gamePath, "deletefiles.txt"))
|
||||||
|
if err != nil {
|
||||||
|
return false, ""
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
|
scanner := bufio.NewScanner(file)
|
||||||
|
for scanner.Scan() {
|
||||||
|
line := strings.TrimSpace(scanner.Text())
|
||||||
|
if line != "" {
|
||||||
|
deleteFiles = append(deleteFiles, line)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := scanner.Err(); err != nil {
|
||||||
|
file.Close()
|
||||||
|
return false, "no delete files exist"
|
||||||
|
}
|
||||||
|
|
||||||
|
file.Close()
|
||||||
|
|
||||||
|
for i, file := range deleteFiles {
|
||||||
|
os.Remove(filepath.Join(gamePath, file))
|
||||||
|
application.Get().Event.Emit("diff:progress", map[string]int{"progress": i, "maxProgress": len(deleteFiles)})
|
||||||
|
}
|
||||||
|
os.Remove(filepath.Join(gamePath, "deletefiles.txt"))
|
||||||
|
return true, ""
|
||||||
|
}
|
||||||
172
internal/diff-service/ldifff.go
Normal file
172
internal/diff-service/ldifff.go
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
package diffService
|
||||||
|
|
||||||
|
import (
|
||||||
|
"firefly-launcher/pkg/firefly"
|
||||||
|
"firefly-launcher/pkg/firefly/pb"
|
||||||
|
"firefly-launcher/pkg/hpatchz"
|
||||||
|
"firefly-launcher/pkg/models"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (h *DiffService) LDiffPatchData(gamePath string) (bool, string) {
|
||||||
|
entries, err := os.ReadDir(gamePath)
|
||||||
|
if err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
ldiffPath := filepath.Join(gamePath, "ldiff")
|
||||||
|
|
||||||
|
for _, entry := range entries {
|
||||||
|
if entry.IsDir() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if !entry.Type().IsRegular() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
name := entry.Name()
|
||||||
|
if strings.HasPrefix(name, "manifest") {
|
||||||
|
manifestName := entry.Name()
|
||||||
|
manifestPath := filepath.Join(gamePath, manifestName)
|
||||||
|
|
||||||
|
manifest, err := firefly.LoadManifestProto(manifestPath)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
ldiffEntries, err := os.ReadDir(ldiffPath)
|
||||||
|
if err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
application.Get().Event.Emit("diff:stage", map[string]string{"stage": "Processing LDiff"})
|
||||||
|
for i, ldiffEntry := range ldiffEntries {
|
||||||
|
assetName := ldiffEntry.Name()
|
||||||
|
var matchingAssets []struct {
|
||||||
|
AssetName string
|
||||||
|
AssetSize int64
|
||||||
|
Asset *pb.AssetManifest
|
||||||
|
}
|
||||||
|
|
||||||
|
application.Get().Event.Emit(
|
||||||
|
"diff:progress", map[string]int{
|
||||||
|
"progress": i,
|
||||||
|
"maxProgress": len(ldiffEntries),
|
||||||
|
})
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
var mu sync.Mutex
|
||||||
|
|
||||||
|
for _, assetGroup := range manifest.Assets {
|
||||||
|
assetGroup := assetGroup
|
||||||
|
wg.Go(func() {
|
||||||
|
if data := assetGroup.AssetData; data != nil {
|
||||||
|
for _, asset := range data.Assets {
|
||||||
|
if asset.ChunkFileName == assetName {
|
||||||
|
mu.Lock()
|
||||||
|
matchingAssets = append(matchingAssets, struct {
|
||||||
|
AssetName string
|
||||||
|
AssetSize int64
|
||||||
|
Asset *pb.AssetManifest
|
||||||
|
}{assetGroup.AssetName, assetGroup.AssetSize, asset})
|
||||||
|
mu.Unlock()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
|
for _, ma := range matchingAssets {
|
||||||
|
err := firefly.LDiffFile(ma.Asset, ma.AssetName, ma.AssetSize, ldiffPath, gamePath)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
diffMapNames := make([]string, len(ldiffEntries))
|
||||||
|
for i, e := range ldiffEntries {
|
||||||
|
diffMapNames[i] = e.Name()
|
||||||
|
}
|
||||||
|
|
||||||
|
diffMapList, err := MakeDiffMap(manifest, diffMapNames)
|
||||||
|
if err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
application.Get().Event.Emit("diff:stage", map[string]string{"stage": "Patching HDiff"})
|
||||||
|
for i, entry := range diffMapList {
|
||||||
|
application.Get().Event.Emit(
|
||||||
|
"diff:progress", map[string]int{
|
||||||
|
"progress": i,
|
||||||
|
"maxProgress": len(diffMapList),
|
||||||
|
})
|
||||||
|
sourceFile := filepath.Join(gamePath, entry.SourceFileName)
|
||||||
|
patchFile := filepath.Join(gamePath, entry.PatchFileName)
|
||||||
|
targetFile := filepath.Join(gamePath, entry.TargetFileName)
|
||||||
|
|
||||||
|
if _, err := os.Stat(patchFile); os.IsNotExist(err) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if entry.SourceFileName == "" {
|
||||||
|
hpatchz.ApplyPatchEmpty(patchFile, targetFile)
|
||||||
|
os.Remove(patchFile)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := os.Stat(sourceFile); os.IsNotExist(err) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
hpatchz.ApplyPatch(sourceFile, patchFile, targetFile)
|
||||||
|
if entry.SourceFileName != entry.TargetFileName {
|
||||||
|
os.Remove(sourceFile)
|
||||||
|
}
|
||||||
|
os.Remove(patchFile)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
os.RemoveAll(ldiffPath)
|
||||||
|
return true, "patching completed"
|
||||||
|
}
|
||||||
|
|
||||||
|
func MakeDiffMap(manifest *pb.ManifestProto, chunkNames []string) ([]*models.HDiffData, error) {
|
||||||
|
var hdiffFiles []*models.HDiffData
|
||||||
|
|
||||||
|
for _, asset := range manifest.Assets {
|
||||||
|
assetName := asset.AssetName
|
||||||
|
assetSize := asset.AssetSize
|
||||||
|
|
||||||
|
if asset.AssetData != nil {
|
||||||
|
for _, chunk := range asset.AssetData.Assets {
|
||||||
|
matched := false
|
||||||
|
for _, name := range chunkNames {
|
||||||
|
if name == chunk.ChunkFileName {
|
||||||
|
matched = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !matched {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if chunk.OriginalFileSize != 0 || chunk.HdiffFileSize != assetSize {
|
||||||
|
hdiffFiles = append(hdiffFiles, &models.HDiffData{
|
||||||
|
SourceFileName: chunk.OriginalFilePath,
|
||||||
|
TargetFileName: assetName,
|
||||||
|
PatchFileName: fmt.Sprintf("%s.hdiff", assetName),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return hdiffFiles, nil
|
||||||
|
}
|
||||||
100
internal/diff-service/utils.go
Normal file
100
internal/diff-service/utils.go
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
package diffService
|
||||||
|
|
||||||
|
import (
|
||||||
|
"firefly-launcher/pkg/constant"
|
||||||
|
"firefly-launcher/pkg/verifier"
|
||||||
|
"firefly-launcher/pkg/sevenzip"
|
||||||
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"io"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (h *DiffService) DataExtract(gamePath, patchPath string, isSkipVerify bool) (bool, string) {
|
||||||
|
os.RemoveAll(constant.TempUrl)
|
||||||
|
if _, err := os.Stat(gamePath); err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := os.Stat(patchPath); err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := os.Stat(constant.TempUrl); os.IsNotExist(err) {
|
||||||
|
if err := os.MkdirAll(constant.TempUrl, os.ModePerm); err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := sevenzip.ExtractAllFilesFromZip(patchPath, constant.TempUrl); err != nil {
|
||||||
|
os.RemoveAll(constant.TempUrl)
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
if !isSkipVerify {
|
||||||
|
validator, err := verifier.NewVerifier(gamePath, constant.TempUrl)
|
||||||
|
if err != nil {
|
||||||
|
os.RemoveAll(constant.TempUrl)
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := validator.VerifyAll(); err != nil {
|
||||||
|
os.RemoveAll(constant.TempUrl)
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true, "validated"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *DiffService) CutData(gamePath string) (bool, string) {
|
||||||
|
if _, err := os.Stat(constant.TempUrl); os.IsNotExist(err) {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
err := filepath.Walk(constant.TempUrl, func(path string, info os.FileInfo, err error) error {
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
relPath, err := filepath.Rel(constant.TempUrl, path)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
destPath := filepath.Join(gamePath, relPath)
|
||||||
|
application.Get().Event.Emit("diff:message", map[string]string{"message": destPath})
|
||||||
|
if info.IsDir() {
|
||||||
|
return os.MkdirAll(destPath, os.ModePerm)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := os.MkdirAll(filepath.Dir(destPath), os.ModePerm); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := os.Rename(path, destPath); err != nil {
|
||||||
|
srcFile, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer srcFile.Close()
|
||||||
|
|
||||||
|
dstFile, err := os.Create(destPath)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer dstFile.Close()
|
||||||
|
|
||||||
|
if _, err := io.Copy(dstFile, srcFile); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
os.Remove(path)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
os.RemoveAll(constant.TempUrl)
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
os.RemoveAll(constant.TempUrl)
|
||||||
|
return true, "cut completed"
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package internal
|
package fsService
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"firefly-launcher/pkg/sevenzip"
|
"firefly-launcher/pkg/sevenzip"
|
||||||
@@ -30,7 +30,7 @@ func (f *FSService) PickFolder() (string, error) {
|
|||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *FSService) PickFile() (string, error) {
|
func (f *FSService) PickFile(filter string) (string, error) {
|
||||||
dialog := application.OpenFileDialog().
|
dialog := application.OpenFileDialog().
|
||||||
CanChooseFiles(true).
|
CanChooseFiles(true).
|
||||||
ResolvesAliases(true)
|
ResolvesAliases(true)
|
||||||
@@ -39,7 +39,9 @@ func (f *FSService) PickFile() (string, error) {
|
|||||||
} else {
|
} else {
|
||||||
dialog.SetTitle("Select a file/directory")
|
dialog.SetTitle("Select a file/directory")
|
||||||
}
|
}
|
||||||
|
if filter == "exe" {
|
||||||
dialog.AddFilter("Executable Files (*.exe)", "*.exe")
|
dialog.AddFilter("Executable Files (*.exe)", "*.exe")
|
||||||
|
}
|
||||||
if path, err := dialog.PromptForSingleSelection(); err == nil {
|
if path, err := dialog.PromptForSingleSelection(); err == nil {
|
||||||
return path, nil
|
return path, nil
|
||||||
}
|
}
|
||||||
@@ -1,282 +0,0 @@
|
|||||||
package internal
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"firefly-launcher/pkg/constant"
|
|
||||||
"firefly-launcher/pkg/models"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"net/http"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
|
|
||||||
"github.com/minio/selfupdate"
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
|
||||||
)
|
|
||||||
|
|
||||||
type GitService struct{}
|
|
||||||
|
|
||||||
func (g *GitService) GetLatestServerVersion() (bool, string, string) {
|
|
||||||
resp, err := http.Get(constant.ServerGitUrl)
|
|
||||||
if err != nil {
|
|
||||||
return false, "", err.Error()
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
body, _ := io.ReadAll(resp.Body)
|
|
||||||
|
|
||||||
var releases []models.ReleaseType
|
|
||||||
err = json.Unmarshal(body, &releases)
|
|
||||||
if err != nil {
|
|
||||||
return false, "", err.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(releases) == 0 {
|
|
||||||
return false, "", "no releases found"
|
|
||||||
}
|
|
||||||
|
|
||||||
return true, releases[0].TagName, ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *GitService) DownloadServerProgress(version string) (bool, string) {
|
|
||||||
resp, err := http.Get(constant.ServerGitUrl)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
body, _ := io.ReadAll(resp.Body)
|
|
||||||
|
|
||||||
var releases []*models.ReleaseType
|
|
||||||
err = json.Unmarshal(body, &releases)
|
|
||||||
if err != nil {
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(releases) == 0 {
|
|
||||||
return false, "no releases found"
|
|
||||||
}
|
|
||||||
|
|
||||||
var releaseData *models.ReleaseType
|
|
||||||
for _, release := range releases {
|
|
||||||
if release.TagName == version {
|
|
||||||
releaseData = release
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if releaseData == nil || releaseData.TagName == "" {
|
|
||||||
return false, "no release found"
|
|
||||||
}
|
|
||||||
|
|
||||||
var assetWin models.AssetType
|
|
||||||
for _, asset := range releaseData.Assets {
|
|
||||||
if asset.Name == constant.ServerZipFile {
|
|
||||||
assetWin = asset
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if assetWin.Name == "" {
|
|
||||||
return false, "no assets found"
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := os.Mkdir(constant.ServerStorageUrl, 0755); err != nil {
|
|
||||||
if !os.IsExist(err) {
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
saveFile := filepath.Join(constant.ServerStorageUrl, assetWin.Name)
|
|
||||||
|
|
||||||
resp, err = http.Get(assetWin.BrowserDownloadURL)
|
|
||||||
if err != nil {
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
DownloadFile(saveFile, assetWin.BrowserDownloadURL, func(percent float64, speed float64) {
|
|
||||||
application.Get().Event.Emit("download:server", map[string]interface{}{
|
|
||||||
"percent": fmt.Sprintf("%.2f", percent),
|
|
||||||
"speed": fmt.Sprintf("%.2f", speed),
|
|
||||||
})
|
|
||||||
})
|
|
||||||
return true, ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *GitService) UnzipServer() {
|
|
||||||
unzipParallel(filepath.Join(constant.ServerStorageUrl, constant.ServerZipFile), constant.ServerStorageUrl)
|
|
||||||
os.Remove(filepath.Join(constant.ServerStorageUrl, constant.ServerZipFile))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *GitService) GetLatestProxyVersion() (bool, string, string) {
|
|
||||||
resp, err := http.Get(constant.ProxyGitUrl)
|
|
||||||
if err != nil {
|
|
||||||
return false, "", err.Error()
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
body, _ := io.ReadAll(resp.Body)
|
|
||||||
|
|
||||||
var releases []models.ReleaseType
|
|
||||||
err = json.Unmarshal(body, &releases)
|
|
||||||
if err != nil {
|
|
||||||
return false, "", err.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(releases) == 0 {
|
|
||||||
return false, "", "no releases found"
|
|
||||||
}
|
|
||||||
|
|
||||||
return true, releases[0].TagName, ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *GitService) DownloadProxyProgress(version string) (bool, string) {
|
|
||||||
resp, err := http.Get(constant.ProxyGitUrl)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
body, _ := io.ReadAll(resp.Body)
|
|
||||||
|
|
||||||
var releases []*models.ReleaseType
|
|
||||||
err = json.Unmarshal(body, &releases)
|
|
||||||
if err != nil {
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(releases) == 0 {
|
|
||||||
return false, "no releases found"
|
|
||||||
}
|
|
||||||
|
|
||||||
var releaseData *models.ReleaseType
|
|
||||||
for _, release := range releases {
|
|
||||||
if release.TagName == version {
|
|
||||||
releaseData = release
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if releaseData == nil || releaseData.TagName == "" {
|
|
||||||
return false, "no release found"
|
|
||||||
}
|
|
||||||
|
|
||||||
var assetWin models.AssetType
|
|
||||||
for _, asset := range releaseData.Assets {
|
|
||||||
if asset.Name == constant.ProxyZipFile {
|
|
||||||
assetWin = asset
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if assetWin.Name == "" {
|
|
||||||
return false, "no assets found"
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := os.Mkdir(constant.ProxyStorageUrl, 0755); err != nil {
|
|
||||||
if !os.IsExist(err) {
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
saveFile := filepath.Join(constant.ProxyStorageUrl, assetWin.Name)
|
|
||||||
|
|
||||||
resp, err = http.Get(assetWin.BrowserDownloadURL)
|
|
||||||
if err != nil {
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
DownloadFile(saveFile, assetWin.BrowserDownloadURL, func(percent float64, speed float64) {
|
|
||||||
application.Get().Event.Emit("download:proxy", map[string]interface{}{
|
|
||||||
"percent": fmt.Sprintf("%.2f", percent),
|
|
||||||
"speed": fmt.Sprintf("%.2f", speed),
|
|
||||||
})
|
|
||||||
|
|
||||||
})
|
|
||||||
return true, ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *GitService) UnzipProxy() {
|
|
||||||
unzipParallel(filepath.Join(constant.ProxyStorageUrl, constant.ProxyZipFile), constant.ProxyStorageUrl)
|
|
||||||
os.Remove(filepath.Join(constant.ProxyStorageUrl, constant.ProxyZipFile))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (g *GitService) GetLatestLauncherVersion() (bool, string, string) {
|
|
||||||
resp, err := http.Get(constant.LauncherGitUrl)
|
|
||||||
if err != nil {
|
|
||||||
return false, "", err.Error()
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
body, _ := io.ReadAll(resp.Body)
|
|
||||||
|
|
||||||
var releases []models.ReleaseType
|
|
||||||
err = json.Unmarshal(body, &releases)
|
|
||||||
if err != nil {
|
|
||||||
return false, "", err.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(releases) == 0 {
|
|
||||||
return false, "", "no releases found"
|
|
||||||
}
|
|
||||||
|
|
||||||
return true, releases[0].TagName, ""
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func (g *GitService) UpdateLauncherProgress(version string) (bool, string) {
|
|
||||||
resp, err := http.Get(constant.LauncherGitUrl)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
body, _ := io.ReadAll(resp.Body)
|
|
||||||
|
|
||||||
var releases []*models.ReleaseType
|
|
||||||
err = json.Unmarshal(body, &releases)
|
|
||||||
if err != nil {
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(releases) == 0 {
|
|
||||||
return false, "no releases found"
|
|
||||||
}
|
|
||||||
|
|
||||||
var releaseData *models.ReleaseType
|
|
||||||
for _, release := range releases {
|
|
||||||
if release.TagName == version {
|
|
||||||
releaseData = release
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if releaseData == nil || releaseData.TagName == "" {
|
|
||||||
return false, "no release found"
|
|
||||||
}
|
|
||||||
|
|
||||||
var assetWin models.AssetType
|
|
||||||
for _, asset := range releaseData.Assets {
|
|
||||||
if asset.Name == constant.LauncherFile {
|
|
||||||
assetWin = asset
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if assetWin.Name == "" {
|
|
||||||
return false, "no assets found"
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err = http.Get(assetWin.BrowserDownloadURL)
|
|
||||||
if err != nil {
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
err = selfupdate.Apply(resp.Body, selfupdate.Options{})
|
|
||||||
if err != nil {
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
return true, ""
|
|
||||||
}
|
|
||||||
57
internal/git-service/launcher.go
Normal file
57
internal/git-service/launcher.go
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
package gitService
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"firefly-launcher/pkg/constant"
|
||||||
|
"firefly-launcher/pkg/models"
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
"github.com/minio/selfupdate"
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
type GitService struct{}
|
||||||
|
|
||||||
|
|
||||||
|
func (g *GitService) GetLatestLauncherVersion() (bool, string, string) {
|
||||||
|
resp, err := http.Get(constant.LauncherGitUrl)
|
||||||
|
if err != nil {
|
||||||
|
return false, "", err.Error()
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
body, _ := io.ReadAll(resp.Body)
|
||||||
|
|
||||||
|
var releases []models.ReleaseType
|
||||||
|
err = json.Unmarshal(body, &releases)
|
||||||
|
if err != nil {
|
||||||
|
return false, "", err.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(releases) == 0 {
|
||||||
|
return false, "", "no releases found"
|
||||||
|
}
|
||||||
|
|
||||||
|
return true, releases[0].TagName, ""
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func (g *GitService) UpdateLauncherProgress(version string) (bool, string) {
|
||||||
|
asset, ok := g.getReleaseAsset(version, constant.LauncherGitUrl, constant.LauncherFile)
|
||||||
|
if !ok {
|
||||||
|
return false, "no release found"
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := http.Get(asset.BrowserDownloadURL)
|
||||||
|
if err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
err = selfupdate.Apply(resp.Body, selfupdate.Options{})
|
||||||
|
if err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
return true, ""
|
||||||
|
}
|
||||||
71
internal/git-service/proxy.go
Normal file
71
internal/git-service/proxy.go
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
package gitService
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"firefly-launcher/pkg/constant"
|
||||||
|
"firefly-launcher/pkg/models"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (g *GitService) GetLatestProxyVersion() (bool, string, string) {
|
||||||
|
resp, err := http.Get(constant.ProxyGitUrl)
|
||||||
|
if err != nil {
|
||||||
|
return false, "", err.Error()
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
body, _ := io.ReadAll(resp.Body)
|
||||||
|
|
||||||
|
var releases []models.ReleaseType
|
||||||
|
err = json.Unmarshal(body, &releases)
|
||||||
|
if err != nil {
|
||||||
|
return false, "", err.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(releases) == 0 {
|
||||||
|
return false, "", "no releases found"
|
||||||
|
}
|
||||||
|
|
||||||
|
return true, releases[0].TagName, ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GitService) DownloadProxyProgress(version string) (bool, string) {
|
||||||
|
asset, ok := g.getReleaseAsset(version, constant.ProxyGitUrl, constant.ProxyZipFile)
|
||||||
|
if !ok {
|
||||||
|
return false, "no release found"
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := os.MkdirAll(constant.ProxyStorageUrl, 0755); err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
saveFile := filepath.Join(constant.ProxyStorageUrl, asset.Name)
|
||||||
|
tmpPath, err := g.downloadFileParallel(saveFile, asset.BrowserDownloadURL, 4, func(percent float64, speed string) {
|
||||||
|
application.Get().Event.Emit("download:proxy", map[string]interface{}{
|
||||||
|
"percent": fmt.Sprintf("%.2f", percent),
|
||||||
|
"speed": speed,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
for i := 0; i < 3; i++ {
|
||||||
|
if err := os.Rename(tmpPath, saveFile); err == nil {
|
||||||
|
return true, ""
|
||||||
|
}
|
||||||
|
time.Sleep(300 * time.Millisecond)
|
||||||
|
}
|
||||||
|
return false, "failed to rename tmp file after retries"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GitService) UnzipProxy() {
|
||||||
|
g.unzipParallel(filepath.Join(constant.ProxyStorageUrl, constant.ProxyZipFile), constant.ProxyStorageUrl)
|
||||||
|
os.Remove(filepath.Join(constant.ProxyStorageUrl, constant.ProxyZipFile))
|
||||||
|
}
|
||||||
71
internal/git-service/server.go
Normal file
71
internal/git-service/server.go
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
package gitService
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"firefly-launcher/pkg/constant"
|
||||||
|
"firefly-launcher/pkg/models"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/wailsapp/wails/v3/pkg/application"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (g *GitService) GetLatestServerVersion() (bool, string, string) {
|
||||||
|
resp, err := http.Get(constant.ServerGitUrl)
|
||||||
|
if err != nil {
|
||||||
|
return false, "", err.Error()
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
body, _ := io.ReadAll(resp.Body)
|
||||||
|
|
||||||
|
var releases []models.ReleaseType
|
||||||
|
err = json.Unmarshal(body, &releases)
|
||||||
|
if err != nil {
|
||||||
|
return false, "", err.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(releases) == 0 {
|
||||||
|
return false, "", "no releases found"
|
||||||
|
}
|
||||||
|
|
||||||
|
return true, releases[0].TagName, ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GitService) DownloadServerProgress(version string) (bool, string) {
|
||||||
|
asset, ok := g.getReleaseAsset(version, constant.ServerGitUrl, constant.ServerZipFile)
|
||||||
|
if !ok {
|
||||||
|
return false, "no release found"
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := os.MkdirAll(constant.ServerStorageUrl, 0755); err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
saveFile := filepath.Join(constant.ServerStorageUrl, asset.Name)
|
||||||
|
tmpPath, err := g.downloadFileParallel(saveFile, asset.BrowserDownloadURL, 4, func(percent float64, speed string) {
|
||||||
|
application.Get().Event.Emit("download:server", map[string]interface{}{
|
||||||
|
"percent": fmt.Sprintf("%.2f", percent),
|
||||||
|
"speed": speed,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return false, err.Error()
|
||||||
|
}
|
||||||
|
for i := 0; i < 3; i++ {
|
||||||
|
if err := os.Rename(tmpPath, saveFile); err == nil {
|
||||||
|
return true, ""
|
||||||
|
}
|
||||||
|
time.Sleep(300 * time.Millisecond)
|
||||||
|
}
|
||||||
|
return false, "failed to rename tmp file after retries"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GitService) UnzipServer() {
|
||||||
|
g.unzipParallel(filepath.Join(constant.ServerStorageUrl, constant.ServerZipFile), constant.ServerStorageUrl)
|
||||||
|
os.Remove(filepath.Join(constant.ServerStorageUrl, constant.ServerZipFile))
|
||||||
|
}
|
||||||
234
internal/git-service/util.go
Normal file
234
internal/git-service/util.go
Normal file
@@ -0,0 +1,234 @@
|
|||||||
|
package gitService
|
||||||
|
|
||||||
|
import (
|
||||||
|
"archive/zip"
|
||||||
|
"encoding/json"
|
||||||
|
"firefly-launcher/pkg/models"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"math"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func HumanFormat(bytes float64) string {
|
||||||
|
for _, unit := range []string{"", "Ki", "Mi", "Gi"} {
|
||||||
|
if math.Abs(bytes) < 1024.0 {
|
||||||
|
return fmt.Sprintf("%3.1f%sB", bytes, unit)
|
||||||
|
}
|
||||||
|
bytes /= 1024.0
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("%.1fTiB", bytes)
|
||||||
|
}
|
||||||
|
|
||||||
|
type WriteCounter struct {
|
||||||
|
Total uint64
|
||||||
|
StartTime time.Time
|
||||||
|
OnEmit func(percent float64, speed string)
|
||||||
|
TotalSize int64
|
||||||
|
mu sync.Mutex
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewWriteCounter(total int64, onEmit func(percent float64, speed string)) *WriteCounter {
|
||||||
|
return &WriteCounter{
|
||||||
|
StartTime: time.Now(),
|
||||||
|
TotalSize: total,
|
||||||
|
OnEmit: onEmit,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (wc *WriteCounter) Add(n int) {
|
||||||
|
wc.mu.Lock()
|
||||||
|
defer wc.mu.Unlock()
|
||||||
|
wc.Total += uint64(n)
|
||||||
|
wc.PrintProgress()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (wc *WriteCounter) PrintProgress() {
|
||||||
|
elapsed := time.Since(wc.StartTime).Seconds()
|
||||||
|
if elapsed < 0.001 {
|
||||||
|
elapsed = 0.001
|
||||||
|
}
|
||||||
|
speed := float64(wc.Total) / 1024 / 1024 / elapsed
|
||||||
|
percent := float64(wc.Total) / float64(wc.TotalSize) * 100
|
||||||
|
if wc.OnEmit != nil {
|
||||||
|
wc.OnEmit(percent, fmt.Sprintf("%s/s", HumanFormat(speed)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- DownloadFileParallel ---
|
||||||
|
func (g *GitService) downloadFileParallel(filePath, url string, numParts int, onEmit func(percent float64, speed string)) (tmpPath string, err error) {
|
||||||
|
resp, err := http.Head(url)
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("failed to get head: %w", err)
|
||||||
|
}
|
||||||
|
if resp.StatusCode != http.StatusOK {
|
||||||
|
return "", fmt.Errorf("bad status: %s", resp.Status)
|
||||||
|
}
|
||||||
|
|
||||||
|
size := resp.ContentLength
|
||||||
|
tmpPath = filePath + ".tmp"
|
||||||
|
|
||||||
|
out, err := os.Create(tmpPath)
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("failed to create tmp file: %w", err)
|
||||||
|
}
|
||||||
|
defer out.Close()
|
||||||
|
|
||||||
|
counter := NewWriteCounter(size, onEmit)
|
||||||
|
partSize := size / int64(numParts)
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
var mu sync.Mutex
|
||||||
|
|
||||||
|
for i := 0; i < numParts; i++ {
|
||||||
|
start := int64(i) * partSize
|
||||||
|
end := start + partSize - 1
|
||||||
|
if i == numParts-1 {
|
||||||
|
end = size - 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_ = start
|
||||||
|
_ = end
|
||||||
|
|
||||||
|
wg.Go(func() {
|
||||||
|
req, _ := http.NewRequest("GET", url, nil)
|
||||||
|
req.Header.Set("Range", fmt.Sprintf("bytes=%d-%d", start, end))
|
||||||
|
resp, err := http.DefaultClient.Do(req)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
buf := make([]byte, 32*1024)
|
||||||
|
var written int64
|
||||||
|
for {
|
||||||
|
n, err := resp.Body.Read(buf)
|
||||||
|
if n > 0 {
|
||||||
|
mu.Lock()
|
||||||
|
out.Seek(start+written, 0)
|
||||||
|
out.Write(buf[:n])
|
||||||
|
mu.Unlock()
|
||||||
|
written += int64(n)
|
||||||
|
counter.Add(n)
|
||||||
|
}
|
||||||
|
if err == io.EOF {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
return tmpPath, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Helper getReleaseAsset ---
|
||||||
|
func (g *GitService) getReleaseAsset(version, url, fileName string) (models.AssetType, bool) {
|
||||||
|
resp, err := http.Get(url)
|
||||||
|
if err != nil {
|
||||||
|
return models.AssetType{}, false
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
body, _ := io.ReadAll(resp.Body)
|
||||||
|
var releases []*models.ReleaseType
|
||||||
|
if err := json.Unmarshal(body, &releases); err != nil || len(releases) == 0 {
|
||||||
|
return models.AssetType{}, false
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, release := range releases {
|
||||||
|
if release.TagName == version {
|
||||||
|
for _, asset := range release.Assets {
|
||||||
|
if asset.Name == fileName {
|
||||||
|
return asset, true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return models.AssetType{}, false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GitService) unzipParallel(src string, dest string) error {
|
||||||
|
numCPU := runtime.NumCPU()
|
||||||
|
|
||||||
|
reserved := 1
|
||||||
|
if numCPU > 4 {
|
||||||
|
reserved = 2
|
||||||
|
}
|
||||||
|
maxWorkers := numCPU - reserved
|
||||||
|
if maxWorkers < 1 {
|
||||||
|
maxWorkers = 1
|
||||||
|
}
|
||||||
|
r, err := zip.OpenReader(src)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer r.Close()
|
||||||
|
|
||||||
|
err = os.MkdirAll(dest, 0755)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
type job struct {
|
||||||
|
f *zip.File
|
||||||
|
}
|
||||||
|
jobs := make(chan job)
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
|
for i := 0; i < maxWorkers; i++ {
|
||||||
|
|
||||||
|
wg.Go(func() {
|
||||||
|
for j := range jobs {
|
||||||
|
err := g.extractFile(j.f, dest)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("Error extracting %s: %v\n", j.f.Name, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, f := range r.File {
|
||||||
|
jobs <- job{f}
|
||||||
|
}
|
||||||
|
close(jobs)
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GitService) extractFile(f *zip.File, dest string) error {
|
||||||
|
fp := filepath.Join(dest, f.Name)
|
||||||
|
|
||||||
|
if f.FileInfo().IsDir() {
|
||||||
|
return os.MkdirAll(fp, f.Mode())
|
||||||
|
}
|
||||||
|
|
||||||
|
err := os.MkdirAll(filepath.Dir(fp), 0755)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
rc, err := f.Open()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer rc.Close()
|
||||||
|
|
||||||
|
out, err := os.OpenFile(fp, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer out.Close()
|
||||||
|
|
||||||
|
_, err = io.Copy(out, rc)
|
||||||
|
return err
|
||||||
|
}
|
||||||
@@ -1,270 +0,0 @@
|
|||||||
package internal
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bufio"
|
|
||||||
"encoding/json"
|
|
||||||
"firefly-launcher/pkg/constant"
|
|
||||||
"firefly-launcher/pkg/models"
|
|
||||||
"firefly-launcher/pkg/sevenzip"
|
|
||||||
"firefly-launcher/pkg/verifier"
|
|
||||||
"firefly-launcher/pkg/hpatchz"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v3/pkg/application"
|
|
||||||
)
|
|
||||||
|
|
||||||
type HdiffzService struct{}
|
|
||||||
|
|
||||||
func (h *HdiffzService) CheckTypeHDiff(patchPath string) (bool, string, string) {
|
|
||||||
isFileInTxt, _ := sevenzip.IsFileIn7z(patchPath, "hdifffiles.txt")
|
|
||||||
if isFileInTxt {
|
|
||||||
return true, "hdifffiles.txt", ""
|
|
||||||
}
|
|
||||||
isFileInJson, _ := sevenzip.IsFileIn7z(patchPath, "hdiffmap.json")
|
|
||||||
if isFileInJson {
|
|
||||||
return true, "hdiffmap.json", ""
|
|
||||||
}
|
|
||||||
return false, "", "not found hdifffiles.txt or hdiffmap.json"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *HdiffzService) VersionValidate(gamePath, patchPath string) (bool, string) {
|
|
||||||
oldVersionData, err := models.ParseBinaryVersion(filepath.Join(gamePath, "StarRail_Data\\StreamingAssets\\BinaryVersion.bytes"))
|
|
||||||
if err != nil {
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err := os.Stat(patchPath); err != nil {
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err := os.Stat(constant.TempUrl); os.IsNotExist(err) {
|
|
||||||
if err := os.MkdirAll(constant.TempUrl, os.ModePerm); err != nil {
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if err := sevenzip.ExtractAFileFromZip(patchPath, "StarRail_Data\\StreamingAssets\\BinaryVersion.bytes", constant.TempUrl); err != nil {
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
binPath := filepath.Join(constant.TempUrl, "BinaryVersion.bytes")
|
|
||||||
newVersionData, err := models.ParseBinaryVersion(binPath)
|
|
||||||
if err != nil {
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
defer os.Remove(binPath)
|
|
||||||
|
|
||||||
v := newVersionData.Subtract(*oldVersionData)
|
|
||||||
if v != 0 && v != 1 {
|
|
||||||
return false, fmt.Sprintf("the diff version %s not valid with game version %s", newVersionData, oldVersionData)
|
|
||||||
}
|
|
||||||
|
|
||||||
return true, "validated"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *HdiffzService) DataExtract(gamePath, patchPath string, isSkipVerify bool) (bool, string) {
|
|
||||||
if _, err := os.Stat(gamePath); err != nil {
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err := os.Stat(patchPath); err != nil {
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err := os.Stat(constant.TempUrl); os.IsNotExist(err) {
|
|
||||||
if err := os.MkdirAll(constant.TempUrl, os.ModePerm); err != nil {
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := sevenzip.ExtractAllFilesFromZip(patchPath, constant.TempUrl); err != nil {
|
|
||||||
os.RemoveAll(constant.TempUrl)
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
if !isSkipVerify {
|
|
||||||
validator, err := verifier.NewVerifier(gamePath, constant.TempUrl)
|
|
||||||
if err != nil {
|
|
||||||
os.RemoveAll(constant.TempUrl)
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := validator.VerifyAll(); err != nil {
|
|
||||||
os.RemoveAll(constant.TempUrl)
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true, "validated"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *HdiffzService) CutData(gamePath string) (bool, string) {
|
|
||||||
if _, err := os.Stat(constant.TempUrl); os.IsNotExist(err) {
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
err := filepath.Walk(constant.TempUrl, func(path string, info os.FileInfo, err error) error {
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
relPath, err := filepath.Rel(constant.TempUrl, path)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
destPath := filepath.Join(gamePath, relPath)
|
|
||||||
application.Get().Event.Emit("hdiffz:message", map[string]string{"message": destPath})
|
|
||||||
if info.IsDir() {
|
|
||||||
return os.MkdirAll(destPath, os.ModePerm)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := os.MkdirAll(filepath.Dir(destPath), os.ModePerm); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := os.Rename(path, destPath); err != nil {
|
|
||||||
srcFile, err := os.Open(path)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer srcFile.Close()
|
|
||||||
|
|
||||||
dstFile, err := os.Create(destPath)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer dstFile.Close()
|
|
||||||
|
|
||||||
if _, err := io.Copy(dstFile, srcFile); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
_ = os.Remove(path)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
return true, "cut completed"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *HdiffzService) PatchData(gamePath string) (bool, string) {
|
|
||||||
hdiffMapPath := filepath.Join(gamePath, "hdiffmap.json")
|
|
||||||
hdiffFilesPath := filepath.Join(gamePath, "hdifffiles.txt")
|
|
||||||
|
|
||||||
var jsonData struct {
|
|
||||||
DiffMap []*models.HDiffData `json:"diff_map"`
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err := os.Stat(hdiffMapPath); err == nil {
|
|
||||||
data, err := os.ReadFile(hdiffMapPath)
|
|
||||||
if err != nil {
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
var jsonDataDiffMap struct {
|
|
||||||
DiffMap []*models.DiffMapType `json:"diff_map"`
|
|
||||||
}
|
|
||||||
if err := json.Unmarshal(data, &jsonDataDiffMap); err != nil {
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
for _, entry := range jsonDataDiffMap.DiffMap {
|
|
||||||
jsonData.DiffMap = append(jsonData.DiffMap, entry.ToHDiffData())
|
|
||||||
}
|
|
||||||
} else if _, err := os.Stat(hdiffFilesPath); err == nil {
|
|
||||||
files, err := models.LoadHDiffFiles(hdiffFilesPath)
|
|
||||||
if err != nil {
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
for _, entry := range files {
|
|
||||||
jsonData.DiffMap = append(jsonData.DiffMap, entry.ToHDiffData())
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return false, "no hdiff entries map exist"
|
|
||||||
}
|
|
||||||
|
|
||||||
for i, entry := range jsonData.DiffMap {
|
|
||||||
application.Get().Event.Emit(
|
|
||||||
"hdiffz:progress", map[string]int{
|
|
||||||
"progress": i,
|
|
||||||
"maxProgress": len(jsonData.DiffMap),
|
|
||||||
})
|
|
||||||
|
|
||||||
sourceFile := filepath.Join(gamePath, entry.SourceFileName)
|
|
||||||
patchFile := filepath.Join(gamePath, entry.PatchFileName)
|
|
||||||
targetFile := filepath.Join(gamePath, entry.TargetFileName)
|
|
||||||
|
|
||||||
// Check patch file tồn tại chưa
|
|
||||||
if _, err := os.Stat(patchFile); os.IsNotExist(err) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// Nếu không có source file hoặc SourceFileName rỗng → apply_patch_empty
|
|
||||||
if entry.SourceFileName == "" {
|
|
||||||
err := hpatchz.ApplyPatchEmpty(patchFile, targetFile)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("%s failed to patch! %v\n", entry.TargetFileName, err)
|
|
||||||
_ = os.Remove(patchFile)
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
_ = os.Remove(patchFile)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, err := os.Stat(sourceFile); os.IsNotExist(err) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// Có source file → apply_patch
|
|
||||||
err := hpatchz.ApplyPatch(sourceFile, patchFile, targetFile)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("%s failed to patch! %v\n", entry.TargetFileName, err)
|
|
||||||
_ = os.Remove(patchFile)
|
|
||||||
return false, err.Error()
|
|
||||||
}
|
|
||||||
|
|
||||||
if entry.SourceFileName != entry.TargetFileName {
|
|
||||||
_ = os.Remove(sourceFile)
|
|
||||||
}
|
|
||||||
_ = os.Remove(patchFile)
|
|
||||||
}
|
|
||||||
|
|
||||||
os.Remove(filepath.Join(gamePath, "hdiffmap.json"))
|
|
||||||
os.Remove(filepath.Join(gamePath, "hdifffiles.txt"))
|
|
||||||
return true, "patching completed"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *HdiffzService) DeleteFiles(gamePath string) (bool, string) {
|
|
||||||
var deleteFiles []string
|
|
||||||
|
|
||||||
file, err := os.Open(filepath.Join(gamePath, "deletefiles.txt"))
|
|
||||||
if err != nil {
|
|
||||||
return false, ""
|
|
||||||
}
|
|
||||||
defer file.Close()
|
|
||||||
|
|
||||||
scanner := bufio.NewScanner(file)
|
|
||||||
for scanner.Scan() {
|
|
||||||
line := strings.TrimSpace(scanner.Text())
|
|
||||||
if line != "" {
|
|
||||||
deleteFiles = append(deleteFiles, line)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := scanner.Err(); err != nil {
|
|
||||||
return false, "no delete files exist"
|
|
||||||
}
|
|
||||||
|
|
||||||
for i, file := range deleteFiles {
|
|
||||||
os.Remove(filepath.Join(gamePath, file))
|
|
||||||
application.Get().Event.Emit("hdiffz:progress", map[string]int{"progress": i, "maxProgress": len(deleteFiles)})
|
|
||||||
}
|
|
||||||
_ = os.Remove(filepath.Join(gamePath, "deletefiles.txt"))
|
|
||||||
return true, ""
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package internal
|
package languageService
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
@@ -1 +0,0 @@
|
|||||||
package internal
|
|
||||||
188
internal/util.go
188
internal/util.go
@@ -1,188 +0,0 @@
|
|||||||
package internal
|
|
||||||
|
|
||||||
import (
|
|
||||||
"archive/zip"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"math"
|
|
||||||
"net/http"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"runtime"
|
|
||||||
"sync"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
func humanFormat(bytes int64) string {
|
|
||||||
n := float64(bytes)
|
|
||||||
for _, unit := range []string{"", "Ki", "Mi", "Gi"} {
|
|
||||||
if math.Abs(n) < 1024.0 {
|
|
||||||
return fmt.Sprintf("%3.1f%sB", n, unit)
|
|
||||||
}
|
|
||||||
n /= 1024.0
|
|
||||||
}
|
|
||||||
return fmt.Sprintf("%.1fTiB", n)
|
|
||||||
}
|
|
||||||
|
|
||||||
type WriteCounter struct {
|
|
||||||
Total uint64
|
|
||||||
StartTime time.Time
|
|
||||||
OnEmit func(percent float64, speedMBps float64)
|
|
||||||
TotalSize int64
|
|
||||||
lastLoggedPercent int
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewWriteCounter(total int64, onEmit func(percent float64, speedMBps float64)) *WriteCounter {
|
|
||||||
return &WriteCounter{
|
|
||||||
StartTime: time.Now(),
|
|
||||||
TotalSize: total,
|
|
||||||
lastLoggedPercent: -1,
|
|
||||||
OnEmit: onEmit,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (wc *WriteCounter) Write(p []byte) (int, error) {
|
|
||||||
n := len(p)
|
|
||||||
wc.Total += uint64(n)
|
|
||||||
wc.PrintProgress()
|
|
||||||
return n, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (wc *WriteCounter) PrintProgress() {
|
|
||||||
elapsed := time.Since(wc.StartTime).Seconds()
|
|
||||||
if elapsed < 0.001 {
|
|
||||||
elapsed = 0.001
|
|
||||||
}
|
|
||||||
|
|
||||||
speed := float64(wc.Total) / 1024 / 1024 / elapsed // MB/s
|
|
||||||
percent := float64(wc.Total) / float64(wc.TotalSize) * 100
|
|
||||||
if wc.OnEmit != nil {
|
|
||||||
wc.OnEmit(percent, speed)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func DownloadFile(filepath string, url string, onEmit func(percent float64, speed float64)) error {
|
|
||||||
tmpPath := filepath + ".tmp"
|
|
||||||
|
|
||||||
resp, err := http.Get(url)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to get file: %w", err)
|
|
||||||
}
|
|
||||||
defer resp.Body.Close()
|
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
|
||||||
return fmt.Errorf("bad status: %s", resp.Status)
|
|
||||||
}
|
|
||||||
|
|
||||||
out, err := os.Create(tmpPath)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to create tmp file: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
counter := NewWriteCounter(resp.ContentLength, onEmit)
|
|
||||||
_, err = io.Copy(out, io.TeeReader(resp.Body, counter))
|
|
||||||
if closeErr := out.Close(); closeErr != nil {
|
|
||||||
return fmt.Errorf("failed to close tmp file: %w", closeErr)
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to download file: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete destination file if it exists
|
|
||||||
if _, err := os.Stat(filepath); err == nil {
|
|
||||||
if err := os.Remove(filepath); err != nil {
|
|
||||||
return fmt.Errorf("failed to remove existing file: %w", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for i := 0; i < 3; i++ {
|
|
||||||
err = os.Rename(tmpPath, filepath)
|
|
||||||
if err == nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
time.Sleep(300 * time.Millisecond)
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to rename after retries: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func unzipParallel(src string, dest string) error {
|
|
||||||
numCPU := runtime.NumCPU()
|
|
||||||
|
|
||||||
reserved := 1
|
|
||||||
if numCPU > 4 {
|
|
||||||
reserved = 2
|
|
||||||
}
|
|
||||||
maxWorkers := numCPU - reserved
|
|
||||||
if maxWorkers < 1 {
|
|
||||||
maxWorkers = 1
|
|
||||||
}
|
|
||||||
r, err := zip.OpenReader(src)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer r.Close()
|
|
||||||
|
|
||||||
err = os.MkdirAll(dest, 0755)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
type job struct {
|
|
||||||
f *zip.File
|
|
||||||
}
|
|
||||||
jobs := make(chan job)
|
|
||||||
var wg sync.WaitGroup
|
|
||||||
|
|
||||||
// Worker pool
|
|
||||||
for i := 0; i < maxWorkers; i++ {
|
|
||||||
wg.Go(func() {
|
|
||||||
for j := range jobs {
|
|
||||||
err := extractFile(j.f, dest)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("Error extracting %s: %v\n", j.f.Name, err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// Feed jobs
|
|
||||||
for _, f := range r.File {
|
|
||||||
jobs <- job{f}
|
|
||||||
}
|
|
||||||
close(jobs)
|
|
||||||
wg.Wait()
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func extractFile(f *zip.File, dest string) error {
|
|
||||||
fp := filepath.Join(dest, f.Name)
|
|
||||||
|
|
||||||
if f.FileInfo().IsDir() {
|
|
||||||
return os.MkdirAll(fp, f.Mode())
|
|
||||||
}
|
|
||||||
|
|
||||||
err := os.MkdirAll(filepath.Dir(fp), 0755)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
rc, err := f.Open()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer rc.Close()
|
|
||||||
|
|
||||||
out, err := os.OpenFile(fp, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer out.Close()
|
|
||||||
|
|
||||||
_, err = io.Copy(out, rc)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
18
main.go
18
main.go
@@ -3,7 +3,13 @@ package main
|
|||||||
import (
|
import (
|
||||||
"embed"
|
"embed"
|
||||||
_ "embed"
|
_ "embed"
|
||||||
"firefly-launcher/internal"
|
|
||||||
|
appService "firefly-launcher/internal/app-service"
|
||||||
|
diffService "firefly-launcher/internal/diff-service"
|
||||||
|
fsService "firefly-launcher/internal/fs-service"
|
||||||
|
gitService "firefly-launcher/internal/git-service"
|
||||||
|
languageService "firefly-launcher/internal/language-service"
|
||||||
|
|
||||||
"firefly-launcher/pkg/constant"
|
"firefly-launcher/pkg/constant"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
@@ -63,11 +69,11 @@ func main() {
|
|||||||
Name: "firefly-launcher",
|
Name: "firefly-launcher",
|
||||||
Description: "Firefly Launcher - Kain",
|
Description: "Firefly Launcher - Kain",
|
||||||
Services: []application.Service{
|
Services: []application.Service{
|
||||||
application.NewService(&internal.FSService{}),
|
application.NewService(&fsService.FSService{}),
|
||||||
application.NewService(&internal.LanguageService{}),
|
application.NewService(&languageService.LanguageService{}),
|
||||||
application.NewService(&internal.GitService{}),
|
application.NewService(&gitService.GitService{}),
|
||||||
application.NewService(&internal.HdiffzService{}),
|
application.NewService(&diffService.DiffService{}),
|
||||||
application.NewService(&internal.AppService{}),
|
application.NewService(&appService.AppService{}),
|
||||||
},
|
},
|
||||||
Assets: application.AssetOptions{
|
Assets: application.AssetOptions{
|
||||||
Handler: application.AssetFileServerFS(assets),
|
Handler: application.AssetFileServerFS(assets),
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ const ProxyZipFile = "64bit.zip"
|
|||||||
const LauncherFile = "firefly-launcher.exe"
|
const LauncherFile = "firefly-launcher.exe"
|
||||||
const TempUrl = "./temp"
|
const TempUrl = "./temp"
|
||||||
|
|
||||||
|
const CurrentLauncherVersion = "1.7.0"
|
||||||
const CurrentLauncherVersion = "1.4.1"
|
|
||||||
|
|
||||||
type ToolFile string
|
type ToolFile string
|
||||||
|
|
||||||
|
|||||||
73
pkg/firefly/chunk.go
Normal file
73
pkg/firefly/chunk.go
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
package firefly
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
|
"golang.org/x/exp/mmap"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ChunkInfo struct {
|
||||||
|
Name string
|
||||||
|
Offset int64
|
||||||
|
Size int64
|
||||||
|
}
|
||||||
|
|
||||||
|
func ProcessWithBufReader(path string, chunks []ChunkInfo) {
|
||||||
|
file, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("Error opening file %s: %v\n", path, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
|
for _, chunk := range chunks {
|
||||||
|
buffer, err := ReadChunkData(file, chunk.Offset, chunk.Size)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("Error reading chunk %s: %v\n", chunk.Name, err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
assetPath := filepath.Join("chunk_tmp", chunk.Name)
|
||||||
|
parentDir := filepath.Dir(assetPath)
|
||||||
|
if _, err := os.Stat(parentDir); os.IsNotExist(err) {
|
||||||
|
if err := os.MkdirAll(parentDir, 0o755); err != nil {
|
||||||
|
fmt.Printf("Error creating directory %s: %v\n", parentDir, err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := os.WriteFile(assetPath, buffer, 0o644); err != nil {
|
||||||
|
fmt.Printf("Error writing chunk file %s: %v\n", assetPath, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func ReadChunkData(file *os.File, offset, size int64) ([]byte, error) {
|
||||||
|
info, err := file.Stat()
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error getting file info: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if info.Size() > 1024*1024 && size > 1024*1024 {
|
||||||
|
mmapReader, err := mmap.Open(file.Name())
|
||||||
|
if err == nil {
|
||||||
|
defer mmapReader.Close()
|
||||||
|
buffer := make([]byte, size)
|
||||||
|
_, err := mmapReader.ReadAt(buffer, offset)
|
||||||
|
if err != nil && err != io.EOF {
|
||||||
|
return nil, fmt.Errorf("error reading mmap: %w", err)
|
||||||
|
}
|
||||||
|
return buffer, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer := make([]byte, size)
|
||||||
|
_, err = file.ReadAt(buffer, offset)
|
||||||
|
if err != nil && err != io.EOF {
|
||||||
|
return nil, fmt.Errorf("error reading buffered: %w", err)
|
||||||
|
}
|
||||||
|
return buffer, nil
|
||||||
|
}
|
||||||
94
pkg/firefly/ldiff.go
Normal file
94
pkg/firefly/ldiff.go
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
package firefly
|
||||||
|
|
||||||
|
import (
|
||||||
|
"firefly-launcher/pkg/firefly/pb"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
|
"golang.org/x/exp/mmap"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
func LDiffFile(data *pb.AssetManifest, assetName string, assetSize int64, ldiffsDir, outputDir string) error {
|
||||||
|
path := filepath.Join(ldiffsDir, data.ChunkFileName)
|
||||||
|
|
||||||
|
info, err := os.Stat(path)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("%s does not exist: %w", path, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
fileSize := info.Size()
|
||||||
|
var buffer []byte
|
||||||
|
|
||||||
|
if fileSize > 10*1024*1024 && data.HdiffFileSize > 1*1024*1024 {
|
||||||
|
// mmap for large files using x/exp/mmap
|
||||||
|
reader, err := mmap.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
// fallback to buffered read
|
||||||
|
file, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error opening file %s: %w", path, err)
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
buffer, err = ReadBuffer(file, data.HdiffFileInChunkOffset, data.HdiffFileSize)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
defer reader.Close()
|
||||||
|
buffer = make([]byte, data.HdiffFileSize)
|
||||||
|
_, err := reader.ReadAt(buffer, data.HdiffFileInChunkOffset)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error reading mmap data: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// small files, buffered read
|
||||||
|
file, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error opening file %s: %w", path, err)
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
|
buffer, err = ReadBuffer(file, data.HdiffFileInChunkOffset, data.HdiffFileSize)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension := ""
|
||||||
|
if data.OriginalFileSize != 0 || assetSize != data.HdiffFileSize {
|
||||||
|
extension = ".hdiff"
|
||||||
|
}
|
||||||
|
assetPath := filepath.Join(outputDir, assetName+extension)
|
||||||
|
parentDir := filepath.Dir(assetPath)
|
||||||
|
if _, err := os.Stat(parentDir); os.IsNotExist(err) {
|
||||||
|
if err := os.MkdirAll(parentDir, 0o755); err != nil {
|
||||||
|
return fmt.Errorf("error creating directory %s: %w", parentDir, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := os.WriteFile(assetPath, buffer, 0o644); err != nil {
|
||||||
|
return fmt.Errorf("error writing file %s: %w", assetPath, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func ReadBuffer(file *os.File, offset int64, size int64) ([]byte, error) {
|
||||||
|
buffer := make([]byte, size)
|
||||||
|
|
||||||
|
n, err := file.ReadAt(buffer, offset)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error reading data: %w", err)
|
||||||
|
}
|
||||||
|
if int64(n) != size {
|
||||||
|
return nil, fmt.Errorf("expected %d bytes, but read %d bytes", size, n)
|
||||||
|
}
|
||||||
|
|
||||||
|
return buffer, nil
|
||||||
|
}
|
||||||
|
|
||||||
66
pkg/firefly/loader.go
Normal file
66
pkg/firefly/loader.go
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
package firefly
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"firefly-launcher/pkg/firefly/pb"
|
||||||
|
"io"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/klauspost/compress/zstd"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
|
)
|
||||||
|
|
||||||
|
func LoadChunkProto(path string) (*pb.ChunkProto, error) {
|
||||||
|
file, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
|
reader := bufio.NewReader(file)
|
||||||
|
decoder, err := zstd.NewReader(reader)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer decoder.Close()
|
||||||
|
|
||||||
|
data, err := io.ReadAll(decoder)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var chunk pb.ChunkProto
|
||||||
|
if err := proto.Unmarshal(data, &chunk); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &chunk, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load ManifestProto từ file Zstd + Protobuf
|
||||||
|
func LoadManifestProto(path string) (*pb.ManifestProto, error) {
|
||||||
|
file, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
|
reader := bufio.NewReader(file)
|
||||||
|
decoder, err := zstd.NewReader(reader)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer decoder.Close()
|
||||||
|
|
||||||
|
data, err := io.ReadAll(decoder)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var manifest pb.ManifestProto
|
||||||
|
if err := proto.Unmarshal(data, &manifest); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &manifest, nil
|
||||||
|
}
|
||||||
651
pkg/firefly/pb/firefly.pb.go
Normal file
651
pkg/firefly/pb/firefly.pb.go
Normal file
@@ -0,0 +1,651 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.36.5
|
||||||
|
// protoc v4.25.6
|
||||||
|
// source: proto/firefly.proto
|
||||||
|
|
||||||
|
package pb
|
||||||
|
|
||||||
|
import (
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
unsafe "unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
type ChunkProto struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Assets []*AssetChunkProperty `protobuf:"bytes,1,rep,name=assets,proto3" json:"assets,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ChunkProto) Reset() {
|
||||||
|
*x = ChunkProto{}
|
||||||
|
mi := &file_proto_firefly_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ChunkProto) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*ChunkProto) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *ChunkProto) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_proto_firefly_proto_msgTypes[0]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use ChunkProto.ProtoReflect.Descriptor instead.
|
||||||
|
func (*ChunkProto) Descriptor() ([]byte, []int) {
|
||||||
|
return file_proto_firefly_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ChunkProto) GetAssets() []*AssetChunkProperty {
|
||||||
|
if x != nil {
|
||||||
|
return x.Assets
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type AssetChunkProperty struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
AssetName string `protobuf:"bytes,1,opt,name=asset_name,json=assetName,proto3" json:"asset_name,omitempty"`
|
||||||
|
AssetChunks []*AssetChunk `protobuf:"bytes,2,rep,name=asset_chunks,json=assetChunks,proto3" json:"asset_chunks,omitempty"`
|
||||||
|
AssetType int32 `protobuf:"varint,3,opt,name=asset_type,json=assetType,proto3" json:"asset_type,omitempty"`
|
||||||
|
AssetSize int64 `protobuf:"varint,4,opt,name=asset_size,json=assetSize,proto3" json:"asset_size,omitempty"`
|
||||||
|
AssetHashMd5 string `protobuf:"bytes,5,opt,name=asset_hash_md5,json=assetHashMd5,proto3" json:"asset_hash_md5,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetChunkProperty) Reset() {
|
||||||
|
*x = AssetChunkProperty{}
|
||||||
|
mi := &file_proto_firefly_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetChunkProperty) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*AssetChunkProperty) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *AssetChunkProperty) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_proto_firefly_proto_msgTypes[1]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use AssetChunkProperty.ProtoReflect.Descriptor instead.
|
||||||
|
func (*AssetChunkProperty) Descriptor() ([]byte, []int) {
|
||||||
|
return file_proto_firefly_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetChunkProperty) GetAssetName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.AssetName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetChunkProperty) GetAssetChunks() []*AssetChunk {
|
||||||
|
if x != nil {
|
||||||
|
return x.AssetChunks
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetChunkProperty) GetAssetType() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.AssetType
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetChunkProperty) GetAssetSize() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.AssetSize
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetChunkProperty) GetAssetHashMd5() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.AssetHashMd5
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type AssetChunk struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
ChunkName string `protobuf:"bytes,1,opt,name=chunk_name,json=chunkName,proto3" json:"chunk_name,omitempty"`
|
||||||
|
ChunkDecompressedHashMd5 string `protobuf:"bytes,2,opt,name=chunk_decompressed_hash_md5,json=chunkDecompressedHashMd5,proto3" json:"chunk_decompressed_hash_md5,omitempty"`
|
||||||
|
ChunkOnFileOffset int64 `protobuf:"varint,3,opt,name=chunk_on_file_offset,json=chunkOnFileOffset,proto3" json:"chunk_on_file_offset,omitempty"`
|
||||||
|
ChunkSize int64 `protobuf:"varint,4,opt,name=chunk_size,json=chunkSize,proto3" json:"chunk_size,omitempty"`
|
||||||
|
ChunkSizeDecompressed int64 `protobuf:"varint,5,opt,name=chunk_size_decompressed,json=chunkSizeDecompressed,proto3" json:"chunk_size_decompressed,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetChunk) Reset() {
|
||||||
|
*x = AssetChunk{}
|
||||||
|
mi := &file_proto_firefly_proto_msgTypes[2]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetChunk) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*AssetChunk) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *AssetChunk) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_proto_firefly_proto_msgTypes[2]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use AssetChunk.ProtoReflect.Descriptor instead.
|
||||||
|
func (*AssetChunk) Descriptor() ([]byte, []int) {
|
||||||
|
return file_proto_firefly_proto_rawDescGZIP(), []int{2}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetChunk) GetChunkName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.ChunkName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetChunk) GetChunkDecompressedHashMd5() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.ChunkDecompressedHashMd5
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetChunk) GetChunkOnFileOffset() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.ChunkOnFileOffset
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetChunk) GetChunkSize() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.ChunkSize
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetChunk) GetChunkSizeDecompressed() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.ChunkSizeDecompressed
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type ManifestProto struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Assets []*AssetManifestProperty `protobuf:"bytes,1,rep,name=assets,proto3" json:"assets,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ManifestProto) Reset() {
|
||||||
|
*x = ManifestProto{}
|
||||||
|
mi := &file_proto_firefly_proto_msgTypes[3]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ManifestProto) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*ManifestProto) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *ManifestProto) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_proto_firefly_proto_msgTypes[3]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use ManifestProto.ProtoReflect.Descriptor instead.
|
||||||
|
func (*ManifestProto) Descriptor() ([]byte, []int) {
|
||||||
|
return file_proto_firefly_proto_rawDescGZIP(), []int{3}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ManifestProto) GetAssets() []*AssetManifestProperty {
|
||||||
|
if x != nil {
|
||||||
|
return x.Assets
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type AssetManifestProperty struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
AssetName string `protobuf:"bytes,1,opt,name=asset_name,json=assetName,proto3" json:"asset_name,omitempty"`
|
||||||
|
AssetSize int64 `protobuf:"varint,2,opt,name=asset_size,json=assetSize,proto3" json:"asset_size,omitempty"`
|
||||||
|
AssetHashMd5 string `protobuf:"bytes,3,opt,name=asset_hash_md5,json=assetHashMd5,proto3" json:"asset_hash_md5,omitempty"`
|
||||||
|
AssetData *AssetManifestChunk `protobuf:"bytes,4,opt,name=asset_data,json=assetData,proto3" json:"asset_data,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetManifestProperty) Reset() {
|
||||||
|
*x = AssetManifestProperty{}
|
||||||
|
mi := &file_proto_firefly_proto_msgTypes[4]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetManifestProperty) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*AssetManifestProperty) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *AssetManifestProperty) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_proto_firefly_proto_msgTypes[4]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use AssetManifestProperty.ProtoReflect.Descriptor instead.
|
||||||
|
func (*AssetManifestProperty) Descriptor() ([]byte, []int) {
|
||||||
|
return file_proto_firefly_proto_rawDescGZIP(), []int{4}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetManifestProperty) GetAssetName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.AssetName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetManifestProperty) GetAssetSize() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.AssetSize
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetManifestProperty) GetAssetHashMd5() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.AssetHashMd5
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetManifestProperty) GetAssetData() *AssetManifestChunk {
|
||||||
|
if x != nil {
|
||||||
|
return x.AssetData
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type AssetManifestChunk struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
LatestAssetVersion string `protobuf:"bytes,1,opt,name=latest_asset_version,json=latestAssetVersion,proto3" json:"latest_asset_version,omitempty"`
|
||||||
|
Assets []*AssetManifest `protobuf:"bytes,2,rep,name=assets,proto3" json:"assets,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetManifestChunk) Reset() {
|
||||||
|
*x = AssetManifestChunk{}
|
||||||
|
mi := &file_proto_firefly_proto_msgTypes[5]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetManifestChunk) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*AssetManifestChunk) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *AssetManifestChunk) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_proto_firefly_proto_msgTypes[5]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use AssetManifestChunk.ProtoReflect.Descriptor instead.
|
||||||
|
func (*AssetManifestChunk) Descriptor() ([]byte, []int) {
|
||||||
|
return file_proto_firefly_proto_rawDescGZIP(), []int{5}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetManifestChunk) GetLatestAssetVersion() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.LatestAssetVersion
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetManifestChunk) GetAssets() []*AssetManifest {
|
||||||
|
if x != nil {
|
||||||
|
return x.Assets
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type AssetManifest struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
ChunkFileName string `protobuf:"bytes,1,opt,name=chunk_file_name,json=chunkFileName,proto3" json:"chunk_file_name,omitempty"`
|
||||||
|
ChunkFileVersion string `protobuf:"bytes,2,opt,name=chunk_file_version,json=chunkFileVersion,proto3" json:"chunk_file_version,omitempty"`
|
||||||
|
ChunkFileNode string `protobuf:"bytes,3,opt,name=chunk_file_node,json=chunkFileNode,proto3" json:"chunk_file_node,omitempty"`
|
||||||
|
ChunkFileSize int64 `protobuf:"varint,4,opt,name=chunk_file_size,json=chunkFileSize,proto3" json:"chunk_file_size,omitempty"`
|
||||||
|
ChunkFileMd5 string `protobuf:"bytes,5,opt,name=chunk_file_md5,json=chunkFileMd5,proto3" json:"chunk_file_md5,omitempty"`
|
||||||
|
HdiffFileInChunkOffset int64 `protobuf:"varint,6,opt,name=hdiff_file_in_chunk_offset,json=hdiffFileInChunkOffset,proto3" json:"hdiff_file_in_chunk_offset,omitempty"`
|
||||||
|
HdiffFileSize int64 `protobuf:"varint,7,opt,name=hdiff_file_size,json=hdiffFileSize,proto3" json:"hdiff_file_size,omitempty"`
|
||||||
|
OriginalFilePath string `protobuf:"bytes,8,opt,name=original_file_path,json=originalFilePath,proto3" json:"original_file_path,omitempty"`
|
||||||
|
OriginalFileSize int64 `protobuf:"varint,9,opt,name=original_file_size,json=originalFileSize,proto3" json:"original_file_size,omitempty"`
|
||||||
|
OriginalFileMd5 string `protobuf:"bytes,10,opt,name=original_file_md5,json=originalFileMd5,proto3" json:"original_file_md5,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetManifest) Reset() {
|
||||||
|
*x = AssetManifest{}
|
||||||
|
mi := &file_proto_firefly_proto_msgTypes[6]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetManifest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*AssetManifest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *AssetManifest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_proto_firefly_proto_msgTypes[6]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use AssetManifest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*AssetManifest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_proto_firefly_proto_rawDescGZIP(), []int{6}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetManifest) GetChunkFileName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.ChunkFileName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetManifest) GetChunkFileVersion() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.ChunkFileVersion
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetManifest) GetChunkFileNode() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.ChunkFileNode
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetManifest) GetChunkFileSize() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.ChunkFileSize
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetManifest) GetChunkFileMd5() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.ChunkFileMd5
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetManifest) GetHdiffFileInChunkOffset() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.HdiffFileInChunkOffset
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetManifest) GetHdiffFileSize() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.HdiffFileSize
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetManifest) GetOriginalFilePath() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.OriginalFilePath
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetManifest) GetOriginalFileSize() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.OriginalFileSize
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AssetManifest) GetOriginalFileMd5() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.OriginalFileMd5
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_proto_firefly_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_proto_firefly_proto_rawDesc = string([]byte{
|
||||||
|
0x0a, 0x13, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x66, 0x69, 0x72, 0x65, 0x66, 0x6c, 0x79, 0x2e,
|
||||||
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x66, 0x69, 0x72, 0x65, 0x66, 0x6c, 0x79, 0x22, 0x41,
|
||||||
|
0x0a, 0x0a, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x33, 0x0a, 0x06,
|
||||||
|
0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x66,
|
||||||
|
0x69, 0x72, 0x65, 0x66, 0x6c, 0x79, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x74, 0x43, 0x68, 0x75, 0x6e,
|
||||||
|
0x6b, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x52, 0x06, 0x61, 0x73, 0x73, 0x65, 0x74,
|
||||||
|
0x73, 0x22, 0xcf, 0x01, 0x0a, 0x12, 0x41, 0x73, 0x73, 0x65, 0x74, 0x43, 0x68, 0x75, 0x6e, 0x6b,
|
||||||
|
0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x73, 0x73, 0x65,
|
||||||
|
0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x73,
|
||||||
|
0x73, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x36, 0x0a, 0x0c, 0x61, 0x73, 0x73, 0x65, 0x74,
|
||||||
|
0x5f, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e,
|
||||||
|
0x66, 0x69, 0x72, 0x65, 0x66, 0x6c, 0x79, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x74, 0x43, 0x68, 0x75,
|
||||||
|
0x6e, 0x6b, 0x52, 0x0b, 0x61, 0x73, 0x73, 0x65, 0x74, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x12,
|
||||||
|
0x1d, 0x0a, 0x0a, 0x61, 0x73, 0x73, 0x65, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20,
|
||||||
|
0x01, 0x28, 0x05, 0x52, 0x09, 0x61, 0x73, 0x73, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d,
|
||||||
|
0x0a, 0x0a, 0x61, 0x73, 0x73, 0x65, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01,
|
||||||
|
0x28, 0x03, 0x52, 0x09, 0x61, 0x73, 0x73, 0x65, 0x74, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x24, 0x0a,
|
||||||
|
0x0e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x6d, 0x64, 0x35, 0x18,
|
||||||
|
0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x73, 0x73, 0x65, 0x74, 0x48, 0x61, 0x73, 0x68,
|
||||||
|
0x4d, 0x64, 0x35, 0x22, 0xf2, 0x01, 0x0a, 0x0a, 0x41, 0x73, 0x73, 0x65, 0x74, 0x43, 0x68, 0x75,
|
||||||
|
0x6e, 0x6b, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x5f, 0x6e, 0x61, 0x6d, 0x65,
|
||||||
|
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x4e, 0x61, 0x6d,
|
||||||
|
0x65, 0x12, 0x3d, 0x0a, 0x1b, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x5f, 0x64, 0x65, 0x63, 0x6f, 0x6d,
|
||||||
|
0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x6d, 0x64, 0x35,
|
||||||
|
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x18, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x44, 0x65, 0x63,
|
||||||
|
0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x48, 0x61, 0x73, 0x68, 0x4d, 0x64, 0x35,
|
||||||
|
0x12, 0x2f, 0x0a, 0x14, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x5f, 0x6f, 0x6e, 0x5f, 0x66, 0x69, 0x6c,
|
||||||
|
0x65, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11,
|
||||||
|
0x63, 0x68, 0x75, 0x6e, 0x6b, 0x4f, 0x6e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x66, 0x66, 0x73, 0x65,
|
||||||
|
0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18,
|
||||||
|
0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x53, 0x69, 0x7a, 0x65,
|
||||||
|
0x12, 0x36, 0x0a, 0x17, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x64,
|
||||||
|
0x65, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28,
|
||||||
|
0x03, 0x52, 0x15, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x53, 0x69, 0x7a, 0x65, 0x44, 0x65, 0x63, 0x6f,
|
||||||
|
0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x22, 0x47, 0x0a, 0x0d, 0x4d, 0x61, 0x6e, 0x69,
|
||||||
|
0x66, 0x65, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x36, 0x0a, 0x06, 0x61, 0x73, 0x73,
|
||||||
|
0x65, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x66, 0x69, 0x72, 0x65,
|
||||||
|
0x66, 0x6c, 0x79, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73,
|
||||||
|
0x74, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x52, 0x06, 0x61, 0x73, 0x73, 0x65, 0x74,
|
||||||
|
0x73, 0x22, 0xb7, 0x01, 0x0a, 0x15, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x69, 0x66,
|
||||||
|
0x65, 0x73, 0x74, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x61,
|
||||||
|
0x73, 0x73, 0x65, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
|
0x09, 0x61, 0x73, 0x73, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x73,
|
||||||
|
0x73, 0x65, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09,
|
||||||
|
0x61, 0x73, 0x73, 0x65, 0x74, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x61, 0x73, 0x73,
|
||||||
|
0x65, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x6d, 0x64, 0x35, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||||
|
0x09, 0x52, 0x0c, 0x61, 0x73, 0x73, 0x65, 0x74, 0x48, 0x61, 0x73, 0x68, 0x4d, 0x64, 0x35, 0x12,
|
||||||
|
0x3a, 0x0a, 0x0a, 0x61, 0x73, 0x73, 0x65, 0x74, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20,
|
||||||
|
0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x66, 0x69, 0x72, 0x65, 0x66, 0x6c, 0x79, 0x2e, 0x41, 0x73,
|
||||||
|
0x73, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x43, 0x68, 0x75, 0x6e, 0x6b,
|
||||||
|
0x52, 0x09, 0x61, 0x73, 0x73, 0x65, 0x74, 0x44, 0x61, 0x74, 0x61, 0x22, 0x76, 0x0a, 0x12, 0x41,
|
||||||
|
0x73, 0x73, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x43, 0x68, 0x75, 0x6e,
|
||||||
|
0x6b, 0x12, 0x30, 0x0a, 0x14, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x73, 0x73, 0x65,
|
||||||
|
0x74, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
|
0x12, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x41, 0x73, 0x73, 0x65, 0x74, 0x56, 0x65, 0x72, 0x73,
|
||||||
|
0x69, 0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x06, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x18, 0x02, 0x20,
|
||||||
|
0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x66, 0x69, 0x72, 0x65, 0x66, 0x6c, 0x79, 0x2e, 0x41, 0x73,
|
||||||
|
0x73, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x52, 0x06, 0x61, 0x73, 0x73,
|
||||||
|
0x65, 0x74, 0x73, 0x22, 0xc7, 0x03, 0x0a, 0x0d, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4d, 0x61, 0x6e,
|
||||||
|
0x69, 0x66, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x0f, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x5f, 0x66,
|
||||||
|
0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d,
|
||||||
|
0x63, 0x68, 0x75, 0x6e, 0x6b, 0x46, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a,
|
||||||
|
0x12, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73,
|
||||||
|
0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x68, 0x75, 0x6e, 0x6b,
|
||||||
|
0x46, 0x69, 0x6c, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0f, 0x63,
|
||||||
|
0x68, 0x75, 0x6e, 0x6b, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x03,
|
||||||
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x46, 0x69, 0x6c, 0x65, 0x4e,
|
||||||
|
0x6f, 0x64, 0x65, 0x12, 0x26, 0x0a, 0x0f, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x5f, 0x66, 0x69, 0x6c,
|
||||||
|
0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x63, 0x68,
|
||||||
|
0x75, 0x6e, 0x6b, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x63,
|
||||||
|
0x68, 0x75, 0x6e, 0x6b, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6d, 0x64, 0x35, 0x18, 0x05, 0x20,
|
||||||
|
0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x64,
|
||||||
|
0x35, 0x12, 0x3a, 0x0a, 0x1a, 0x68, 0x64, 0x69, 0x66, 0x66, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f,
|
||||||
|
0x69, 0x6e, 0x5f, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18,
|
||||||
|
0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x16, 0x68, 0x64, 0x69, 0x66, 0x66, 0x46, 0x69, 0x6c, 0x65,
|
||||||
|
0x49, 0x6e, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x26, 0x0a,
|
||||||
|
0x0f, 0x68, 0x64, 0x69, 0x66, 0x66, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65,
|
||||||
|
0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x68, 0x64, 0x69, 0x66, 0x66, 0x46, 0x69, 0x6c,
|
||||||
|
0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61,
|
||||||
|
0x6c, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x08, 0x20, 0x01, 0x28,
|
||||||
|
0x09, 0x52, 0x10, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x46, 0x69, 0x6c, 0x65, 0x50,
|
||||||
|
0x61, 0x74, 0x68, 0x12, 0x2c, 0x0a, 0x12, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x5f,
|
||||||
|
0x66, 0x69, 0x6c, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||||
|
0x10, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a,
|
||||||
|
0x65, 0x12, 0x2a, 0x0a, 0x11, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x5f, 0x66, 0x69,
|
||||||
|
0x6c, 0x65, 0x5f, 0x6d, 0x64, 0x35, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6f, 0x72,
|
||||||
|
0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x64, 0x35, 0x42, 0x0e, 0x5a,
|
||||||
|
0x0c, 0x2e, 0x2f, 0x66, 0x69, 0x72, 0x65, 0x66, 0x6c, 0x79, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70,
|
||||||
|
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
})
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_proto_firefly_proto_rawDescOnce sync.Once
|
||||||
|
file_proto_firefly_proto_rawDescData []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_proto_firefly_proto_rawDescGZIP() []byte {
|
||||||
|
file_proto_firefly_proto_rawDescOnce.Do(func() {
|
||||||
|
file_proto_firefly_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_proto_firefly_proto_rawDesc), len(file_proto_firefly_proto_rawDesc)))
|
||||||
|
})
|
||||||
|
return file_proto_firefly_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_proto_firefly_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
|
||||||
|
var file_proto_firefly_proto_goTypes = []any{
|
||||||
|
(*ChunkProto)(nil), // 0: firefly.ChunkProto
|
||||||
|
(*AssetChunkProperty)(nil), // 1: firefly.AssetChunkProperty
|
||||||
|
(*AssetChunk)(nil), // 2: firefly.AssetChunk
|
||||||
|
(*ManifestProto)(nil), // 3: firefly.ManifestProto
|
||||||
|
(*AssetManifestProperty)(nil), // 4: firefly.AssetManifestProperty
|
||||||
|
(*AssetManifestChunk)(nil), // 5: firefly.AssetManifestChunk
|
||||||
|
(*AssetManifest)(nil), // 6: firefly.AssetManifest
|
||||||
|
}
|
||||||
|
var file_proto_firefly_proto_depIdxs = []int32{
|
||||||
|
1, // 0: firefly.ChunkProto.assets:type_name -> firefly.AssetChunkProperty
|
||||||
|
2, // 1: firefly.AssetChunkProperty.asset_chunks:type_name -> firefly.AssetChunk
|
||||||
|
4, // 2: firefly.ManifestProto.assets:type_name -> firefly.AssetManifestProperty
|
||||||
|
5, // 3: firefly.AssetManifestProperty.asset_data:type_name -> firefly.AssetManifestChunk
|
||||||
|
6, // 4: firefly.AssetManifestChunk.assets:type_name -> firefly.AssetManifest
|
||||||
|
5, // [5:5] is the sub-list for method output_type
|
||||||
|
5, // [5:5] is the sub-list for method input_type
|
||||||
|
5, // [5:5] is the sub-list for extension type_name
|
||||||
|
5, // [5:5] is the sub-list for extension extendee
|
||||||
|
0, // [0:5] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_proto_firefly_proto_init() }
|
||||||
|
func file_proto_firefly_proto_init() {
|
||||||
|
if File_proto_firefly_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_firefly_proto_rawDesc), len(file_proto_firefly_proto_rawDesc)),
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 7,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_proto_firefly_proto_goTypes,
|
||||||
|
DependencyIndexes: file_proto_firefly_proto_depIdxs,
|
||||||
|
MessageInfos: file_proto_firefly_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_proto_firefly_proto = out.File
|
||||||
|
file_proto_firefly_proto_goTypes = nil
|
||||||
|
file_proto_firefly_proto_depIdxs = nil
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ type BinaryVersion struct {
|
|||||||
Major int
|
Major int
|
||||||
Minor int
|
Minor int
|
||||||
Patch int
|
Patch int
|
||||||
|
Data []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParseBinaryVersion(path string) (*BinaryVersion, error) {
|
func ParseBinaryVersion(path string) (*BinaryVersion, error) {
|
||||||
@@ -64,17 +65,18 @@ func ParseBinaryVersion(path string) (*BinaryVersion, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
binaryVersion.Data = data
|
||||||
return &binaryVersion, nil
|
return &binaryVersion, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *BinaryVersion) String() string {
|
func (v *BinaryVersion) String() string {
|
||||||
return fmt.Sprintf("%d.%d.%d", v.Major, v.Minor, v.Patch)
|
return fmt.Sprintf("%s-%d.%d.%d", v.Name, v.Major, v.Minor, v.Patch)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v BinaryVersion) ToInt() int {
|
func (v BinaryVersion) ToInt() int {
|
||||||
return v.Major*100 + v.Minor*10 + v.Patch
|
return v.Major*100 + v.Minor*10 + v.Patch
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v BinaryVersion) Subtract(other BinaryVersion) int {
|
func (v BinaryVersion) Subtract(other *BinaryVersion) int {
|
||||||
return v.ToInt() - other.ToInt()
|
return v.ToInt() - other.ToInt()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,11 +21,20 @@ func IsFileIn7z(archivePath, fileInside string) (bool, error) {
|
|||||||
|
|
||||||
lines := strings.Split(out.String(), "\n")
|
lines := strings.Split(out.String(), "\n")
|
||||||
for _, line := range lines {
|
for _, line := range lines {
|
||||||
if strings.Contains(line, fileInside) {
|
line = strings.TrimSpace(line)
|
||||||
|
if line == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
parts := strings.Fields(line)
|
||||||
|
if len(parts) > 0 {
|
||||||
|
path := parts[len(parts)-1]
|
||||||
|
if path == fileInside {
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return false, fmt.Errorf("%s not found in %s", fileInside, archivePath)
|
return false, fmt.Errorf("%s not found in %s", fileInside, archivePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ func check(relPath string, expectedSize int64, expectedMD5, base string) error {
|
|||||||
fullPath, expectedSize, info.Size())
|
fullPath, expectedSize, info.Size())
|
||||||
}
|
}
|
||||||
|
|
||||||
md5Hash, err := fileMD5(fullPath)
|
md5Hash, err := FileMD5(fullPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error reading %s: %w", fullPath, err)
|
return fmt.Errorf("error reading %s: %w", fullPath, err)
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ func check(relPath string, expectedSize int64, expectedMD5, base string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func fileMD5(path string) (string, error) {
|
func FileMD5(path string) (string, error) {
|
||||||
f, err := os.Open(path)
|
f, err := os.Open(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
|||||||
Reference in New Issue
Block a user