Imported from kunjust/InstagramCloudControl.WPF (
AGENTS.md). Install upstream withnpx skills add kunjust/InstagramCloudControl.WPF. Copyright stays with the author.
AGENTS.md - Development Guidelines for Instagram Cloud Control
Project Overview
Instagram 云控系统 - WPF-based automation tool for managing LDPlayer emulators and automating Instagram account registration.
Tech Stack: WPF + .NET 8 + MaterialDesignThemes + CommunityToolkit.Mvvm + EasyClick + LDPlayer
Build & Run Commands
Build
cd src/InstagramCloudControl.WPF
dotnet build
Run
dotnet run
Clean Build
dotnet clean && dotnet build
Publish
dotnet publish -c Release -o ./publish
Note: This project has no test framework configured. Tests are manual via UI interaction.
Project Structure
ins/
├── PROJECT_HANDOFF.md # Project documentation
├── src/
│ └── InstagramCloudControl.WPF/
│ ├── Models/ # Data models (SimulatorInfo, AccountInfo)
│ ├── ViewModels/ # MVVM view models
│ ├── Services/ # Business logic (LDPlayerManager)
│ ├── Views/ # XAML views (future)
│ ├── App.xaml(.cs) # Application entry
│ └── MainWindow.xaml(.cs)# Main window
Code Style Guidelines
C# Conventions
1. File Organization
- One class per file
- File name matches class name
- Place files in appropriate folders (Models/, ViewModels/, Services/)
2. Naming Conventions
- Classes/PascalCase:
LDPlayerManager,SimulatorInfo - Methods/PascalCase:
GetSimulatorList(),CheckEnvironment() - Properties/PascalCase:
LdPlayerPath,IsEnvironmentValid - Private fields/_camelCase:
_ldManager,_isMaximized - Parameters/camelCase:
simulatorIndex,apkPath - Interfaces/I-prefixed: (none yet, but follow convention)
3. Nullable Reference Types
- Enabled globally (
<Nullable>enable</Nullable>) - Use
stringfor non-nullable,string?for nullable - Initialize properties with default values:
= string.Empty
4. Access Modifiers
- Explicit
public/private/protected - Default to
privatefor fields - Use
publicfor API surface
5. XML Documentation
- All public members require
/// <summary>comments - Document parameters with
<param name="..."> - Use Chinese for documentation comments (project standard)
6. Auto Properties
public int Index { get; set; }
public string Name { get; set; } = string.Empty;
public string? Proxy { get; set; } // nullable
7. MVVM with CommunityToolkit
[ObservableProperty]
private string _statusMessage;
[RelayCommand]
private void CheckEnvironment() { }
partial void OnLdPlayerPathChanged(string value) { } // property changed hook
8. Async/Await
- Use
async Taskfor async methods - Suffix with
Async:LoadDataAsync() - Use
CancellationTokenfor cancellable operations
9. Error Handling
- Throw exceptions for invalid arguments
- Use
try-catchfor external operations (file IO, process execution) - Return error messages via
out string messagepattern for validation
10. Region Organization
#region 模拟器基础操作
// methods here
#endregion
Imports
- Use global using sparingly (project uses explicit imports)
- Place
usingdirectives at top of file - Order: System namespaces → External packages → Project namespaces
Formatting
- 4-space indentation (no tabs)
- Allman brace style (opening brace on new line for types, same line for methods)
- Max line length: ~120 characters (flexible)
Architecture Patterns
MVVM Pattern
- All UI logic in ViewModels
- Use
ObservableObjectbase class - Bind commands with
[RelayCommand] - No code-behind logic in XAML files (except UI event handlers)
Service Pattern
- Business logic in Services folder
- Services are instantiated directly (no DI container yet)
- Methods should be stateless where possible
UI Design Guidelines
Layout Structure
┌─────────────────────────────────────────┐
│ 标题栏 (48px) - #1A73E8 │
├─────────────────────────────────────────┤
│ 配置栏 (Auto) - 白色卡片 │
├─────────────────────────────────────────┤
│ 状态卡片 (Auto) - 4 列 UniformGrid │
├─────────────────────────────────────────┤
│ 设备列表 (*) - 5 列 UniformGrid │
├─────────────────────────────────────────┤
│ 日志面板 (200px) - #1E1E1E 深色 │
└─────────────────────────────────────────┘
Color Palette
| 用途 | 颜色值 | 说明 |
|---|---|---|
| 主色调 | #1A73E8 |
Google Blue |
| 成功色 | #4CAF50 |
绿色 |
| 危险色 | #F44336 |
红色 |
| 警告色 | #FF9800 |
橙色 |
| 背景色 | #F0F2F5 |
浅灰 |
| 深色背景 | #1E1E1E |
日志面板 |
Card Design
- 圆角:
CornerRadius="10" - 阴影:
DropShadowEffect BlurRadius=8, Opacity=0.12 - 边距:
Margin="16"(主容器),Margin="10"(卡片间) - 内边距:
Padding="16"(状态卡片),Padding="12"(设备卡片)
Device Card Specs
- 尺寸:
200×150px - 布局:UniformGrid 5 列
- 边框:在线
#4CAF50/ 离线#E0E0E0 - 状态点:
8×8px椭圆 - 操作按钮:启动 (绿) / 停止 (红) / 删除 (灰)
Typography
- 字体:
Microsoft YaHei UI - 标题:16-18px SemiBold
- 正文:12-14px Regular
- 日志:Consolas 12px
Important Notes
- LDPlayer path resolution - Path defaults to
C:\leidian\LDPlayer9, user can configure - ADB port calculation - Port = 5555 + (emulator_index * 2)
- EasyClick scripts - Located in
src/easyclick-scripts/, communicate via HTTP API - MaterialDesign - Use MaterialDesign styles for all UI components
No Existing Rules
- No
.cursor/rules/or.cursorrulesfound - No
.github/copilot-instructions.mdfound - This is the first AGENTS.md file
Quick Reference
| Task | Command |
|---|---|
| Build (WPF) | cd src/InstagramCloudControl.WPF && dotnet build |
| Run (WPF) | cd src/InstagramCloudControl.WPF && dotnet run |
| Build (EmailAPI) | cd src/InstagramCloudControl.EmailAPI && dotnet build |
| Run (EmailAPI) | cd src/InstagramCloudControl.EmailAPI && dotnet run |
| Clean | dotnet clean |
| Publish | dotnet publish -c Release -o ./publish |
Development Rules
- Verify Compilation: Always run
dotnet buildafter making code changes to ensure there are no compilation errors. - Handle Errors: If compilation fails, fix the errors immediately before proceeding.
- No Tests: This project has no automated test framework. All testing is manual via UI interaction.
Important Conventions
Language
- XML documentation comments must be in Chinese - This is a project-wide standard
- Code comments can be in Chinese or English as appropriate
- UI strings and messages should be in Chinese
Project-Specific Patterns
1. LDPlayer ADB Port Calculation
int port = 5555 + (emulator_index * 2); // e.g., index=0 → port=5555
2. Simulator Naming Convention
- Format:
IG_XX(e.g.,IG_01,IG_02) - Auto-incremented when batch creating
3. Logging Pattern
Log($"[调试] Operation description"); // Debug prefix
Log($"✓ Success message"); // Success with checkmark
Log($"✗ Error message"); // Error with X
4. MVVM Property Change Hooks
partial void OnPropertyNameChanged(string value) { } // CommunityToolkit hook
5. Region Organization (Chinese)
#region 模拟器基础操作
#endregion
External Dependencies
- LDPlayer: Defaults to
C:\leidian\LDPlayer9, user-configurable - AutoJS Scripts: Located in
src/autojs-scripts/, communicate via file-based parameters - Email API: Uses MailKit for IMAP/SMTP operations
Notes for AI Agents
- No test framework exists - Do not suggest adding tests unless explicitly requested
- Chinese documentation - All
/// <summary>comments MUST be in Chinese - Manual UI testing - The project is tested via direct UI interaction
- No DI container - Services are instantiated directly (no dependency injection)
- WPF + Forms interop - Project uses both WPF and Windows Forms (for dialogs)
- Async/await in ViewModel - Commands use
async Taskwith proper UI thread marshaling - Progress tracking - Long operations use
ProgressMax,ProgressValue,ProgressMessage