Skip to content

Commit

Permalink
refactor: new core
Browse files Browse the repository at this point in the history
  • Loading branch information
MliKiowa committed Jul 1, 2024
1 parent d644eba commit fa5c7ad
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/newcore/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//统一到处入口
export * from './main';
29 changes: 29 additions & 0 deletions src/newcore/main.ts
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions src/newcore/platform/liteloader/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//拦截proxy到会话
1 change: 1 addition & 0 deletions src/newcore/platform/node/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//初始化跟之前一样
1 change: 1 addition & 0 deletions src/newcore/util/proxyWrapper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//proxy封装工具类

0 comments on commit fa5c7ad

Please sign in to comment.