feat(服务器): 服务器命名路径修改

This commit is contained in:
luying
2023-04-12 19:32:52 +08:00
parent 012501c8d0
commit 6a4c9c5ae9
8 changed files with 6053 additions and 6042 deletions

View File

@@ -1,7 +1,6 @@
// 服务器名
import { readFileAndParse } from '../util'
import { FILENAME } from '../../consts'
import { readServerNameFileList } from "../util";
// 服务器名
export interface DicServerName {
// id
readonly id: number;
@@ -13,14 +12,15 @@ export interface DicServerName {
readonly groupName: string;
}
export const dicServerName = new Map<number, DicServerName>();
export const dicServerName = new Map<string, Map<number, DicServerName>>();
export function loadServerName() {
dicServerName.clear();
let arr = readFileAndParse(FILENAME.DIC_SERVER_NAME);
arr.forEach(o => {
dicServerName.set(o.id, o);
readServerNameFileList().forEach(({ name: fileName, str }) => {
let name = fileName.split('.')[0];
if(!dicServerName.has(name)) dicServerName.set(name, new Map());
let arr = JSON.parse(str);
arr.forEach(o => {
dicServerName.get(name).set(o.id, o);
})
});
arr = undefined;
}