This commit is contained in:
Shen Junzheng
2025-03-21 21:45:08 +08:00
parent 78cce92ce3
commit 80c7e67106
86 changed files with 7061 additions and 2316 deletions

View File

@@ -0,0 +1,36 @@
package process
import (
"github.com/sjzar/chatlog/internal/wechat/model"
"github.com/sjzar/chatlog/internal/wechat/process/darwin"
"github.com/sjzar/chatlog/internal/wechat/process/windows"
)
type Detector interface {
FindProcesses() ([]*model.Process, error)
}
// NewDetector 创建适合当前平台的检测器
func NewDetector(platform string) Detector {
// 根据平台返回对应的实现
switch platform {
case "windows":
return windows.NewDetector()
case "darwin":
return darwin.NewDetector()
default:
// 默认返回一个空实现
return &nullDetector{}
}
}
// nullDetector 空实现
type nullDetector struct{}
func (d *nullDetector) FindProcesses() ([]*model.Process, error) {
return nil, nil
}
func (d *nullDetector) GetProcessInfo(pid uint32) (*model.Process, error) {
return nil, nil
}