|
| 1 | +# AI Assistant Guidelines for NETworkManager |
| 2 | + |
| 3 | +This document provides guidelines for AI assistants (GitHub Copilot, Claude, Junie, Cursor, etc.) working with the NETworkManager codebase. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +**NETworkManager** is a powerful network management and troubleshooting application for Windows, built with C# and WPF using the MVVM architecture pattern. |
| 8 | + |
| 9 | +- **Repository**: https://github.com/BornToBeRoot/NETworkManager |
| 10 | +- **Documentation**: https://borntoberoot.net/NETworkManager |
| 11 | +- **License**: GNU General Public License v3 |
| 12 | + |
| 13 | +## Technology Stack |
| 14 | + |
| 15 | +- **Language**: C# (Latest version features used, e.g., file-scoped namespaces, target-typed new) |
| 16 | +- **Framework**: .NET 10.0 (Windows) |
| 17 | +- **Architecture**: MVVM (Model-View-ViewModel) |
| 18 | +- **UI Framework**: WPF (using MahApps.Metro and Dragablz) |
| 19 | + |
| 20 | +## Getting Started |
| 21 | + |
| 22 | +### Prerequisites |
| 23 | + |
| 24 | +- [.NET 10.x SDK](https://dotnet.microsoft.com/download/dotnet/10.0) |
| 25 | +- Visual Studio 2022 with `.NET desktop development` and `Universal Windows Platform development` workloads |
| 26 | +- Windows 10/11 (required for WPF development) |
| 27 | + |
| 28 | +### Cloning the Repository |
| 29 | + |
| 30 | +```bash |
| 31 | +git clone https://github.com/BornToBeRoot/NETworkManager |
| 32 | +cd NETworkManager |
| 33 | +git submodule update --init |
| 34 | +``` |
| 35 | + |
| 36 | +### Building the Project |
| 37 | + |
| 38 | +```bash |
| 39 | +# Restore dependencies |
| 40 | +dotnet restore ./Source/NETworkManager.sln |
| 41 | + |
| 42 | +# Build the solution |
| 43 | +dotnet build ./Source/NETworkManager.sln --configuration Release --no-restore |
| 44 | +``` |
| 45 | + |
| 46 | +Alternatively, open `Source/NETworkManager.sln` in Visual Studio or JetBrains Rider. |
| 47 | + |
| 48 | +## Coding Conventions |
| 49 | + |
| 50 | +### Naming Conventions |
| 51 | + |
| 52 | +- **Classes, Methods, Properties, Enums**: PascalCase |
| 53 | +- **Private Fields**: `_camelCase` (underscore prefix) |
| 54 | + - Exception: `private static readonly ILog Log` (PascalCase) |
| 55 | +- **Event Handlers**: `Object_EventName` (e.g., `SettingsManager_PropertyChanged`) |
| 56 | +- **Interfaces**: `IPascalCase` (prefix with I) |
| 57 | + |
| 58 | +### Formatting |
| 59 | + |
| 60 | +- **Indentation**: 4 spaces |
| 61 | +- **Braces**: Allman style (opening brace on a new line) |
| 62 | +- **Namespaces**: File-scoped namespaces (`namespace MyNamespace;`) |
| 63 | +- **Imports**: `using` directives sorted alphabetically, `System` namespaces mixed in |
| 64 | +- **Grouping**: `#region` used to group related members (e.g., Variables, Events, Properties) |
| 65 | + |
| 66 | +### Specific Practices |
| 67 | + |
| 68 | +- **Logging**: Use `log4net` via `LogManager.GetLogger(typeof(ClassName))` |
| 69 | +- **Properties**: Implement `INotifyPropertyChanged` (usually via `ViewModelBase`). Use expression-bodied members for getters where concise. |
| 70 | +- **Null Checks**: Use pattern matching or standard checks |
| 71 | +- **Localization**: Use static `Strings` class (e.g., `localization:Strings.MyString`) |
| 72 | +- **Documentation**: XML documentation comments (`///`) for all public members |
| 73 | + |
| 74 | +## Code Organization and Package Structure |
| 75 | + |
| 76 | +### Projects |
| 77 | + |
| 78 | +The solution is divided into multiple projects to separate concerns: |
| 79 | + |
| 80 | +| Project | Description | |
| 81 | +|---------|-------------| |
| 82 | +| **NETworkManager** | Main WPF application. Contains entry point (`App.xaml`), main window, and feature-specific Views and ViewModels | |
| 83 | +| **NETworkManager.Controls** | Custom WPF UI controls used throughout the application | |
| 84 | +| **NETworkManager.Converters** | WPF Value Converters for data binding | |
| 85 | +| **NETworkManager.Models** | Core business logic, data entities, and service wrappers (e.g., Network, Ping, Traceroute logic) | |
| 86 | +| **NETworkManager.Utilities** | General purpose utility classes and helpers | |
| 87 | +| **NETworkManager.Utilities.WPF** | WPF-specific utility classes | |
| 88 | +| **NETworkManager.Settings** | Application settings and configuration persistence | |
| 89 | +| **NETworkManager.Profiles** | Network profile handling logic | |
| 90 | +| **NETworkManager.Localization** | Localization resources (`Strings.resx`) | |
| 91 | +| **NETworkManager.Validators** | Input validation logic | |
| 92 | +| **NETworkManager.Documentation** | Application documentation resources | |
| 93 | +| **NETworkManager.Update** | Application update checking and installation logic | |
| 94 | +| **NETworkManager.Setup** | Installer setup (WiX) | |
| 95 | + |
| 96 | +### Directory Structure |
| 97 | + |
| 98 | +``` |
| 99 | +/Source |
| 100 | +├── /NETworkManager # Main application |
| 101 | +│ ├── /Views # XAML Views (UserControls, Windows) |
| 102 | +│ ├── /ViewModels # ViewModels corresponding to Views |
| 103 | +│ └── /Resources # App-specific resources |
| 104 | +├── /NETworkManager.Models |
| 105 | +│ └── Organized by feature (e.g., /Network, /Ping, /Lookup) |
| 106 | +├── /3rdparty # Third-party libraries and dependencies |
| 107 | +└── ...other projects |
| 108 | +``` |
| 109 | + |
| 110 | +## Important Guidelines |
| 111 | + |
| 112 | +### Third-Party Libraries |
| 113 | + |
| 114 | +**AI assistants must not modify libraries and dependencies in the `/3rdparty` folder.** These are external dependencies managed separately. |
| 115 | + |
| 116 | +### Localization |
| 117 | + |
| 118 | +All user-facing strings should be localized using the `NETworkManager.Localization` project. Reference strings using `localization:Strings.MyString` in XAML or the `Strings` class in code. |
| 119 | + |
| 120 | +### MVVM Pattern |
| 121 | + |
| 122 | +Follow the MVVM pattern strictly: |
| 123 | +- **Views** should contain minimal code-behind (only UI-related logic) |
| 124 | +- **ViewModels** handle presentation logic and implement `INotifyPropertyChanged` |
| 125 | +- **Models** contain business logic and data entities |
| 126 | + |
| 127 | +### Configuration Files |
| 128 | + |
| 129 | +- `Source/.editorconfig` - EditorConfig settings for consistent code style |
| 130 | +- `Source/global.json` - .NET SDK version configuration |
| 131 | +- `Source/NETworkManager.sln.DotSettings` - ReSharper/Rider settings |
| 132 | + |
| 133 | +## Contributing |
| 134 | + |
| 135 | +1. Fork the repository |
| 136 | +2. Create a feature branch |
| 137 | +3. Make your changes following the coding conventions above |
| 138 | +4. Submit a pull request |
| 139 | + |
| 140 | +For detailed contributing guidelines, see [CONTRIBUTING.md](CONTRIBUTING.md). |
| 141 | + |
| 142 | +## Additional Resources |
| 143 | + |
| 144 | +- **Website & Documentation**: https://borntoberoot.net/NETworkManager |
| 145 | +- **Issue Tracker**: https://github.com/BornToBeRoot/NETworkManager/issues |
| 146 | +- **Discussions**: https://github.com/BornToBeRoot/NETworkManager/discussions |
| 147 | +- **Translation (Transifex)**: https://app.transifex.com/BornToBeRoot/NETworkManager/dashboard/ |
0 commit comments