✨ feat(服务器): 服务器命名路径修改
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user