-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
functions to edit realmlist/settings file/launch wow
- Loading branch information
1 parent
a456bc0
commit 4a18c01
Showing
5 changed files
with
111 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import * as env from '@env' | ||
import * as sys from "@sys"; | ||
import {encode, decode} from "@sciter"; | ||
|
||
export class Wow { | ||
static launchWow(path) { | ||
const exepath = path+`\/Wow.exe`; | ||
env.exec(exepath) | ||
} | ||
|
||
static async realmlistChange(path, realmlist) { | ||
if(!realmlist) return; | ||
const realmlistpath = `${path}\/realmlist.wtf`; | ||
const file = sys.fs.openSync(realmlistpath, 'w'); | ||
const buffer = encode(realmlist, "utf-8") | ||
await file.write(buffer); | ||
await file.close() | ||
} | ||
|
||
static async addAccLogin(path, login) { | ||
if(!login) return; | ||
const settingsPath = `${path}\\WTF\\Config.wtf`; | ||
const file = await sys.fs.open(settingsPath, 'as+'); | ||
const arrayBuffer = await file.read() | ||
const decoded = decode(arrayBuffer, "utf-8"); | ||
// SET accountName | ||
const res = decoded.split('\n').filter(el=>!el.includes("SET accountName")).join("\n")+`SET accountName ${login}`; | ||
await file.write(encode(res)); | ||
await file.close() | ||
} | ||
} | ||
|
||
|