diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000000000000000000000000000000000000..50f394db4eb821b557e0738e9f48a3afd12b24ac --- /dev/null +++ b/README.en.md @@ -0,0 +1,132 @@ +# Skyline Automation Project + +This is a Golang-based automation project designed to provide a set of tools and functionalities for performing automation tasks such as window management and mouse control. The project leverages the power of the Go language along with the Windows API to implement its core features. + +## 📁 Project Structure Overview + +``` +. +├── go.mod +├── go.sum +├── internal/ +│ ├── app/ +│ │ └── app.go +│ ├── auto/ +│ │ ├── const.go +│ │ ├── mouse.go +│ │ └── win.go +│ ├── config/ +│ │ └── app_config.go +│ ├── script/ +│ │ └── script.go +│ └── util/ +│ ├── configUtil.go +│ └── path.go +├── main.go +└── resources/ + ├── app-dev.properties + └── log.xml +``` + +## 🧱 Core Components + +### `internal/app/app.go` + +- **`App` struct**: Core structure for managing the application. +- **`NewApp()`**: Creates a new `App` instance. +- **`Start()`**: Starts the application. +- **`WaitShutdown()`**: Waits for the application to shut down. + +### `internal/auto/const.go` + +- Defines commonly used variables for interacting with the Windows API, such as: + - `FindWindowW` + - `GetWindowRect` + - `SetWindowPos` + - `PostMessageW` + +### `internal/auto/mouse.go` + +- **`MouseClick(hwnd uintptr, x, y int32) error`**: Simulates a mouse click operation. + +### `internal/auto/win.go` + +- **`FindWindow(title string)`**: Finds a window handle based on its title. +- **`GetWindowRect(hwnd uintptr)`**: Retrieves the position and size of a window. +- **`MoveWindow(hwnd uintptr, x, y, width, height int32)`**: Moves and resizes a window. +- **`ShowWindow(hwnd uintptr)`**: Shows a window. +- **`HideWindow(hwnd uintptr)`**: Hides a window. + +### `internal/config/app_config.go` + +- **`AppConfig` struct**: Structure for application configuration. +- **`LoadAppConfig()`**: Loads the application configuration. + +### `internal/script/script.go` + +- **`Run()`**: Executes the script logic. + +### `internal/util/configUtil.go` + +- Provides utility functions for reading configurations from `.ini` files, such as: + - `GetInt64`, `GetInt`, `GetStr`, `GetBool`, etc. +- **`LoadMode()`**: Loads the JTT mode. + +### `internal/util/path.go` + +- **`GetRootPath()`**: Retrieves the project root path. + +### `main.go` + +- **`main()`**: Entry point of the program. + +### `resources/` + +- **`app-dev.properties`**: Development environment configuration file. +- **`log.xml`**: Logging configuration file. + +## 🚀 Quick Start + +### Install Dependencies + +Ensure you have the Go environment installed, and run the following command to fetch dependencies: + +```bash +go mod download +``` + +### Build the Project + +```bash +go build -o skyline main.go +``` + +### Run the Project + +```bash +./skyline +``` + +## 📝 Usage Example + +You can use the `App` struct to start and manage the application: + +```go +app := NewApp() +app.Start() +app.WaitShutdown() +``` + +## 🤝 Contribution Guide + +Contributions are welcome! Please follow these steps: + +1. Fork the repository +2. Create a new branch (`git checkout -b feature/new-feature`) +3. Commit your changes (`git commit -am 'Add some feature'`) +4. Push the branch (`git push origin feature/new-feature`) +5. Create a Pull Request + +## 📄 License + +This project uses the MIT License. For details, please refer to the [LICENSE](LICENSE) file. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f66b288ac130fa35043df20da6080526c23917f9 --- /dev/null +++ b/README.md @@ -0,0 +1,140 @@ +Based on the code map you provided, here's a README.md tailored for your project: + +--- + +# Skyline Automation Project + +这是一个基于 Golang 的自动化项目,旨在提供一系列工具和功能以实现窗口管理和鼠标控制等自动化任务。该项目利用 Go 语言的强大功能以及 Windows API 来实现其核心功能。 + +## 📁 项目结构概览 + +``` +. +├── go.mod +├── go.sum +├── internal/ +│ ├── app/ +│ │ └── app.go +│ ├── auto/ +│ │ ├── const.go +│ │ ├── mouse.go +│ │ └── win.go +│ ├── config/ +│ │ └── app_config.go +│ ├── script/ +│ │ └── script.go +│ └── util/ +│ ├── configUtil.go +│ └── path.go +├── main.go +└── resources/ + ├── app-dev.properties + └── log.xml +``` + +## 🧱 核心组件 + +### `internal/app/app.go` + +- **`App` struct**: 用于管理应用程序的核心结构。 +- **`NewApp()`**: 创建一个新的 `App` 实例。 +- **`Start()`**: 启动应用程序。 +- **`WaitShutdown()`**: 等待应用程序关闭。 + +### `internal/auto/const.go` + +- 定义了与 Windows API 交互的常用变量,例如: + - `FindWindowW` + - `GetWindowRect` + - `SetWindowPos` + - `PostMessageW` + +### `internal/auto/mouse.go` + +- **`MouseClick(hwnd uintptr, x, y int32) error`**: 模拟鼠标点击操作。 + +### `internal/auto/win.go` + +- **`FindWindow(title string)`**: 根据窗口标题查找窗口句柄。 +- **`GetWindowRect(hwnd uintptr)`**: 获取窗口的位置和大小。 +- **`MoveWindow(hwnd uintptr, x, y, width, height int32)`**: 移动并调整窗口大小。 +- **`ShowWindow(hwnd uintptr)`**: 显示窗口。 +- **`HideWindow(hwnd uintptr)`**: 隐藏窗口。 + +### `internal/config/app_config.go` + +- **`AppConfig` struct**: 应用程序配置的结构体。 +- **`LoadAppConfig()`**: 加载应用程序配置。 + +### `internal/script/script.go` + +- **`Run()`**: 执行脚本逻辑。 + +### `internal/util/configUtil.go` + +- 提供了从 `.ini` 文件中读取配置的实用函数,例如: + - `GetInt64`, `GetInt`, `GetStr`, `GetBool` 等。 +- **`LoadMode()`**: 加载 JTT 模式。 + +### `internal/util/path.go` + +- **`GetRootPath()`**: 获取项目根路径。 + +### `main.go` + +- **`main()`**: 程序入口点。 + +### `resources/` + +- **`app-dev.properties`**: 开发环境配置文件。 +- **`log.xml`**: 日志配置文件。 + +## 🚀 快速开始 + +### 安装依赖 + +确保你已经安装了 Go 环境,并且可以运行以下命令来获取依赖: + +```bash +go mod download +``` + +### 构建项目 + +```bash +go build -o skyline main.go +``` + +### 运行项目 + +```bash +./skyline +``` + +## 📝 使用示例 + +你可以通过 `App` 结构体来启动和管理应用程序: + +```go +app := NewApp() +app.Start() +app.WaitShutdown() +``` + +## 🤝 贡献指南 + +欢迎贡献!请遵循以下步骤: + +1. Fork 仓库 +2. 创建新分支 (`git checkout -b feature/new-feature`) +3. 提交更改 (`git commit -am 'Add some feature'`) +4. 推送分支 (`git push origin feature/new-feature`) +5. 创建 Pull Request + +## 📄 许可证 + +本项目使用 MIT 许可证。详情请查看 [LICENSE](LICENSE) 文件。 + +--- + +希望这份 README 能帮助你更好地理解和使用该项目! \ No newline at end of file