mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
refactor: new core
This commit is contained in:
parent
d644eba4d1
commit
fa5c7add7a
2
src/newcore/index.ts
Normal file
2
src/newcore/index.ts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
//统一到处入口
|
||||||
|
export * from './main';
|
29
src/newcore/main.ts
Normal file
29
src/newcore/main.ts
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
enum NapCatCorePlatform {
|
||||||
|
Node = 'Node',//命令行模式加载
|
||||||
|
LiteLoader = 'LiteLoader',//LL插件模式加载
|
||||||
|
}
|
||||||
|
class NewNapCatCore {
|
||||||
|
platform: NapCatCorePlatform; // 平台
|
||||||
|
constructor(platform: NapCatCorePlatform) {
|
||||||
|
this.platform = platform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export class NapCatCoreManger {
|
||||||
|
static core: NewNapCatCore | undefined = undefined;
|
||||||
|
static defaultPlatform: NapCatCorePlatform = NapCatCorePlatform.Node;
|
||||||
|
static SetDefaultCore(platform: NapCatCorePlatform) {
|
||||||
|
if (this.core !== undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.defaultPlatform = platform;
|
||||||
|
}
|
||||||
|
static GetPlatform(): NapCatCorePlatform {
|
||||||
|
return NapCatCoreManger.defaultPlatform;
|
||||||
|
}
|
||||||
|
static GetInstance(): NewNapCatCore {
|
||||||
|
if (this.core === undefined) {
|
||||||
|
this.core = new NewNapCatCore(NapCatCoreManger.defaultPlatform);
|
||||||
|
}
|
||||||
|
return this.core;
|
||||||
|
}
|
||||||
|
}
|
1
src/newcore/platform/liteloader/index.ts
Normal file
1
src/newcore/platform/liteloader/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
//拦截proxy到会话
|
1
src/newcore/platform/node/index.ts
Normal file
1
src/newcore/platform/node/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
//初始化跟之前一样
|
1
src/newcore/util/proxyWrapper.ts
Normal file
1
src/newcore/util/proxyWrapper.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
//proxy封装工具类
|
Loading…
x
Reference in New Issue
Block a user