first commit
This commit is contained in:
@@ -0,0 +1,438 @@
|
||||
# Debug Console
|
||||
|
||||
<cite>
|
||||
**Referenced Files in This Document**
|
||||
- [DebugWindow.axaml](file://ClassicAssist.Avalonia/Views/Debug/DebugWindow.axaml)
|
||||
- [DebugWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/Debug/DebugWindow.axaml.cs)
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
- [SystemMessageTextWriter.cs](file://ClassicAssist.Shared/Data/Macros/SystemMessageTextWriter.cs)
|
||||
- [ChatManager.cs](file://ClassicAssist.Shared/Data/Chat/ChatManager.cs)
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
- [PacketFilter.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilter.cs)
|
||||
- [PacketFilterInfo.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterInfo.cs)
|
||||
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
|
||||
- [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs)
|
||||
- [Engine.cs](file://ClassicAssist.Avalonia/Engine.cs)
|
||||
- [App.axaml.cs](file://ClassicAssist.Avalonia/App.axaml.cs)
|
||||
</cite>
|
||||
|
||||
## Table of Contents
|
||||
1. [Introduction](#introduction)
|
||||
2. [Project Structure](#project-structure)
|
||||
3. [Core Components](#core-components)
|
||||
4. [Architecture Overview](#architecture-overview)
|
||||
5. [Detailed Component Analysis](#detailed-component-analysis)
|
||||
6. [Dependency Analysis](#dependency-analysis)
|
||||
7. [Performance Considerations](#performance-considerations)
|
||||
8. [Troubleshooting Guide](#troubleshooting-guide)
|
||||
9. [Conclusion](#conclusion)
|
||||
10. [Appendices](#appendices)
|
||||
|
||||
## Introduction
|
||||
This document explains the Debug Console in ClassicAssist.Avalonia, focusing on how it receives, displays, and manages diagnostic information from various subsystems. It covers:
|
||||
- Console output system and log viewing capabilities
|
||||
- Diagnostic information display for packets, chat, and macros
|
||||
- Configuring logging levels, filtering messages, and exporting debug data
|
||||
- Real-time streaming and search functionality
|
||||
- Message formatting options and interpreting outputs
|
||||
- Performance implications across logging levels
|
||||
- Best practices for development vs production
|
||||
- Extending the console with custom sources and formats
|
||||
|
||||
## Project Structure
|
||||
The Debug Console is implemented as an Avalonia view with a corresponding ViewModel that binds to shared services and network filters. The key files are:
|
||||
- View layer (Avalonia): DebugWindow.axaml and DebugWindow.axaml.cs
|
||||
- View model: DebugViewModel.cs
|
||||
- Shared services and filters: ChatManager, Packet Filters, Packet Handlers
|
||||
- Application bootstrap: App.axaml.cs and Engine.cs
|
||||
|
||||
```mermaid
|
||||
graph TB
|
||||
subgraph "UI Layer"
|
||||
DW["DebugWindow.axaml"]
|
||||
DWC["DebugWindow.axaml.cs"]
|
||||
DVM["DebugViewModel.cs"]
|
||||
end
|
||||
subgraph "Shared Services"
|
||||
CM["ChatManager.cs"]
|
||||
SMTW["SystemMessageTextWriter.cs"]
|
||||
end
|
||||
subgraph "Networking"
|
||||
IPF["IncomingPacketFilters.cs"]
|
||||
OPF["OutgoingPacketFilters.cs"]
|
||||
PF["PacketFilter.cs"]
|
||||
PFI["PacketFilterInfo.cs"]
|
||||
IPH["IncomingPacketHandlers.cs"]
|
||||
OPH["OutgoingPacketHandlers.cs"]
|
||||
end
|
||||
subgraph "Bootstrap"
|
||||
APP["App.axaml.cs"]
|
||||
ENG["Engine.cs"]
|
||||
end
|
||||
DW --> DWC
|
||||
DWC --> DVM
|
||||
DVM --> CM
|
||||
DVM --> IPF
|
||||
DVM --> OPF
|
||||
DVM --> PF
|
||||
DVM --> PFI
|
||||
DVM --> IPH
|
||||
DVM --> OPH
|
||||
APP --> ENG
|
||||
ENG --> DVM
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [DebugWindow.axaml](file://ClassicAssist.Avalonia/Views/Debug/DebugWindow.axaml)
|
||||
- [DebugWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/Debug/DebugWindow.axaml.cs)
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
- [ChatManager.cs](file://ClassicAssist.Shared/Data/Chat/ChatManager.cs)
|
||||
- [SystemMessageTextWriter.cs](file://ClassicAssist.Shared/Data/Macros/SystemMessageTextWriter.cs)
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
- [PacketFilter.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilter.cs)
|
||||
- [PacketFilterInfo.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterInfo.cs)
|
||||
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
|
||||
- [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs)
|
||||
- [App.axaml.cs](file://ClassicAssist.Avalonia/App.axaml.cs)
|
||||
- [Engine.cs](file://ClassicAssist.Avalonia/Engine.cs)
|
||||
|
||||
**Section sources**
|
||||
- [DebugWindow.axaml](file://ClassicAssist.Avalonia/Views/Debug/DebugWindow.axaml)
|
||||
- [DebugWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/Debug/DebugWindow.axaml.cs)
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
- [App.axaml.cs](file://ClassicAssist.Avalonia/App.axaml.cs)
|
||||
- [Engine.cs](file://ClassicAssist.Avalonia/Engine.cs)
|
||||
|
||||
## Core Components
|
||||
- Debug Window (View): Provides UI elements for displaying logs, searching, filtering, and exporting.
|
||||
- Debug View Model: Binds UI to shared services and network filters; exposes commands for filtering, clearing, and exporting.
|
||||
- Chat Manager: Centralizes chat message handling and can be integrated into the console for unified diagnostics.
|
||||
- System Message Text Writer: Bridges macro/system messages into the console pipeline.
|
||||
- Packet Filters and Handlers: Provide real-time packet inspection and routing, enabling detailed network diagnostics.
|
||||
|
||||
Key responsibilities:
|
||||
- Receive and aggregate logs from multiple sources
|
||||
- Render logs in real time with optional auto-scrolling
|
||||
- Support filtering by level, source, or keyword
|
||||
- Allow export of filtered logs to external files
|
||||
- Maintain performance by throttling high-volume streams
|
||||
|
||||
**Section sources**
|
||||
- [DebugWindow.axaml](file://ClassicAssist.Avalonia/Views/Debug/DebugWindow.axaml)
|
||||
- [DebugWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/Debug/DebugWindow.axaml.cs)
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
- [ChatManager.cs](file://ClassicAssist.Shared/Data/Chat/ChatManager.cs)
|
||||
- [SystemMessageTextWriter.cs](file://ClassicAssist.Shared/Data/Macros/SystemMessageTextWriter.cs)
|
||||
|
||||
## Architecture Overview
|
||||
The Debug Console integrates with shared services and networking layers to provide centralized diagnostics. The flow typically involves:
|
||||
- Subsystems emitting logs/messages via shared services
|
||||
- Debug View Model subscribing to events and updating bound collections
|
||||
- UI rendering entries in real time with filtering and search
|
||||
- Export functionality writing selected entries to disk
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant Subsystem as "Subsystem"
|
||||
participant Service as "Shared Service"
|
||||
participant VM as "DebugViewModel"
|
||||
participant UI as "DebugWindow"
|
||||
participant Exporter as "Exporter"
|
||||
Subsystem->>Service : Emit log/message
|
||||
Service-->>VM : Event/Notification
|
||||
VM->>VM : Apply filter/format
|
||||
VM-->>UI : Update collection
|
||||
UI->>UI : Render entry (real-time)
|
||||
UI->>Exporter : Export filtered logs
|
||||
Exporter-->>UI : Save file path/status
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
- [DebugWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/Debug/DebugWindow.axaml.cs)
|
||||
- [ChatManager.cs](file://ClassicAssist.Shared/Data/Chat/ChatManager.cs)
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
|
||||
## Detailed Component Analysis
|
||||
|
||||
### Debug Window (View)
|
||||
- Purpose: Hosts the console UI, including log list, search box, filter controls, and export actions.
|
||||
- Behavior: Binds to properties exposed by DebugViewModel; supports keyboard shortcuts and context menu operations.
|
||||
- Integration: Uses Avalonia data binding to reflect changes from the ViewModel efficiently.
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
class DebugWindow {
|
||||
+InitializeComponent()
|
||||
+OnLoaded()
|
||||
+BindDataContext()
|
||||
+ExportLogs()
|
||||
+ClearConsole()
|
||||
+SearchText
|
||||
+SelectedLogLevel
|
||||
+AutoScrollEnabled
|
||||
}
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [DebugWindow.axaml](file://ClassicAssist.Avalonia/Views/Debug/DebugWindow.axaml)
|
||||
- [DebugWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/Debug/DebugWindow.axaml.cs)
|
||||
|
||||
**Section sources**
|
||||
- [DebugWindow.axaml](file://ClassicAssist.Avalonia/Views/Debug/DebugWindow.axaml)
|
||||
- [DebugWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/Debug/DebugWindow.axaml.cs)
|
||||
|
||||
### Debug View Model
|
||||
- Purpose: Aggregates logs, applies filters, formats messages, and exposes commands for UI interaction.
|
||||
- Responsibilities:
|
||||
- Subscribe to shared services (e.g., ChatManager) and packet filters
|
||||
- Maintain a bounded collection of log entries to prevent memory growth
|
||||
- Implement filtering by level, source, and text search
|
||||
- Provide export functionality to write logs to files
|
||||
- Manage auto-scroll behavior and thread-safe updates
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
class DebugViewModel {
|
||||
+ObservableCollection~LogEntry~ Logs
|
||||
+string SearchText
|
||||
+LogLevel SelectedLogLevel
|
||||
+bool AutoScroll
|
||||
+void AddLog(source, level, message)
|
||||
+void ClearLogs()
|
||||
+IEnumerable~LogEntry~ GetFilteredLogs()
|
||||
+void ExportLogs(path)
|
||||
+void ToggleAutoScroll()
|
||||
}
|
||||
class LogEntry {
|
||||
+DateTime Timestamp
|
||||
+string Source
|
||||
+LogLevel Level
|
||||
+string Message
|
||||
}
|
||||
DebugViewModel --> LogEntry : "creates/manages"
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
|
||||
**Section sources**
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
|
||||
### Chat Integration
|
||||
- Purpose: Route chat messages into the console for unified diagnostics.
|
||||
- Mechanism: Subscribe to ChatManager events and append formatted entries to the log collection.
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant Client as "Game Client"
|
||||
participant CM as "ChatManager"
|
||||
participant VM as "DebugViewModel"
|
||||
participant UI as "DebugWindow"
|
||||
Client->>CM : Chat event
|
||||
CM-->>VM : OnChatMessage(args)
|
||||
VM->>VM : Format message
|
||||
VM-->>UI : Append to Logs
|
||||
UI->>UI : Render new entry
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [ChatManager.cs](file://ClassicAssist.Shared/Data/Chat/ChatManager.cs)
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
- [DebugWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/Debug/DebugWindow.axaml.cs)
|
||||
|
||||
**Section sources**
|
||||
- [ChatManager.cs](file://ClassicAssist.Shared/Data/Chat/ChatManager.cs)
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
|
||||
### Macro System Messages
|
||||
- Purpose: Capture macro/system messages and route them to the console.
|
||||
- Mechanism: Use SystemMessageTextWriter to bridge macro outputs into the logging pipeline.
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
Start(["Macro Execution"]) --> Write["SystemMessageTextWriter.Write(message)"]
|
||||
Write --> Filter{"Filter by Level/Source?"}
|
||||
Filter --> |Yes| Append["Append to DebugViewModel.Logs"]
|
||||
Filter --> |No| Drop["Discard Entry"]
|
||||
Append --> Render["UI Renders Entry"]
|
||||
Drop --> End(["End"])
|
||||
Render --> End
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [SystemMessageTextWriter.cs](file://ClassicAssist.Shared/Data/Macros/SystemMessageTextWriter.cs)
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
|
||||
**Section sources**
|
||||
- [SystemMessageTextWriter.cs](file://ClassicAssist.Shared/Data/Macros/SystemMessageTextWriter.cs)
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
|
||||
### Packet Diagnostics
|
||||
- Purpose: Inspect incoming and outgoing packets for network troubleshooting.
|
||||
- Mechanism: Use IncomingPacketFilters and OutgoingPacketFilters to capture and format packet data; integrate with DebugViewModel for display.
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant Net as "Network Stack"
|
||||
participant IPF as "IncomingPacketFilters"
|
||||
participant OPF as "OutgoingPacketFilters"
|
||||
participant VM as "DebugViewModel"
|
||||
participant UI as "DebugWindow"
|
||||
Net->>IPF : Incoming packet
|
||||
IPF-->>VM : OnIncoming(packet)
|
||||
VM->>VM : Format packet info
|
||||
VM-->>UI : Append to Logs
|
||||
Net->>OPF : Outgoing packet
|
||||
OPF-->>VM : OnOutgoing(packet)
|
||||
VM->>VM : Format packet info
|
||||
VM-->>UI : Append to Logs
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
- [PacketFilter.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilter.cs)
|
||||
- [PacketFilterInfo.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterInfo.cs)
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
- [DebugWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/Debug/DebugWindow.axaml.cs)
|
||||
|
||||
**Section sources**
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
- [PacketFilter.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilter.cs)
|
||||
- [PacketFilterInfo.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterInfo.cs)
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
|
||||
### Bootstrap and Initialization
|
||||
- Purpose: Initialize the application and ensure the Debug Console is wired to shared services.
|
||||
- Mechanism: App.axaml.cs and Engine.cs set up DI, register services, and start the main window.
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
Boot["App Startup"] --> Register["Register Services"]
|
||||
Register --> InitVM["Initialize DebugViewModel"]
|
||||
InitVM --> BindUI["Bind DebugWindow DataContext"]
|
||||
BindUI --> Ready["Console Ready"]
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [App.axaml.cs](file://ClassicAssist.Avalonia/App.axaml.cs)
|
||||
- [Engine.cs](file://ClassicAssist.Avalonia/Engine.cs)
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
- [DebugWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/Debug/DebugWindow.axaml.cs)
|
||||
|
||||
**Section sources**
|
||||
- [App.axaml.cs](file://ClassicAssist.Avalonia/App.axaml.cs)
|
||||
- [Engine.cs](file://ClassicAssist.Avalonia/Engine.cs)
|
||||
|
||||
## Dependency Analysis
|
||||
The Debug Console depends on shared services and network filters to aggregate and display diagnostics. Key dependencies include:
|
||||
- ChatManager for chat integration
|
||||
- Packet filters for network diagnostics
|
||||
- SystemMessageTextWriter for macro outputs
|
||||
- UI components for rendering and user interaction
|
||||
|
||||
```mermaid
|
||||
graph TB
|
||||
DVM["DebugViewModel.cs"] --> CM["ChatManager.cs"]
|
||||
DVM --> IPF["IncomingPacketFilters.cs"]
|
||||
DVM --> OPF["OutgoingPacketFilters.cs"]
|
||||
DVM --> PF["PacketFilter.cs"]
|
||||
DVM --> PFI["PacketFilterInfo.cs"]
|
||||
DVM --> SMTW["SystemMessageTextWriter.cs"]
|
||||
DW["DebugWindow.axaml.cs"] --> DVM
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
- [ChatManager.cs](file://ClassicAssist.Shared/Data/Chat/ChatManager.cs)
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
- [PacketFilter.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilter.cs)
|
||||
- [PacketFilterInfo.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterInfo.cs)
|
||||
- [SystemMessageTextWriter.cs](file://ClassicAssist.Shared/Data/Macros/SystemMessageTextWriter.cs)
|
||||
- [DebugWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/Debug/DebugWindow.axaml.cs)
|
||||
|
||||
**Section sources**
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
- [DebugWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/Debug/DebugWindow.axaml.cs)
|
||||
|
||||
## Performance Considerations
|
||||
- Logging Levels:
|
||||
- High verbosity (Trace/Debug) can significantly impact performance due to increased I/O and UI updates.
|
||||
- Recommended levels:
|
||||
- Development: Debug or Trace for comprehensive diagnostics
|
||||
- Production: Warning or Error to minimize overhead
|
||||
- Filtering:
|
||||
- Enable server-side filtering where possible to reduce payload size before reaching the console.
|
||||
- Use keyword and level filters to limit displayed entries.
|
||||
- Throttling:
|
||||
- Implement rate limiting for high-frequency logs (e.g., packet dumps).
|
||||
- Batch UI updates to avoid excessive re-renders.
|
||||
- Memory Management:
|
||||
- Use bounded collections to cap log history size.
|
||||
- Periodically purge old entries to prevent memory growth.
|
||||
- Export Strategy:
|
||||
- Stream exports instead of loading entire logs into memory.
|
||||
- Compress exported files if large volumes are expected.
|
||||
|
||||
[No sources needed since this section provides general guidance]
|
||||
|
||||
## Troubleshooting Guide
|
||||
Common issues and resolutions:
|
||||
- Console not receiving logs:
|
||||
- Verify service registration during app startup.
|
||||
- Ensure subscriptions to ChatManager and packet filters are active.
|
||||
- Slow UI when many logs:
|
||||
- Reduce logging level or enable filtering.
|
||||
- Disable auto-scroll if not needed.
|
||||
- Missing packet diagnostics:
|
||||
- Confirm packet filters are enabled and correctly configured.
|
||||
- Check handler registrations for incoming/outgoing packets.
|
||||
- Export failures:
|
||||
- Validate file path permissions and available disk space.
|
||||
- Ensure asynchronous export to avoid blocking UI.
|
||||
|
||||
**Section sources**
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
|
||||
## Conclusion
|
||||
The Debug Console in ClassicAssist.Avalonia provides a centralized, extensible platform for diagnosing game interactions, network traffic, and macro execution. By leveraging shared services and packet filters, it offers real-time insights with configurable filtering and export capabilities. Proper configuration of logging levels and performance optimizations ensures effective debugging in development while maintaining stability in production.
|
||||
|
||||
[No sources needed since this section summarizes without analyzing specific files]
|
||||
|
||||
## Appendices
|
||||
|
||||
### Configuration Options
|
||||
- Logging Levels:
|
||||
- Trace: Most verbose, includes detailed internal states
|
||||
- Debug: Useful for feature-level diagnostics
|
||||
- Info: General operational messages
|
||||
- Warning: Potential issues requiring attention
|
||||
- Error: Critical failures
|
||||
- Filters:
|
||||
- Level-based filtering
|
||||
- Source-based filtering (e.g., chat, packets, macros)
|
||||
- Keyword search across message content
|
||||
- Export Formats:
|
||||
- Plain text with timestamps and levels
|
||||
- JSON for structured analysis
|
||||
- CSV for spreadsheet processing
|
||||
|
||||
[No sources needed since this section provides general guidance]
|
||||
|
||||
### Extending the Console
|
||||
- Custom Log Sources:
|
||||
- Implement a publisher that emits log events to DebugViewModel.
|
||||
- Register the publisher during application initialization.
|
||||
- Custom Output Formats:
|
||||
- Extend the exporter to support additional formats.
|
||||
- Integrate with external tools via API endpoints or file watchers.
|
||||
|
||||
[No sources needed since this section provides general guidance]
|
||||
@@ -0,0 +1,570 @@
|
||||
# Development Tools
|
||||
|
||||
<cite>
|
||||
**Referenced Files in This Document**
|
||||
- [ObjectInspectorWindow.axaml](file://ClassicAssist.Avalonia/Views/ObjectInspectorWindow.axaml)
|
||||
- [ObjectInspectorWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/ObjectInspectorWindow.axaml.cs)
|
||||
- [ObjectInspectorViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/ObjectInspectorViewModel.cs)
|
||||
- [ObjectInspectorData.cs](file://ClassicAssist.Shared/UI/Models/ObjectInspectorData.cs)
|
||||
- [HexDumpControl.axaml](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml)
|
||||
- [HexDumpControl.axaml.cs](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml.cs)
|
||||
- [DebugWindow.axaml](file://ClassicAssist.Avalonia/Views/DebugWindow.axaml)
|
||||
- [DebugWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/DebugWindow.axaml.cs)
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
- [GIFRecorderWindow.axaml](file://ClassicAssist/Views/GIFRecorderWindow.xaml)
|
||||
- [GIFRecorderWindow.xaml.cs](file://ClassicAssist/Views/GIFRecorderWindow.xaml.cs)
|
||||
- [GIFRecorderViewModel.cs](file://ClassicAssist/ViewModels/GIFRecorderViewModel.cs)
|
||||
- [ShowGIFCaptureWindow.cs](file://ClassicAssist/Data/Hotkeys/Commands/ShowGIFCaptureWindow.cs)
|
||||
- [PacketEntry.cs](file://ClassicAssist.Shared/UI/Misc/PacketEntry.cs)
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
|
||||
- [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs)
|
||||
- [PacketFilter.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilter.cs)
|
||||
- [PacketFilterCondition.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterCondition.cs)
|
||||
- [PacketFilterConditions.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterConditions.cs)
|
||||
- [PacketFilterInfo.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterInfo.cs)
|
||||
- [PacketWaitEntries.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntries.cs)
|
||||
- [PacketWaitEntry.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntry.cs)
|
||||
- [ReplayPacketLog.cs](file://ClassicAssist.Tests/ReplayPacketLog.cs)
|
||||
- [EntityCollectionViewerViewModel.cs](file://ClassicAssist/ViewModels/EntityCollectionViewerViewModel.cs)
|
||||
- [ActiveObjectsViewModel.cs](file://ClassicAssist/ViewModels/ActiveObjectsViewModel.cs)
|
||||
</cite>
|
||||
|
||||
## Table of Contents
|
||||
1. [Introduction](#introduction)
|
||||
2. [Project Structure](#project-structure)
|
||||
3. [Core Components](#core-components)
|
||||
4. [Architecture Overview](#architecture-overview)
|
||||
5. [Detailed Component Analysis](#detailed-component-analysis)
|
||||
6. [Dependency Analysis](#dependency-analysis)
|
||||
7. [Performance Considerations](#performance-considerations)
|
||||
8. [Troubleshooting Guide](#troubleshooting-guide)
|
||||
9. [Conclusion](#conclusion)
|
||||
|
||||
## Introduction
|
||||
This document explains the development and debugging tools available in ClassicAssist.Avalonia with a focus on:
|
||||
- Object Inspector for real-time entity inspection, property viewing, and memory analysis
|
||||
- Packet Logger for network traffic analysis, replay system functionality, and custom filter creation
|
||||
- GIF Recorder for gameplay recording, animation export, and quality settings configuration
|
||||
- Debug Window for console output, log viewing, and diagnostic information
|
||||
- Hex Dump utilities for binary data inspection and protocol analysis
|
||||
- Integration with external debugging tools and profiling utilities
|
||||
- Performance monitoring and memory leak detection techniques
|
||||
- Practical guidance for using these tools during development and troubleshooting
|
||||
|
||||
## Project Structure
|
||||
The development and debugging features are implemented across shared UI models and view models, Avalonia-specific views and controls, and core networking components. The following diagram shows how key pieces fit together at a high level.
|
||||
|
||||
```mermaid
|
||||
graph TB
|
||||
subgraph "Avalonia UI"
|
||||
OIWin["ObjectInspectorWindow"]
|
||||
DW["DebugWindow"]
|
||||
HD["HexDumpControl"]
|
||||
GRWin["GIFRecorderWindow"]
|
||||
end
|
||||
subgraph "Shared UI Layer"
|
||||
OIVM["ObjectInspectorViewModel"]
|
||||
DVM["DebugViewModel"]
|
||||
PE["PacketEntry"]
|
||||
ECV["EntityCollectionViewerViewModel"]
|
||||
AOV["ActiveObjectsViewModel"]
|
||||
end
|
||||
subgraph "Networking Core"
|
||||
IPF["IncomingPacketFilters"]
|
||||
OPF["OutgoingPacketFilters"]
|
||||
IPH["IncomingPacketHandlers"]
|
||||
OPH["OutgoingPacketHandlers"]
|
||||
PF["PacketFilter"]
|
||||
PFC["PacketFilterCondition"]
|
||||
PFCs["PacketFilterConditions"]
|
||||
PFI["PacketFilterInfo"]
|
||||
PWE["PacketWaitEntries"]
|
||||
PWEt["PacketWaitEntry"]
|
||||
end
|
||||
subgraph "Tests"
|
||||
RPL["ReplayPacketLog"]
|
||||
end
|
||||
OIWin --> OIVM
|
||||
DW --> DVM
|
||||
HD --> PE
|
||||
GRWin --> |"Hotkey Command"| GRWin
|
||||
OIVM --> ECV
|
||||
OIVM --> AOV
|
||||
PE --> IPF
|
||||
PE --> OPF
|
||||
IPF --> PF
|
||||
OPF --> PF
|
||||
PF --> PFC
|
||||
PF --> PFCs
|
||||
PF --> PFI
|
||||
PF --> PWE
|
||||
PWE --> PWEt
|
||||
RPL --> IPH
|
||||
RPL --> OPH
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [ObjectInspectorWindow.axaml](file://ClassicAssist.Avalonia/Views/ObjectInspectorWindow.axaml)
|
||||
- [ObjectInspectorWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/ObjectInspectorWindow.axaml.cs)
|
||||
- [ObjectInspectorViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/ObjectInspectorViewModel.cs)
|
||||
- [ObjectInspectorData.cs](file://ClassicAssist.Shared/UI/Models/ObjectInspectorData.cs)
|
||||
- [DebugWindow.axaml](file://ClassicAssist.Avalonia/Views/DebugWindow.axaml)
|
||||
- [DebugWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/DebugWindow.axaml.cs)
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
- [HexDumpControl.axaml](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml)
|
||||
- [HexDumpControl.axaml.cs](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml.cs)
|
||||
- [GIFRecorderWindow.axaml](file://ClassicAssist/Views/GIFRecorderWindow.xaml)
|
||||
- [GIFRecorderWindow.xaml.cs](file://ClassicAssist/Views/GIFRecorderWindow.xaml.cs)
|
||||
- [ShowGIFCaptureWindow.cs](file://ClassicAssist/Data/Hotkeys/Commands/ShowGIFCaptureWindow.cs)
|
||||
- [PacketEntry.cs](file://ClassicAssist.Shared/UI/Misc/PacketEntry.cs)
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
|
||||
- [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs)
|
||||
- [PacketFilter.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilter.cs)
|
||||
- [PacketFilterCondition.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterCondition.cs)
|
||||
- [PacketFilterConditions.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterConditions.cs)
|
||||
- [PacketFilterInfo.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterInfo.cs)
|
||||
- [PacketWaitEntries.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntries.cs)
|
||||
- [PacketWaitEntry.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntry.cs)
|
||||
- [ReplayPacketLog.cs](file://ClassicAssist.Tests/ReplayPacketLog.cs)
|
||||
- [EntityCollectionViewerViewModel.cs](file://ClassicAssist/ViewModels/EntityCollectionViewerViewModel.cs)
|
||||
- [ActiveObjectsViewModel.cs](file://ClassicAssist/ViewModels/ActiveObjectsViewModel.cs)
|
||||
|
||||
**Section sources**
|
||||
- [ObjectInspectorWindow.axaml](file://ClassicAssist.Avalonia/Views/ObjectInspectorWindow.axaml)
|
||||
- [ObjectInspectorWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/ObjectInspectorWindow.axaml.cs)
|
||||
- [ObjectInspectorViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/ObjectInspectorViewModel.cs)
|
||||
- [ObjectInspectorData.cs](file://ClassicAssist.Shared/UI/Models/ObjectInspectorData.cs)
|
||||
- [DebugWindow.axaml](file://ClassicAssist.Avalonia/Views/DebugWindow.axaml)
|
||||
- [DebugWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/DebugWindow.axaml.cs)
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
- [HexDumpControl.axaml](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml)
|
||||
- [HexDumpControl.axaml.cs](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml.cs)
|
||||
- [GIFRecorderWindow.axaml](file://ClassicAssist/Views/GIFRecorderWindow.xaml)
|
||||
- [GIFRecorderWindow.xaml.cs](file://ClassicAssist/Views/GIFRecorderWindow.xaml.cs)
|
||||
- [ShowGIFCaptureWindow.cs](file://ClassicAssist/Data/Hotkeys/Commands/ShowGIFCaptureWindow.cs)
|
||||
- [PacketEntry.cs](file://ClassicAssist.Shared/UI/Misc/PacketEntry.cs)
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
|
||||
- [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs)
|
||||
- [PacketFilter.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilter.cs)
|
||||
- [PacketFilterCondition.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterCondition.cs)
|
||||
- [PacketFilterConditions.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterConditions.cs)
|
||||
- [PacketFilterInfo.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterInfo.cs)
|
||||
- [PacketWaitEntries.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntries.cs)
|
||||
- [PacketWaitEntry.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntry.cs)
|
||||
- [ReplayPacketLog.cs](file://ClassicAssist.Tests/ReplayPacketLog.cs)
|
||||
- [EntityCollectionViewerViewModel.cs](file://ClassicAssist/ViewModels/EntityCollectionViewerViewModel.cs)
|
||||
- [ActiveObjectsViewModel.cs](file://ClassicAssist/ViewModels/ActiveObjectsViewModel.cs)
|
||||
|
||||
## Core Components
|
||||
- Object Inspector: Provides live inspection of entities and their properties, supports filtering and sorting, and exposes data suitable for memory analysis workflows.
|
||||
- Packet Logger: Captures incoming and outgoing packets, integrates with filters and wait entries, and supports replay via test harnesses.
|
||||
- GIF Recorder: Records gameplay to GIF files, exposes quality and export options, and is accessible via hotkeys.
|
||||
- Debug Window: Displays console output, logs, and diagnostics for rapid iteration and troubleshooting.
|
||||
- Hex Dump Control: Renders raw bytes in hex and ASCII for protocol analysis and binary inspection.
|
||||
|
||||
**Section sources**
|
||||
- [ObjectInspectorViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/ObjectInspectorViewModel.cs)
|
||||
- [ObjectInspectorData.cs](file://ClassicAssist.Shared/UI/Models/ObjectInspectorData.cs)
|
||||
- [PacketEntry.cs](file://ClassicAssist.Shared/UI/Misc/PacketEntry.cs)
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
- [PacketFilter.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilter.cs)
|
||||
- [PacketFilterCondition.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterCondition.cs)
|
||||
- [PacketFilterConditions.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterConditions.cs)
|
||||
- [PacketFilterInfo.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterInfo.cs)
|
||||
- [PacketWaitEntries.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntries.cs)
|
||||
- [PacketWaitEntry.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntry.cs)
|
||||
- [GIFRecorderWindow.xaml.cs](file://ClassicAssist/Views/GIFRecorderWindow.xaml.cs)
|
||||
- [GIFRecorderViewModel.cs](file://ClassicAssist/ViewModels/GIFRecorderViewModel.cs)
|
||||
- [ShowGIFCaptureWindow.cs](file://ClassicAssist/Data/Hotkeys/Commands/ShowGIFCaptureWindow.cs)
|
||||
- [DebugWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/DebugWindow.axaml.cs)
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
- [HexDumpControl.axaml.cs](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml.cs)
|
||||
|
||||
## Architecture Overview
|
||||
The development tools follow a layered architecture:
|
||||
- UI layer (Avalonia): Windows and controls render state from ViewModels and shared models.
|
||||
- Shared UI layer: ViewModels and models provide cross-platform UI logic and data structures.
|
||||
- Networking core: Packet handlers and filters manage capture, processing, and replay.
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant User as "Developer"
|
||||
participant OIWin as "ObjectInspectorWindow"
|
||||
participant OIVM as "ObjectInspectorViewModel"
|
||||
participant ECV as "EntityCollectionViewerViewModel"
|
||||
participant AOV as "ActiveObjectsViewModel"
|
||||
User->>OIWin : Open Object Inspector
|
||||
OIWin->>OIVM : Initialize ViewModel
|
||||
OIVM->>ECV : Load entity collections
|
||||
OIVM->>AOV : Load active objects
|
||||
OIVM-->>OIWin : Bind properties and lists
|
||||
User->>OIVM : Select entity / change filter
|
||||
OIVM-->>User : Updated object details and properties
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [ObjectInspectorWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/ObjectInspectorWindow.axaml.cs)
|
||||
- [ObjectInspectorViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/ObjectInspectorViewModel.cs)
|
||||
- [EntityCollectionViewerViewModel.cs](file://ClassicAssist/ViewModels/EntityCollectionViewerViewModel.cs)
|
||||
- [ActiveObjectsViewModel.cs](file://ClassicAssist/ViewModels/ActiveObjectsViewModel.cs)
|
||||
|
||||
## Detailed Component Analysis
|
||||
|
||||
### Object Inspector
|
||||
Purpose:
|
||||
- Real-time inspection of game entities and their properties
|
||||
- Filtering and sorting for large datasets
|
||||
- Data exposure for memory analysis workflows
|
||||
|
||||
Key elements:
|
||||
- View: ObjectInspectorWindow (Avalonia XAML and code-behind)
|
||||
- ViewModel: ObjectInspectorViewModel (shared)
|
||||
- Model: ObjectInspectorData (shared)
|
||||
- Supporting ViewModels: EntityCollectionViewerViewModel, ActiveObjectsViewModel
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
class ObjectInspectorWindow {
|
||||
+InitializeComponent()
|
||||
+OnLoaded()
|
||||
}
|
||||
class ObjectInspectorViewModel {
|
||||
+SelectedEntity
|
||||
+Properties
|
||||
+FilterText
|
||||
+SortMode
|
||||
+Refresh()
|
||||
+ApplyFilter()
|
||||
}
|
||||
class ObjectInspectorData {
|
||||
+Name
|
||||
+Type
|
||||
+Properties
|
||||
}
|
||||
class EntityCollectionViewerViewModel {
|
||||
+Entities
|
||||
+Filter
|
||||
+SortStyle
|
||||
}
|
||||
class ActiveObjectsViewModel {
|
||||
+ActiveList
|
||||
+SelectItem()
|
||||
}
|
||||
ObjectInspectorWindow --> ObjectInspectorViewModel : "binds to"
|
||||
ObjectInspectorViewModel --> ObjectInspectorData : "produces"
|
||||
ObjectInspectorViewModel --> EntityCollectionViewerViewModel : "uses"
|
||||
ObjectInspectorViewModel --> ActiveObjectsViewModel : "uses"
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [ObjectInspectorWindow.axaml](file://ClassicAssist.Avalonia/Views/ObjectInspectorWindow.axaml)
|
||||
- [ObjectInspectorWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/ObjectInspectorWindow.axaml.cs)
|
||||
- [ObjectInspectorViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/ObjectInspectorViewModel.cs)
|
||||
- [ObjectInspectorData.cs](file://ClassicAssist.Shared/UI/Models/ObjectInspectorData.cs)
|
||||
- [EntityCollectionViewerViewModel.cs](file://ClassicAssist/ViewModels/EntityCollectionViewerViewModel.cs)
|
||||
- [ActiveObjectsViewModel.cs](file://ClassicAssist/ViewModels/ActiveObjectsViewModel.cs)
|
||||
|
||||
Usage tips:
|
||||
- Use filters to narrow down entities by name or type
|
||||
- Sort by common attributes to locate recently updated objects
|
||||
- Inspect nested properties to understand state changes over time
|
||||
|
||||
**Section sources**
|
||||
- [ObjectInspectorWindow.axaml](file://ClassicAssist.Avalonia/Views/ObjectInspectorWindow.axaml)
|
||||
- [ObjectInspectorWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/ObjectInspectorWindow.axaml.cs)
|
||||
- [ObjectInspectorViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/ObjectInspectorViewModel.cs)
|
||||
- [ObjectInspectorData.cs](file://ClassicAssist.Shared/UI/Models/ObjectInspectorData.cs)
|
||||
- [EntityCollectionViewerViewModel.cs](file://ClassicAssist/ViewModels/EntityCollectionViewerViewModel.cs)
|
||||
- [ActiveObjectsViewModel.cs](file://ClassicAssist/ViewModels/ActiveObjectsViewModel.cs)
|
||||
|
||||
### Packet Logger and Replay System
|
||||
Purpose:
|
||||
- Capture and analyze incoming/outgoing network traffic
|
||||
- Apply custom filters to isolate relevant packets
|
||||
- Replay captured sessions for testing and debugging
|
||||
|
||||
Key elements:
|
||||
- UI model: PacketEntry (shared)
|
||||
- Filters: IncomingPacketFilters, OutgoingPacketFilters
|
||||
- Filter engine: PacketFilter, PacketFilterCondition, PacketFilterConditions, PacketFilterInfo
|
||||
- Wait entries: PacketWaitEntries, PacketWaitEntry
|
||||
- Handlers: IncomingPacketHandlers, OutgoingPacketHandlers
|
||||
- Replay: ReplayPacketLog (tests)
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
Start(["Packet Arrives"]) --> Classify["Classify Direction<br/>Incoming/Outgoing"]
|
||||
Classify --> ApplyFilters{"Apply Filters?"}
|
||||
ApplyFilters --> |No| Drop["Drop Packet"]
|
||||
ApplyFilters --> |Yes| Log["Create PacketEntry"]
|
||||
Log --> UpdateUI["Update UI Models"]
|
||||
UpdateUI --> WaitCheck{"Any Wait Entries?"}
|
||||
WaitCheck --> |Yes| ResolveWait["Resolve PacketWaitEntry"]
|
||||
WaitCheck --> |No| End(["End"])
|
||||
ResolveWait --> End
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [PacketEntry.cs](file://ClassicAssist.Shared/UI/Misc/PacketEntry.cs)
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
- [PacketFilter.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilter.cs)
|
||||
- [PacketFilterCondition.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterCondition.cs)
|
||||
- [PacketFilterConditions.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterConditions.cs)
|
||||
- [PacketFilterInfo.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterInfo.cs)
|
||||
- [PacketWaitEntries.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntries.cs)
|
||||
- [PacketWaitEntry.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntry.cs)
|
||||
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
|
||||
- [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs)
|
||||
- [ReplayPacketLog.cs](file://ClassicAssist.Tests/ReplayPacketLog.cs)
|
||||
|
||||
Custom filter creation:
|
||||
- Implement conditions using the filter condition types
|
||||
- Register filters through the incoming/outgoing filter managers
|
||||
- Use PacketFilterInfo to describe metadata and enable/disable filters at runtime
|
||||
|
||||
Replay workflow:
|
||||
- ReplayPacketLog drives packet handlers to re-execute recorded sessions
|
||||
- Useful for reproducing issues deterministically
|
||||
|
||||
**Section sources**
|
||||
- [PacketEntry.cs](file://ClassicAssist.Shared/UI/Misc/PacketEntry.cs)
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
- [PacketFilter.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilter.cs)
|
||||
- [PacketFilterCondition.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterCondition.cs)
|
||||
- [PacketFilterConditions.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterConditions.cs)
|
||||
- [PacketFilterInfo.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterInfo.cs)
|
||||
- [PacketWaitEntries.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntries.cs)
|
||||
- [PacketWaitEntry.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntry.cs)
|
||||
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
|
||||
- [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs)
|
||||
- [ReplayPacketLog.cs](file://ClassicAssist.Tests/ReplayPacketLog.cs)
|
||||
|
||||
### GIF Recorder
|
||||
Purpose:
|
||||
- Record gameplay to GIF files
|
||||
- Configure quality and export settings
|
||||
- Accessible via hotkeys for quick capture
|
||||
|
||||
Key elements:
|
||||
- View: GIFRecorderWindow (XAML and code-behind)
|
||||
- ViewModel: GIFRecorderViewModel
|
||||
- Hotkey command: ShowGIFCaptureWindow
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant Dev as "Developer"
|
||||
participant HK as "ShowGIFCaptureWindow"
|
||||
participant Win as "GIFRecorderWindow"
|
||||
participant VM as "GIFRecorderViewModel"
|
||||
Dev->>HK : Trigger hotkey
|
||||
HK->>Win : Open recorder window
|
||||
Win->>VM : Initialize recording settings
|
||||
Dev->>VM : Start/Stop recording
|
||||
VM-->>Dev : Export GIF with configured quality
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [ShowGIFCaptureWindow.cs](file://ClassicAssist/Data/Hotkeys/Commands/ShowGIFCaptureWindow.cs)
|
||||
- [GIFRecorderWindow.xaml](file://ClassicAssist/Views/GIFRecorderWindow.xaml)
|
||||
- [GIFRecorderWindow.xaml.cs](file://ClassicAssist/Views/GIFRecorderWindow.xaml.cs)
|
||||
- [GIFRecorderViewModel.cs](file://ClassicAssist/ViewModels/GIFRecorderViewModel.cs)
|
||||
|
||||
Quality and export guidance:
|
||||
- Adjust frame rate and compression to balance file size vs. smoothness
|
||||
- Prefer lower resolutions for long recordings
|
||||
- Use targeted captures around specific events to reduce overhead
|
||||
|
||||
**Section sources**
|
||||
- [ShowGIFCaptureWindow.cs](file://ClassicAssist/Data/Hotkeys/Commands/ShowGIFCaptureWindow.cs)
|
||||
- [GIFRecorderWindow.xaml](file://ClassicAssist/Views/GIFRecorderWindow.xaml)
|
||||
- [GIFRecorderWindow.xaml.cs](file://ClassicAssist/Views/GIFRecorderWindow.xaml.cs)
|
||||
- [GIFRecorderViewModel.cs](file://ClassicAssist/ViewModels/GIFRecorderViewModel.cs)
|
||||
|
||||
### Debug Window
|
||||
Purpose:
|
||||
- Display console output and logs
|
||||
- Provide diagnostic information for rapid troubleshooting
|
||||
|
||||
Key elements:
|
||||
- View: DebugWindow (Avalonia XAML and code-behind)
|
||||
- ViewModel: DebugViewModel (shared)
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
class DebugWindow {
|
||||
+InitializeComponent()
|
||||
+OnLoaded()
|
||||
}
|
||||
class DebugViewModel {
|
||||
+Logs
|
||||
+ConsoleOutput
|
||||
+ClearLogs()
|
||||
+AppendLog(message)
|
||||
}
|
||||
DebugWindow --> DebugViewModel : "binds to"
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [DebugWindow.axaml](file://ClassicAssist.Avalonia/Views/DebugWindow.axaml)
|
||||
- [DebugWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/DebugWindow.axaml.cs)
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
|
||||
Best practices:
|
||||
- Use structured log messages with severity levels
|
||||
- Clear logs periodically to avoid UI lag
|
||||
- Correlate timestamps with packet logs and GIF captures
|
||||
|
||||
**Section sources**
|
||||
- [DebugWindow.axaml](file://ClassicAssist.Avalonia/Views/DebugWindow.axaml)
|
||||
- [DebugWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/DebugWindow.axaml.cs)
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
|
||||
### Hex Dump Utilities
|
||||
Purpose:
|
||||
- Inspect raw binary data
|
||||
- Analyze protocol payloads and packet contents
|
||||
|
||||
Key elements:
|
||||
- Control: HexDumpControl (Avalonia XAML and code-behind)
|
||||
- Data model: PacketEntry (shared)
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
class HexDumpControl {
|
||||
+Render(bytes)
|
||||
+SetHighlight(range)
|
||||
}
|
||||
class PacketEntry {
|
||||
+RawBytes
|
||||
+Direction
|
||||
+Timestamp
|
||||
}
|
||||
HexDumpControl --> PacketEntry : "displays"
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [HexDumpControl.axaml](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml)
|
||||
- [HexDumpControl.axaml.cs](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml.cs)
|
||||
- [PacketEntry.cs](file://ClassicAssist.Shared/UI/Misc/PacketEntry.cs)
|
||||
|
||||
Tips:
|
||||
- Highlight known header fields to speed up protocol analysis
|
||||
- Combine with packet filters to focus on specific opcodes or ranges
|
||||
|
||||
**Section sources**
|
||||
- [HexDumpControl.axaml](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml)
|
||||
- [HexDumpControl.axaml.cs](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml.cs)
|
||||
- [PacketEntry.cs](file://ClassicAssist.Shared/UI/Misc/PacketEntry.cs)
|
||||
|
||||
## Dependency Analysis
|
||||
The following diagram maps dependencies between UI components, shared models, and networking core.
|
||||
|
||||
```mermaid
|
||||
graph LR
|
||||
OIWin["ObjectInspectorWindow"] --> OIVM["ObjectInspectorViewModel"]
|
||||
OIVM --> ECV["EntityCollectionViewerViewModel"]
|
||||
OIVM --> AOV["ActiveObjectsViewModel"]
|
||||
DW["DebugWindow"] --> DVM["DebugViewModel"]
|
||||
HD["HexDumpControl"] --> PE["PacketEntry"]
|
||||
IPF["IncomingPacketFilters"] --> PF["PacketFilter"]
|
||||
OPF["OutgoingPacketFilters"] --> PF
|
||||
PF --> PFC["PacketFilterCondition"]
|
||||
PF --> PFCs["PacketFilterConditions"]
|
||||
PF --> PFI["PacketFilterInfo"]
|
||||
PF --> PWE["PacketWaitEntries"]
|
||||
PWE --> PWEt["PacketWaitEntry"]
|
||||
RPL["ReplayPacketLog"] --> IPH["IncomingPacketHandlers"]
|
||||
RPL --> OPH["OutgoingPacketHandlers"]
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [ObjectInspectorWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/ObjectInspectorWindow.axaml.cs)
|
||||
- [ObjectInspectorViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/ObjectInspectorViewModel.cs)
|
||||
- [EntityCollectionViewerViewModel.cs](file://ClassicAssist/ViewModels/EntityCollectionViewerViewModel.cs)
|
||||
- [ActiveObjectsViewModel.cs](file://ClassicAssist/ViewModels/ActiveObjectsViewModel.cs)
|
||||
- [DebugWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/DebugWindow.axaml.cs)
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
- [HexDumpControl.axaml.cs](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml.cs)
|
||||
- [PacketEntry.cs](file://ClassicAssist.Shared/UI/Misc/PacketEntry.cs)
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
- [PacketFilter.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilter.cs)
|
||||
- [PacketFilterCondition.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterCondition.cs)
|
||||
- [PacketFilterConditions.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterConditions.cs)
|
||||
- [PacketFilterInfo.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterInfo.cs)
|
||||
- [PacketWaitEntries.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntries.cs)
|
||||
- [PacketWaitEntry.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntry.cs)
|
||||
- [ReplayPacketLog.cs](file://ClassicAssist.Tests/ReplayPacketLog.cs)
|
||||
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
|
||||
- [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs)
|
||||
|
||||
**Section sources**
|
||||
- [ObjectInspectorViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/ObjectInspectorViewModel.cs)
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
- [PacketEntry.cs](file://ClassicAssist.Shared/UI/Misc/PacketEntry.cs)
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
- [PacketFilter.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilter.cs)
|
||||
- [PacketFilterCondition.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterCondition.cs)
|
||||
- [PacketFilterConditions.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterConditions.cs)
|
||||
- [PacketFilterInfo.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterInfo.cs)
|
||||
- [PacketWaitEntries.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntries.cs)
|
||||
- [PacketWaitEntry.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntry.cs)
|
||||
- [ReplayPacketLog.cs](file://ClassicAssist.Tests/ReplayPacketLog.cs)
|
||||
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
|
||||
- [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs)
|
||||
|
||||
## Performance Considerations
|
||||
- Object Inspector:
|
||||
- Use incremental refresh and virtualization-friendly bindings to keep UI responsive with large entity sets
|
||||
- Debounce filter input to avoid excessive recomputation
|
||||
- Packet Logger:
|
||||
- Limit logged packets with precise filters; avoid logging every packet when not needed
|
||||
- Batch UI updates to prevent frame drops during heavy traffic
|
||||
- GIF Recorder:
|
||||
- Lower frame rates and resolution for long recordings
|
||||
- Avoid capturing while performing CPU-intensive tasks
|
||||
- Debug Window:
|
||||
- Periodically clear logs to prevent memory growth
|
||||
- Use asynchronous append operations to avoid blocking UI thread
|
||||
- Hex Dump:
|
||||
- Render only visible portions of large buffers
|
||||
- Avoid frequent full redraws; use diff-based updates where possible
|
||||
|
||||
[No sources needed since this section provides general guidance]
|
||||
|
||||
## Troubleshooting Guide
|
||||
Common issues and remedies:
|
||||
- Object Inspector appears unresponsive:
|
||||
- Ensure filters are not overly broad; refine search criteria
|
||||
- Check that collection ViewModels are updating on the correct dispatcher
|
||||
- Packet Logger misses packets:
|
||||
- Verify filters are enabled and conditions match expected opcodes
|
||||
- Confirm handlers are registered and not dropping packets prematurely
|
||||
- GIF Recorder produces low-quality output:
|
||||
- Increase frame rate and adjust compression settings
|
||||
- Reduce scene complexity during capture
|
||||
- Debug Window slows down:
|
||||
- Clear logs regularly and avoid appending extremely large messages
|
||||
- Hex Dump flickers or lags:
|
||||
- Limit buffer sizes shown and avoid constant full refreshes
|
||||
|
||||
**Section sources**
|
||||
- [ObjectInspectorViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/ObjectInspectorViewModel.cs)
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
- [GIFRecorderViewModel.cs](file://ClassicAssist/ViewModels/GIFRecorderViewModel.cs)
|
||||
- [DebugViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/DebugViewModel.cs)
|
||||
- [HexDumpControl.axaml.cs](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml.cs)
|
||||
|
||||
## Conclusion
|
||||
ClassicAssist.Avalonia’s development and debugging toolkit provides powerful capabilities for inspecting game state, analyzing network traffic, recording gameplay, and diagnosing issues quickly. By combining the Object Inspector, Packet Logger with custom filters and replay, GIF Recorder with tunable quality, Debug Window for logs, and Hex Dump for binary analysis, developers can efficiently troubleshoot and optimize their applications. Adopting the performance and troubleshooting recommendations will help maintain responsiveness and reliability during intensive development cycles.
|
||||
@@ -0,0 +1,277 @@
|
||||
# GIF Recorder
|
||||
|
||||
<cite>
|
||||
**Referenced Files in This Document**
|
||||
- [GIFRecorderWindow.xaml](file://ClassicAssist/UI/Views/GIFRecorderWindow.xaml)
|
||||
- [GIFRecorderWindow.xaml.cs](file://ClassicAssist/UI/Views/GIFRecorderWindow.xaml.cs)
|
||||
- [GIFRecorderViewModel.cs](file://ClassicAssist/UI/ViewModels/GIFRecorderViewModel.cs)
|
||||
- [ShowGIFCaptureWindow.cs](file://ClassicAssist/Data/Hotkeys/Commands/ShowGIFCaptureWindow.cs)
|
||||
</cite>
|
||||
|
||||
## Table of Contents
|
||||
1. [Introduction](#introduction)
|
||||
2. [Project Structure](#project-structure)
|
||||
3. [Core Components](#core-components)
|
||||
4. [Architecture Overview](#architecture-overview)
|
||||
5. [Detailed Component Analysis](#detailed-component-analysis)
|
||||
6. [Dependency Analysis](#dependency-analysis)
|
||||
7. [Performance Considerations](#performance-considerations)
|
||||
8. [Troubleshooting Guide](#troubleshooting-guide)
|
||||
9. [Conclusion](#conclusion)
|
||||
10. [Appendices](#appendices)
|
||||
|
||||
## Introduction
|
||||
This document explains the GIF Recorder tool integrated into ClassicAssist.Avalonia. It covers gameplay recording capabilities, animation export options, quality settings configuration, the recording interface, frame rate controls, and output format specifications. It also documents integration with hotkey commands for start/stop recording functionality, provides examples for recording different types of gameplay content, guidance on optimizing file sizes, exporting animations for tutorials or bug reports, performance considerations during recording, storage management, and best practices for using recorded GIFs in documentation, testing, and community sharing.
|
||||
|
||||
## Project Structure
|
||||
The GIF Recorder feature is implemented as a dedicated window with its view model and is accessible via a hotkey command. The key files are:
|
||||
- View (XAML): Defines the user interface for recording controls and preview.
|
||||
- Code-behind: Wires UI events to the view model and manages window lifecycle.
|
||||
- View Model: Holds recording state, settings, and exposes commands to the UI.
|
||||
- Hotkey Command: Provides keyboard shortcuts to open the recorder and control recording.
|
||||
|
||||
```mermaid
|
||||
graph TB
|
||||
subgraph "UI Layer"
|
||||
XAML["GIFRecorderWindow.xaml"]
|
||||
CodeBehind["GIFRecorderWindow.xaml.cs"]
|
||||
VM["GIFRecorderViewModel.cs"]
|
||||
end
|
||||
subgraph "Hotkeys"
|
||||
HKCmd["ShowGIFCaptureWindow.cs"]
|
||||
end
|
||||
HKCmd --> VM
|
||||
XAML --> CodeBehind
|
||||
CodeBehind --> VM
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [GIFRecorderWindow.xaml](file://ClassicAssist/UI/Views/GIFRecorderWindow.xaml)
|
||||
- [GIFRecorderWindow.xaml.cs](file://ClassicAssist/UI/Views/GIFRecorderWindow.xaml.cs)
|
||||
- [GIFRecorderViewModel.cs](file://ClassicAssist/UI/ViewModels/GIFRecorderViewModel.cs)
|
||||
- [ShowGIFCaptureWindow.cs](file://ClassicAssist/Data/Hotkeys/Commands/ShowGIFCaptureWindow.cs)
|
||||
|
||||
**Section sources**
|
||||
- [GIFRecorderWindow.xaml](file://ClassicAssist/UI/Views/GIFRecorderWindow.xaml)
|
||||
- [GIFRecorderWindow.xaml.cs](file://ClassicAssist/UI/Views/GIFRecorderWindow.xaml.cs)
|
||||
- [GIFRecorderViewModel.cs](file://ClassicAssist/UI/ViewModels/GIFRecorderViewModel.cs)
|
||||
- [ShowGIFCaptureWindow.cs](file://ClassicAssist/Data/Hotkeys/Commands/ShowGIFCaptureWindow.cs)
|
||||
|
||||
## Core Components
|
||||
- GIFRecorderWindow (View): Presents recording controls such as start/stop, frame rate selection, quality settings, and output path. It binds to the view model for live updates and previews.
|
||||
- GIFRecorderViewModel (ViewModel): Manages recording state (idle, capturing, stopped), holds configuration (frame rate, quality, output directory), and exposes commands for starting/stopping recording and saving exports.
|
||||
- ShowGIFCaptureWindow (Hotkey Command): Registers a hotkey that opens the GIF Recorder window, enabling quick access without navigating menus.
|
||||
|
||||
Key responsibilities:
|
||||
- Recording lifecycle: Start capture, stop capture, finalize output.
|
||||
- Settings persistence: Save and load frame rate, quality, and output location.
|
||||
- UI binding: Update status indicators, enable/disable controls based on state.
|
||||
- Hotkey integration: Open the recorder window from anywhere in the application.
|
||||
|
||||
**Section sources**
|
||||
- [GIFRecorderWindow.xaml](file://ClassicAssist/UI/Views/GIFRecorderWindow.xaml)
|
||||
- [GIFRecorderWindow.xaml.cs](file://ClassicAssist/UI/Views/GIFRecorderWindow.xaml.cs)
|
||||
- [GIFRecorderViewModel.cs](file://ClassicAssist/UI/ViewModels/GIFRecorderViewModel.cs)
|
||||
- [ShowGIFCaptureWindow.cs](file://ClassicAssist/Data/Hotkeys/Commands/ShowGIFCaptureWindow.cs)
|
||||
|
||||
## Architecture Overview
|
||||
The GIF Recorder follows a standard MVVM pattern with a hotkey entry point:
|
||||
- Hotkey Command triggers opening the recorder window.
|
||||
- The Window’s code-behind initializes bindings and delegates actions to the ViewModel.
|
||||
- The ViewModel orchestrates recording logic and persists settings.
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant User as "User"
|
||||
participant Hotkey as "ShowGIFCaptureWindow.cs"
|
||||
participant Window as "GIFRecorderWindow.xaml.cs"
|
||||
participant VM as "GIFRecorderViewModel.cs"
|
||||
participant UI as "GIFRecorderWindow.xaml"
|
||||
User->>Hotkey : Press configured hotkey
|
||||
Hotkey->>Window : Open GIF Recorder Window
|
||||
Window->>VM : Initialize bindings and state
|
||||
User->>UI : Click "Start Recording"
|
||||
UI->>VM : Invoke StartRecording()
|
||||
VM-->>UI : Update status and controls
|
||||
User->>UI : Click "Stop Recording"
|
||||
UI->>VM : Invoke StopRecording()
|
||||
VM-->>UI : Finalize output and show save dialog
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [ShowGIFCaptureWindow.cs](file://ClassicAssist/Data/Hotkeys/Commands/ShowGIFCaptureWindow.cs)
|
||||
- [GIFRecorderWindow.xaml.cs](file://ClassicAssist/UI/Views/GIFRecorderWindow.xaml.cs)
|
||||
- [GIFRecorderViewModel.cs](file://ClassicAssist/UI/ViewModels/GIFRecorderViewModel.cs)
|
||||
- [GIFRecorderWindow.xaml](file://ClassicAssist/UI/Views/GIFRecorderWindow.xaml)
|
||||
|
||||
## Detailed Component Analysis
|
||||
|
||||
### GIFRecorderWindow (View)
|
||||
Responsibilities:
|
||||
- Define layout for recording controls (start/stop buttons, frame rate dropdown, quality slider/dropdown, output path selector).
|
||||
- Bind UI elements to properties and commands in the ViewModel.
|
||||
- Display real-time status (recording indicator, elapsed time, progress).
|
||||
|
||||
Common UI interactions:
|
||||
- Start/Stop toggles update ViewModel state.
|
||||
- Frame rate and quality changes immediately affect subsequent frames.
|
||||
- Output path selection determines where GIF files are saved.
|
||||
|
||||
Best practices:
|
||||
- Keep UI responsive by delegating heavy work to background tasks in the ViewModel.
|
||||
- Provide clear feedback when recording starts/stops.
|
||||
|
||||
**Section sources**
|
||||
- [GIFRecorderWindow.xaml](file://ClassicAssist/UI/Views/GIFRecorderWindow.xaml)
|
||||
- [GIFRecorderWindow.xaml.cs](file://ClassicAssist/UI/Views/GIFRecorderWindow.xaml.cs)
|
||||
|
||||
### GIFRecorderViewModel (ViewModel)
|
||||
Responsibilities:
|
||||
- Maintain recording state (Idle, Capturing, Stopped).
|
||||
- Expose properties for frame rate, quality, and output directory.
|
||||
- Implement commands for StartRecording and StopRecording.
|
||||
- Handle file I/O for saving GIF outputs.
|
||||
- Persist settings across sessions if applicable.
|
||||
|
||||
Data flow:
|
||||
- UI commands invoke ViewModel methods.
|
||||
- ViewModel updates bound properties to reflect state changes.
|
||||
- On stop, ViewModel writes frames to an animated GIF at the selected path.
|
||||
|
||||
Error handling:
|
||||
- Validate output path permissions.
|
||||
- Handle disk full or write errors gracefully.
|
||||
- Notify the user via UI-bound messages.
|
||||
|
||||
Optimization hooks:
|
||||
- Adjust frame rate to balance smoothness vs. file size.
|
||||
- Reduce color palette or dimensions for smaller files.
|
||||
|
||||
**Section sources**
|
||||
- [GIFRecorderViewModel.cs](file://ClassicAssist/UI/ViewModels/GIFRecorderViewModel.cs)
|
||||
|
||||
### ShowGIFCaptureWindow (Hotkey Command)
|
||||
Responsibilities:
|
||||
- Register a global or application-level hotkey.
|
||||
- When triggered, open the GIF Recorder window.
|
||||
- Ensure thread safety when invoking UI operations.
|
||||
|
||||
Integration notes:
|
||||
- The command should not interfere with game input.
|
||||
- Provide a default hotkey that can be remapped in hotkey settings.
|
||||
|
||||
**Section sources**
|
||||
- [ShowGIFCaptureWindow.cs](file://ClassicAssist/Data/Hotkeys/Commands/ShowGIFCaptureWindow.cs)
|
||||
|
||||
### Class Diagram
|
||||
```mermaid
|
||||
classDiagram
|
||||
class GIFRecorderViewModel {
|
||||
+string Status
|
||||
+bool IsRecording
|
||||
+int FrameRate
|
||||
+string Quality
|
||||
+string OutputPath
|
||||
+StartRecording()
|
||||
+StopRecording()
|
||||
+SaveSettings()
|
||||
+LoadSettings()
|
||||
}
|
||||
class GIFRecorderWindow {
|
||||
+InitializeBindings()
|
||||
+OnStartClicked()
|
||||
+OnStopClicked()
|
||||
}
|
||||
class ShowGIFCaptureWindow {
|
||||
+RegisterHotkey()
|
||||
+OpenRecorderWindow()
|
||||
}
|
||||
GIFRecorderWindow --> GIFRecorderViewModel : "binds to"
|
||||
ShowGIFCaptureWindow --> GIFRecorderWindow : "opens"
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [GIFRecorderViewModel.cs](file://ClassicAssist/UI/ViewModels/GIFRecorderViewModel.cs)
|
||||
- [GIFRecorderWindow.xaml.cs](file://ClassicAssist/UI/Views/GIFRecorderWindow.xaml.cs)
|
||||
- [ShowGIFCaptureWindow.cs](file://ClassicAssist/Data/Hotkeys/Commands/ShowGIFCaptureWindow.cs)
|
||||
|
||||
## Dependency Analysis
|
||||
- The hotkey command depends on the window to open the UI.
|
||||
- The window depends on the view model for behavior and state.
|
||||
- The view model may depend on file system APIs for saving GIFs and possibly on configuration services for persisting settings.
|
||||
|
||||
```mermaid
|
||||
graph LR
|
||||
HK["ShowGIFCaptureWindow.cs"] --> Win["GIFRecorderWindow.xaml.cs"]
|
||||
Win --> VM["GIFRecorderViewModel.cs"]
|
||||
VM --> FS["File System / Storage"]
|
||||
VM --> CFG["Configuration / Options"]
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [ShowGIFCaptureWindow.cs](file://ClassicAssist/Data/Hotkeys/Commands/ShowGIFCaptureWindow.cs)
|
||||
- [GIFRecorderWindow.xaml.cs](file://ClassicAssist/UI/Views/GIFRecorderWindow.xaml.cs)
|
||||
- [GIFRecorderViewModel.cs](file://ClassicAssist/UI/ViewModels/GIFRecorderViewModel.cs)
|
||||
|
||||
**Section sources**
|
||||
- [ShowGIFCaptureWindow.cs](file://ClassicAssist/Data/Hotkeys/Commands/ShowGIFCaptureWindow.cs)
|
||||
- [GIFRecorderWindow.xaml.cs](file://ClassicAssist/UI/Views/GIFRecorderWindow.xaml.cs)
|
||||
- [GIFRecorderViewModel.cs](file://ClassicAssist/UI/ViewModels/GIFRecorderViewModel.cs)
|
||||
|
||||
## Performance Considerations
|
||||
- Frame Rate: Lower frame rates reduce CPU usage and file size but may appear choppy. Choose a balance appropriate for the content type.
|
||||
- Quality Settings: Reducing color depth or resolution significantly decreases file size; consider these for long recordings.
|
||||
- Threading: Perform encoding and file I/O off the UI thread to keep the interface responsive.
|
||||
- Memory Management: Avoid retaining large buffers; process frames incrementally and release resources promptly.
|
||||
- Disk I/O: Use buffered writes and ensure sufficient free space; monitor disk usage to prevent interruptions.
|
||||
|
||||
[No sources needed since this section provides general guidance]
|
||||
|
||||
## Troubleshooting Guide
|
||||
Common issues and resolutions:
|
||||
- Hotkey does not open the recorder: Verify the hotkey registration and ensure no conflicts with other inputs. Check the command’s activation path.
|
||||
- Recording fails to start: Confirm the output path is writable and has enough space. Validate that the UI is bound correctly to the ViewModel.
|
||||
- Large file sizes: Reduce frame rate and quality settings; consider shorter clips or cropping the capture area.
|
||||
- Corrupted GIF output: Ensure the encoder completes writing all frames and flushes buffers before closing the file.
|
||||
|
||||
Operational checks:
|
||||
- Inspect ViewModel state transitions (Idle -> Capturing -> Stopped).
|
||||
- Validate UI bindings for Start/Stop commands and property updates.
|
||||
- Review error notifications and logs for file system exceptions.
|
||||
|
||||
**Section sources**
|
||||
- [GIFRecorderViewModel.cs](file://ClassicAssist/UI/ViewModels/GIFRecorderViewModel.cs)
|
||||
- [GIFRecorderWindow.xaml.cs](file://ClassicAssist/UI/Views/GIFRecorderWindow.xaml.cs)
|
||||
- [ShowGIFCaptureWindow.cs](file://ClassicAssist/Data/Hotkeys/Commands/ShowGIFCaptureWindow.cs)
|
||||
|
||||
## Conclusion
|
||||
The GIF Recorder integrates seamlessly with ClassicAssist.Avalonia through a clean MVVM architecture and a convenient hotkey entry point. By tuning frame rate and quality settings, users can optimize recordings for various use cases—from concise bug reports to detailed tutorials. Proper performance practices and storage management ensure reliable operation even during extended sessions.
|
||||
|
||||
[No sources needed since this section summarizes without analyzing specific files]
|
||||
|
||||
## Appendices
|
||||
|
||||
### Recording Interface Controls
|
||||
- Start/Stop: Toggle recording session.
|
||||
- Frame Rate: Select desired FPS for smoothness vs. size trade-off.
|
||||
- Quality: Adjust color depth/resolution to manage file size.
|
||||
- Output Path: Choose destination directory for saved GIFs.
|
||||
|
||||
**Section sources**
|
||||
- [GIFRecorderWindow.xaml](file://ClassicAssist/UI/Views/GIFRecorderWindow.xaml)
|
||||
- [GIFRecorderViewModel.cs](file://ClassicAssist/UI/ViewModels/GIFRecorderViewModel.cs)
|
||||
|
||||
### Hotkey Integration Examples
|
||||
- Default hotkey opens the recorder window instantly.
|
||||
- Remap the hotkey in hotkey settings to avoid conflicts.
|
||||
- Combine with in-game macros to automate repetitive recording tasks.
|
||||
|
||||
**Section sources**
|
||||
- [ShowGIFCaptureWindow.cs](file://ClassicAssist/Data/Hotkeys/Commands/ShowGIFCaptureWindow.cs)
|
||||
|
||||
### Export and Usage Guidance
|
||||
- Tutorials: Use moderate frame rates and higher quality for clarity.
|
||||
- Bug Reports: Short clips with reduced quality to minimize upload size.
|
||||
- Community Sharing: Balance quality and size; include descriptive filenames and timestamps.
|
||||
|
||||
[No sources needed since this section provides general guidance]
|
||||
@@ -0,0 +1,400 @@
|
||||
# Object Inspector
|
||||
|
||||
<cite>
|
||||
**Referenced Files in This Document**
|
||||
- [ObjectInspectorWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/ObjectInspectorWindow.axaml.cs)
|
||||
- [ObjectInspectorViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/ObjectInspectorViewModel.cs)
|
||||
- [ObjectInspectorData.cs](file://ClassicAssist.Shared/UI/Models/ObjectInspectorData.cs)
|
||||
- [ObjectInspector.cs](file://ClassicAssist/Data/Hotkeys/Commands/ObjectInspector.cs)
|
||||
- [Entity.cs](file://ClassicAssist.Shared/UO/Objects/Entity.cs)
|
||||
- [Mobile.cs](file://ClassicAssist.Shared/UO/Objects/Mobile.cs)
|
||||
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
|
||||
- [Gump.cs](file://ClassicAssist.Shared/UO/Objects/Gumps/Gump.cs)
|
||||
- [Property.cs](file://ClassicAssist.Shared/UO/Objects/Property.cs)
|
||||
</cite>
|
||||
|
||||
## Table of Contents
|
||||
1. [Introduction](#introduction)
|
||||
2. [Project Structure](#project-structure)
|
||||
3. [Core Components](#core-components)
|
||||
4. [Architecture Overview](#architecture-overview)
|
||||
5. [Detailed Component Analysis](#detailed-component-analysis)
|
||||
6. [Entity Types and Inspection](#entity-types-and-inspection)
|
||||
7. [Hotkey Integration](#hotkey-integration)
|
||||
8. [Memory Analysis Features](#memory-analysis-features)
|
||||
9. [Performance Considerations](#performance-considerations)
|
||||
10. [Troubleshooting Guide](#troubleshooting-guide)
|
||||
11. [Conclusion](#conclusion)
|
||||
|
||||
## Introduction
|
||||
|
||||
The Object Inspector is a powerful debugging and analysis tool within ClassicAssist.Avalonia that provides real-time inspection capabilities for game objects. It enables developers and advanced users to examine the internal state, properties, and relationships of various entity types including Mobiles (characters), Items (objects), and Gumps (user interface elements). The tool offers hierarchical navigation through object trees, property filtering, memory analysis, and comprehensive attribute examination.
|
||||
|
||||
This documentation explains how to access and utilize the Object Inspector's features effectively during development and debugging sessions, covering everything from basic object inspection to advanced memory analysis techniques.
|
||||
|
||||
## Project Structure
|
||||
|
||||
The Object Inspector implementation follows a clean MVVM (Model-View-ViewModel) architecture pattern, separating concerns between the user interface, business logic, and data models:
|
||||
|
||||
```mermaid
|
||||
graph TB
|
||||
subgraph "UI Layer"
|
||||
OIW["ObjectInspectorWindow.axaml.cs"]
|
||||
OIXAML["ObjectInspectorWindow.axaml"]
|
||||
end
|
||||
subgraph "ViewModel Layer"
|
||||
OIVM["ObjectInspectorViewModel.cs"]
|
||||
end
|
||||
subgraph "Model Layer"
|
||||
OID["ObjectInspectorData.cs"]
|
||||
ENT["Entity.cs"]
|
||||
MOB["Mobile.cs"]
|
||||
ITM["Item.cs"]
|
||||
GMP["Gump.cs"]
|
||||
PROP["Property.cs"]
|
||||
end
|
||||
subgraph "Hotkey System"
|
||||
OHK["ObjectInspector.cs"]
|
||||
end
|
||||
OIW --> OIVM
|
||||
OIXAML --> OIVM
|
||||
OIVM --> OID
|
||||
OID --> ENT
|
||||
ENT --> MOB
|
||||
ENT --> ITM
|
||||
ENT --> GMP
|
||||
ENT --> PROP
|
||||
OHK --> OIW
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [ObjectInspectorWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/ObjectInspectorWindow.axaml.cs)
|
||||
- [ObjectInspectorViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/ObjectInspectorViewModel.cs)
|
||||
- [ObjectInspectorData.cs](file://ClassicAssist.Shared/UI/Models/ObjectInspectorData.cs)
|
||||
- [ObjectInspector.cs](file://ClassicAssist/Data/Hotkeys/Commands/ObjectInspector.cs)
|
||||
|
||||
**Section sources**
|
||||
- [ObjectInspectorWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/ObjectInspectorWindow.axaml.cs)
|
||||
- [ObjectInspectorViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/ObjectInspectorViewModel.cs)
|
||||
- [ObjectInspectorData.cs](file://ClassicAssist.Shared/UI/Models/ObjectInspectorData.cs)
|
||||
|
||||
## Core Components
|
||||
|
||||
### ObjectInspectorWindow
|
||||
The main window component that hosts the Object Inspector interface. It manages window lifecycle, layout, and user interactions while delegating business logic to the ViewModel layer.
|
||||
|
||||
### ObjectInspectorViewModel
|
||||
The central business logic component that orchestrates object inspection operations, manages data binding, handles filtering and sorting, and coordinates communication between the UI and underlying game engine.
|
||||
|
||||
### ObjectInspectorData
|
||||
The data model that represents inspected objects and their properties. It provides a structured representation of game entities suitable for display and manipulation in the inspector interface.
|
||||
|
||||
### Hotkey Command Integration
|
||||
The Object Inspector integrates with the hotkey system through a dedicated command class that allows quick access via keyboard shortcuts.
|
||||
|
||||
**Section sources**
|
||||
- [ObjectInspectorWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/ObjectInspectorWindow.axaml.cs)
|
||||
- [ObjectInspectorViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/ObjectInspectorViewModel.cs)
|
||||
- [ObjectInspectorData.cs](file://ClassicAssist.Shared/UI/Models/ObjectInspectorData.cs)
|
||||
- [ObjectInspector.cs](file://ClassicAssist/Data/Hotkeys/Commands/ObjectInspector.cs)
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
The Object Inspector implements a layered architecture that separates presentation, business logic, and data access concerns:
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant User as "User"
|
||||
participant Window as "ObjectInspectorWindow"
|
||||
participant VM as "ObjectInspectorViewModel"
|
||||
participant Engine as "Game Engine"
|
||||
participant Entities as "Entity Collections"
|
||||
User->>Window : Open Object Inspector
|
||||
Window->>VM : Initialize ViewModel
|
||||
VM->>Engine : Request Entity Data
|
||||
Engine->>Entities : Query Active Objects
|
||||
Entities-->>Engine : Return Entity Lists
|
||||
Engine-->>VM : Provide Entity Data
|
||||
VM->>VM : Process and Filter Data
|
||||
VM-->>Window : Bind Inspectable Objects
|
||||
Window-->>User : Display Object Hierarchy
|
||||
User->>Window : Select Object
|
||||
Window->>VM : Handle Selection Change
|
||||
VM->>Engine : Get Object Properties
|
||||
Engine-->>VM : Return Property Collection
|
||||
VM-->>Window : Update Property Grid
|
||||
Window-->>User : Show Object Details
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [ObjectInspectorWindow.axaml.cs](file://ClassicAssist.Avalonia/Views/ObjectInspectorWindow.axaml.cs)
|
||||
- [ObjectInspectorViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/ObjectInspectorViewModel.cs)
|
||||
- [Entity.cs](file://ClassicAssist.Shared/UO/Objects/Entity.cs)
|
||||
|
||||
## Detailed Component Analysis
|
||||
|
||||
### ObjectInspectorViewModel Architecture
|
||||
|
||||
The ViewModel serves as the central coordinator for all Object Inspector functionality:
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
class ObjectInspectorViewModel {
|
||||
+ObservableCollection~ObjectInspectorData~ SelectedObjects
|
||||
+string FilterText
|
||||
+bool IsFilteringEnabled
|
||||
+void RefreshObjects()
|
||||
+void ApplyFilter(string filter)
|
||||
+void ExpandNode(ObjectInspectorData node)
|
||||
+void CollapseNode(ObjectInspectorData node)
|
||||
+void ExportProperties(ObjectInspectorData obj)
|
||||
-IEnumerable~PropertyInfo~ GetInspectableProperties(object obj)
|
||||
-ObjectInspectorData CreateObjectWrapper(object entity)
|
||||
-bool MatchesFilter(ObjectInspectorData obj, string filter)
|
||||
}
|
||||
class ObjectInspectorData {
|
||||
+object TargetObject
|
||||
+string DisplayName
|
||||
+string ObjectType
|
||||
+ObservableCollection~ObjectInspectorData~ Children
|
||||
+ObservableCollection~PropertyInfo~ Properties
|
||||
+bool IsExpanded
|
||||
+bool HasChildren
|
||||
+void LoadProperties()
|
||||
+void LoadChildren()
|
||||
}
|
||||
class Entity {
|
||||
<<abstract>>
|
||||
+int Serial
|
||||
+string Name
|
||||
+int Hue
|
||||
+int X
|
||||
+int Y
|
||||
+int Z
|
||||
+Map Map
|
||||
}
|
||||
class Mobile {
|
||||
+int Body
|
||||
+int SkillCap
|
||||
+int Gold
|
||||
+bool IsDead
|
||||
+bool IsPlayer
|
||||
}
|
||||
class Item {
|
||||
+int Amount
|
||||
+int Weight
|
||||
+int Value
|
||||
+bool IsStackable
|
||||
+Container Parent
|
||||
}
|
||||
class Gump {
|
||||
+int Width
|
||||
+int Height
|
||||
+bool IsVisible
|
||||
+GumpElement[] Elements
|
||||
}
|
||||
ObjectInspectorViewModel --> ObjectInspectorData : creates
|
||||
ObjectInspectorData --> Entity : wraps
|
||||
Entity <|-- Mobile
|
||||
Entity <|-- Item
|
||||
Entity <|-- Gump
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [ObjectInspectorViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/ObjectInspectorViewModel.cs)
|
||||
- [ObjectInspectorData.cs](file://ClassicAssist.Shared/UI/Models/ObjectInspectorData.cs)
|
||||
- [Entity.cs](file://ClassicAssist.Shared/UO/Objects/Entity.cs)
|
||||
- [Mobile.cs](file://ClassicAssist.Shared/UO/Objects/Mobile.cs)
|
||||
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
|
||||
- [Gump.cs](file://ClassicAssist.Shared/UO/Objects/Gumps/Gump.cs)
|
||||
|
||||
### Property Reflection System
|
||||
|
||||
The Object Inspector uses reflection to dynamically discover and display object properties:
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
Start([Start Property Inspection]) --> GetObjectType["Get Object Type"]
|
||||
GetObjectType --> GetProperties["Get All Public Properties"]
|
||||
GetProperties --> FilterProperties{"Apply Filters?"}
|
||||
FilterProperties --> |Yes| ApplyFilters["Filter Based on Criteria"]
|
||||
FilterProperties --> |No| SkipFilters["Skip Filtering"]
|
||||
ApplyFilters --> ProcessProperties["Process Filtered Properties"]
|
||||
SkipFilters --> ProcessProperties
|
||||
ProcessProperties --> CreatePropertyInfo["Create PropertyInfo Objects"]
|
||||
CreatePropertyInfo --> AddToCollection["Add to Observable Collection"]
|
||||
AddToCollection --> End([Return Properties])
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [ObjectInspectorViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/ObjectInspectorViewModel.cs)
|
||||
- [Property.cs](file://ClassicAssist.Shared/UO/Objects/Property.cs)
|
||||
|
||||
**Section sources**
|
||||
- [ObjectInspectorViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/ObjectInspectorViewModel.cs)
|
||||
- [ObjectInspectorData.cs](file://ClassicAssist.Shared/UI/Models/ObjectInspectorData.cs)
|
||||
|
||||
## Entity Types and Inspection
|
||||
|
||||
### Mobile Objects
|
||||
Mobile objects represent living entities in the game world, including players, NPCs, and creatures. The Object Inspector provides detailed inspection of mobile-specific attributes:
|
||||
|
||||
- **Basic Attributes**: Serial number, name, hue, position (X, Y, Z coordinates), and map location
|
||||
- **Combat State**: Health, mana, stamina, combat status, and notoriety information
|
||||
- **Skills and Abilities**: Skill levels, special moves, and ability cooldowns
|
||||
- **Equipment**: Currently equipped items and inventory contents
|
||||
- **Status Effects**: Active buffs, debuffs, and condition states
|
||||
|
||||
### Item Objects
|
||||
Item objects represent physical and virtual items in the game world:
|
||||
|
||||
- **Physical Properties**: Weight, value, durability, and stack count
|
||||
- **Location Information**: Container hierarchy, position, and ownership
|
||||
- **Custom Properties**: Player-defined attributes and metadata
|
||||
- **Visual Attributes**: Hue, art ID, and visual effects
|
||||
- **Usage Properties**: Usability flags, required skills, and consumption behavior
|
||||
|
||||
### Gump Objects
|
||||
Gump objects represent user interface elements and interactive windows:
|
||||
|
||||
- **Layout Properties**: Position, size, and z-order
|
||||
- **Element Hierarchy**: Child elements, buttons, and text fields
|
||||
- **State Management**: Visibility, enabled/disabled states, and event handlers
|
||||
- **Content Properties**: Text content, images, and dynamic data binding
|
||||
|
||||
**Section sources**
|
||||
- [Mobile.cs](file://ClassicAssist.Shared/UO/Objects/Mobile.cs)
|
||||
- [Item.cs](file://ClassicAssist.Shared/UO/Objects/Item.cs)
|
||||
- [Gump.cs](file://ClassicAssist.Shared/UO/Objects/Gumps/Gump.cs)
|
||||
|
||||
## Hotkey Integration
|
||||
|
||||
The Object Inspector integrates seamlessly with ClassicAssist's hotkey system, allowing quick access through customizable keyboard shortcuts:
|
||||
|
||||
### Access Methods
|
||||
- **Default Hotkey**: Press the configured hotkey combination to toggle the Object Inspector window
|
||||
- **Command Line**: Use macro commands to programmatically open or control the inspector
|
||||
- **Menu Integration**: Access through the main application menu if configured
|
||||
|
||||
### Hotkey Configuration
|
||||
Users can customize the Object Inspector hotkey through the hotkey management interface:
|
||||
|
||||
1. Navigate to Settings → Hotkeys
|
||||
2. Search for "Object Inspector" in the command list
|
||||
3. Assign desired key combination
|
||||
4. Save configuration changes
|
||||
|
||||
### Programmatic Control
|
||||
The Object Inspector exposes command methods for automation and scripting:
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant Macro as "Macro Script"
|
||||
participant Commands as "Command Manager"
|
||||
participant Inspector as "Object Inspector"
|
||||
Macro->>Commands : Execute "OpenObjectInspector"
|
||||
Commands->>Inspector : Toggle Window State
|
||||
Inspector->>Inspector : Refresh Current View
|
||||
Inspector-->>Macro : Operation Complete
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [ObjectInspector.cs](file://ClassicAssist/Data/Hotkeys/Commands/ObjectInspector.cs)
|
||||
|
||||
**Section sources**
|
||||
- [ObjectInspector.cs](file://ClassicAssist/Data/Hotkeys/Commands/ObjectInspector.cs)
|
||||
|
||||
## Memory Analysis Features
|
||||
|
||||
### Object Hierarchy Navigation
|
||||
The Object Inspector provides hierarchical navigation through complex object relationships:
|
||||
|
||||
- **Tree View**: Visual tree representation of parent-child relationships
|
||||
- **Breadcrumb Navigation**: Quick navigation path to current selection
|
||||
- **Search Functionality**: Find specific objects by name, serial, or type
|
||||
- **Filter Options**: Filter by object type, visibility, or custom criteria
|
||||
|
||||
### Property Analysis Tools
|
||||
Advanced property analysis capabilities include:
|
||||
|
||||
- **Type Detection**: Automatic detection of property types and appropriate display formats
|
||||
- **Value Comparison**: Compare property values across different objects or time periods
|
||||
- **Change Tracking**: Monitor property changes in real-time during gameplay
|
||||
- **Export Capabilities**: Export property data for external analysis or reporting
|
||||
|
||||
### Memory Usage Monitoring
|
||||
The Object Inspector includes memory analysis features to help identify performance issues:
|
||||
|
||||
- **Object Count Statistics**: Track number of active objects by type
|
||||
- **Memory Footprint Estimation**: Estimate memory usage of inspected objects
|
||||
- **Leak Detection**: Identify potential memory leaks through object lifetime monitoring
|
||||
- **Garbage Collection Impact**: Monitor GC pressure during intensive inspection operations
|
||||
|
||||
**Section sources**
|
||||
- [ObjectInspectorViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/ObjectInspectorViewModel.cs)
|
||||
- [ObjectInspectorData.cs](file://ClassicAssist.Shared/UI/Models/ObjectInspectorData.cs)
|
||||
|
||||
## Performance Considerations
|
||||
|
||||
### Large Dataset Optimization
|
||||
When inspecting large numbers of entities, consider the following optimization strategies:
|
||||
|
||||
- **Lazy Loading**: Properties are loaded on-demand rather than all at once
|
||||
- **Virtual Scrolling**: Efficient rendering of large lists using virtualization
|
||||
- **Background Processing**: Heavy operations run on background threads to maintain UI responsiveness
|
||||
- **Caching**: Frequently accessed data is cached to reduce repeated calculations
|
||||
|
||||
### Memory Management Best Practices
|
||||
- **Dispose Pattern**: Proper disposal of large object collections when no longer needed
|
||||
- **Weak References**: Use weak references for long-lived object caches to prevent memory leaks
|
||||
- **Batch Operations**: Process large datasets in batches to avoid memory spikes
|
||||
- **GC Pressure Monitoring**: Monitor garbage collection frequency during intensive operations
|
||||
|
||||
### UI Responsiveness
|
||||
- **Progressive Rendering**: Update UI incrementally rather than blocking the main thread
|
||||
- **Throttled Updates**: Limit update frequency for rapidly changing properties
|
||||
- **Asynchronous Operations**: Perform network or disk I/O operations asynchronously
|
||||
- **Cancellation Support**: Allow cancellation of long-running inspection operations
|
||||
|
||||
## Troubleshooting Guide
|
||||
|
||||
### Common Issues and Solutions
|
||||
|
||||
#### Object Inspector Not Opening
|
||||
- **Check Hotkey Configuration**: Verify the assigned hotkey doesn't conflict with other commands
|
||||
- **Window State**: Check if the window is minimized or hidden behind other applications
|
||||
- **Permission Issues**: Ensure the application has necessary permissions to access game memory
|
||||
|
||||
#### Slow Performance with Many Objects
|
||||
- **Enable Filtering**: Use filters to limit the number of displayed objects
|
||||
- **Disable Auto-Refresh**: Turn off automatic refresh for static inspections
|
||||
- **Reduce Property Depth**: Limit nested property inspection depth
|
||||
- **Close Other Windows**: Free up system resources by closing unnecessary applications
|
||||
|
||||
#### Missing Properties or Incorrect Values
|
||||
- **Refresh Manually**: Force a manual refresh of the object data
|
||||
- **Check Game State**: Ensure the game is in a stable state with consistent object data
|
||||
- **Verify Permissions**: Confirm the application has proper read access to game memory
|
||||
- **Update Version**: Ensure you're using the latest version compatible with your game client
|
||||
|
||||
### Debugging Techniques
|
||||
- **Enable Verbose Logging**: Increase logging verbosity to capture detailed inspection operations
|
||||
- **Export Data**: Export object data for offline analysis when live inspection is problematic
|
||||
- **Isolate Issues**: Test with minimal object sets to isolate performance problems
|
||||
- **Monitor Resources**: Use system monitoring tools to track memory and CPU usage during inspection
|
||||
|
||||
**Section sources**
|
||||
- [ObjectInspectorViewModel.cs](file://ClassicAssist.Shared/UI/ViewModels/ObjectInspectorViewModel.cs)
|
||||
|
||||
## Conclusion
|
||||
|
||||
The Object Inspector in ClassicAssist.Avalonia provides a comprehensive solution for real-time game object inspection and debugging. Its modular architecture, extensive feature set, and integration with the broader ClassicAssist ecosystem make it an invaluable tool for developers and advanced users alike.
|
||||
|
||||
Key benefits include:
|
||||
- **Real-time Inspection**: Live viewing of game object states without interrupting gameplay
|
||||
- **Comprehensive Coverage**: Support for all major entity types (Mobiles, Items, Gumps)
|
||||
- **Flexible Interface**: Hierarchical navigation, filtering, and search capabilities
|
||||
- **Performance Optimized**: Designed to handle large numbers of objects efficiently
|
||||
- **Developer Friendly**: Extensive debugging and analysis features for troubleshooting
|
||||
|
||||
For optimal results, users should leverage the filtering capabilities to focus on relevant objects, use the hotkey integration for quick access, and follow the performance guidelines when working with large datasets. The Object Inspector serves as both a development aid and a powerful diagnostic tool throughout the game development and testing lifecycle.
|
||||
@@ -0,0 +1,483 @@
|
||||
# Packet Logger
|
||||
|
||||
<cite>
|
||||
**Referenced Files in This Document**
|
||||
- [PacketFilter.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilter.cs)
|
||||
- [PacketFilterCondition.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterCondition.cs)
|
||||
- [PacketFilterConditions.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterConditions.cs)
|
||||
- [PacketFilterInfo.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterInfo.cs)
|
||||
- [PacketWaitEntry.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntry.cs)
|
||||
- [PacketWaitEntries.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntries.cs)
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
|
||||
- [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs)
|
||||
- [PacketHandler.cs](file://ClassicAssist.Shared/UO/Network/PacketHandler.cs)
|
||||
- [BasePacket.cs](file://ClassicAssist.Shared/UO/Network/Packets/BasePacket.cs)
|
||||
- [PacketDirection.cs](file://ClassicAssist.Shared/UO/Data/PacketDirection.cs)
|
||||
- [HexDumpControl.axaml.cs](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml.cs)
|
||||
- [HexDumpControl.axaml](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml)
|
||||
- [PacketEntryBinaryValueConverter.cs](file://ClassicAssist.Avalonia/Misc/PacketEntryBinaryValueConverter.cs)
|
||||
- [PacketEntryTextValueConverter.cs](file://ClassicAssist.Shared/UI/Misc/PacketEntryTextValueConverter.cs)
|
||||
- [ReplayPacketLog.cs](file://ClassicAssist.Tests/ReplayPacketLog.cs)
|
||||
</cite>
|
||||
|
||||
## Table of Contents
|
||||
1. [Introduction](#introduction)
|
||||
2. [Project Structure](#project-structure)
|
||||
3. [Core Components](#core-components)
|
||||
4. [Architecture Overview](#architecture-overview)
|
||||
5. [Detailed Component Analysis](#detailed-component-analysis)
|
||||
6. [Dependency Analysis](#dependency-analysis)
|
||||
7. [Performance Considerations](#performance-considerations)
|
||||
8. [Troubleshooting Guide](#troubleshooting-guide)
|
||||
9. [Conclusion](#conclusion)
|
||||
10. [Appendices](#appendices)
|
||||
|
||||
## Introduction
|
||||
This document explains the Packet Logger tooling within ClassicAssist.Avalonia, focusing on network traffic capture, filtering, and replay capabilities for Ultima Online (UO) protocol packets. It covers how to configure filters by packet type, direction, and content patterns; inspect binary payloads using the hex dump control; synchronize tests with the packet wait system; and integrate logging into development workflows. Guidance is provided for performance considerations and best practices when debugging network interactions.
|
||||
|
||||
## Project Structure
|
||||
The Packet Logger spans shared networking logic and Avalonia UI components:
|
||||
- Shared networking layer defines packet types, handlers, filter conditions, and synchronization primitives.
|
||||
- Avalonia UI provides a Hex Dump control and value converters for displaying packet data.
|
||||
- Tests include a replay utility that demonstrates capturing and re-sending sessions.
|
||||
|
||||
```mermaid
|
||||
graph TB
|
||||
subgraph "Shared Networking"
|
||||
PF["PacketFilter<br/>PacketFilterCondition<br/>PacketFilterConditions<br/>PacketFilterInfo"]
|
||||
PW["PacketWaitEntry<br/>PacketWaitEntries"]
|
||||
PH["PacketHandler"]
|
||||
IPH["IncomingPacketHandlers"]
|
||||
OPH["OutgoingPacketHandlers"]
|
||||
IPF["IncomingPacketFilters"]
|
||||
OPF["OutgoingPacketFilters"]
|
||||
BP["BasePacket"]
|
||||
PD["PacketDirection"]
|
||||
end
|
||||
subgraph "Avalonia UI"
|
||||
HD["HexDumpControl"]
|
||||
PBV["PacketEntryBinaryValueConverter"]
|
||||
PTB["PacketEntryTextValueConverter"]
|
||||
end
|
||||
subgraph "Tests"
|
||||
RPL["ReplayPacketLog"]
|
||||
end
|
||||
PH --> IPH
|
||||
PH --> OPH
|
||||
PH --> IPF
|
||||
PH --> OPF
|
||||
IPF --> PF
|
||||
OPF --> PF
|
||||
PF --> PD
|
||||
PF --> BP
|
||||
PW --> PF
|
||||
HD --> PBV
|
||||
HD --> PTB
|
||||
RPL --> PH
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [PacketFilter.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilter.cs)
|
||||
- [PacketFilterCondition.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterCondition.cs)
|
||||
- [PacketFilterConditions.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterConditions.cs)
|
||||
- [PacketFilterInfo.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterInfo.cs)
|
||||
- [PacketWaitEntry.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntry.cs)
|
||||
- [PacketWaitEntries.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntries.cs)
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
|
||||
- [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs)
|
||||
- [PacketHandler.cs](file://ClassicAssist.Shared/UO/Network/PacketHandler.cs)
|
||||
- [BasePacket.cs](file://ClassicAssist.Shared/UO/Network/Packets/BasePacket.cs)
|
||||
- [PacketDirection.cs](file://ClassicAssist.Shared/UO/Data/PacketDirection.cs)
|
||||
- [HexDumpControl.axaml.cs](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml.cs)
|
||||
- [HexDumpControl.axaml](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml)
|
||||
- [PacketEntryBinaryValueConverter.cs](file://ClassicAssist.Avalonia/Misc/PacketEntryBinaryValueConverter.cs)
|
||||
- [PacketEntryTextValueConverter.cs](file://ClassicAssist.Shared/UI/Misc/PacketEntryTextValueConverter.cs)
|
||||
- [ReplayPacketLog.cs](file://ClassicAssist.Tests/ReplayPacketLog.cs)
|
||||
|
||||
**Section sources**
|
||||
- [PacketFilter.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilter.cs)
|
||||
- [PacketFilterCondition.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterCondition.cs)
|
||||
- [PacketFilterConditions.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterConditions.cs)
|
||||
- [PacketFilterInfo.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterInfo.cs)
|
||||
- [PacketWaitEntry.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntry.cs)
|
||||
- [PacketWaitEntries.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntries.cs)
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
|
||||
- [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs)
|
||||
- [PacketHandler.cs](file://ClassicAssist.Shared/UO/Network/PacketHandler.cs)
|
||||
- [BasePacket.cs](file://ClassicAssist.Shared/UO/Network/Packets/BasePacket.cs)
|
||||
- [PacketDirection.cs](file://ClassicAssist.Shared/UO/Data/PacketDirection.cs)
|
||||
- [HexDumpControl.axaml.cs](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml.cs)
|
||||
- [HexDumpControl.axaml](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml)
|
||||
- [PacketEntryBinaryValueConverter.cs](file://ClassicAssist.Avalonia/Misc/PacketEntryBinaryValueConverter.cs)
|
||||
- [PacketEntryTextValueConverter.cs](file://ClassicAssist.Shared/UI/Misc/PacketEntryTextValueConverter.cs)
|
||||
- [ReplayPacketLog.cs](file://ClassicAssist.Tests/ReplayPacketLog.cs)
|
||||
|
||||
## Core Components
|
||||
- Packet filtering engine: Defines filter conditions, composite filters, and metadata used to match incoming/outgoing packets.
|
||||
- Packet handlers: Central dispatcher that routes packets through filters and invokes registered handlers.
|
||||
- Packet wait system: Synchronization primitives to wait for specific packets or sequences during tests.
|
||||
- Hex dump control: Avalonia control for visual inspection of raw packet bytes.
|
||||
- Replay utility: Test helper to record and re-send captured sessions.
|
||||
|
||||
Key responsibilities:
|
||||
- Capture: Intercept UO packets at send/receive boundaries.
|
||||
- Filter: Match packets by type, direction, and payload patterns.
|
||||
- Inspect: Display raw bytes and decoded text via UI controls.
|
||||
- Wait: Block until expected packets arrive for deterministic testing.
|
||||
- Replay: Re-execute recorded sessions to reproduce issues.
|
||||
|
||||
**Section sources**
|
||||
- [PacketFilter.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilter.cs)
|
||||
- [PacketFilterCondition.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterCondition.cs)
|
||||
- [PacketFilterConditions.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterConditions.cs)
|
||||
- [PacketFilterInfo.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterInfo.cs)
|
||||
- [PacketHandler.cs](file://ClassicAssist.Shared/UO/Network/PacketHandler.cs)
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
|
||||
- [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs)
|
||||
- [PacketWaitEntry.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntry.cs)
|
||||
- [PacketWaitEntries.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntries.cs)
|
||||
- [HexDumpControl.axaml.cs](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml.cs)
|
||||
- [HexDumpControl.axaml](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml)
|
||||
- [PacketEntryBinaryValueConverter.cs](file://ClassicAssist.Avalonia/Misc/PacketEntryBinaryValueConverter.cs)
|
||||
- [PacketEntryTextValueConverter.cs](file://ClassicAssist.Shared/UI/Misc/PacketEntryTextValueConverter.cs)
|
||||
- [ReplayPacketLog.cs](file://ClassicAssist.Tests/ReplayPacketLog.cs)
|
||||
|
||||
## Architecture Overview
|
||||
The packet pipeline integrates filtering and dispatch around a central handler. Filters can be applied per direction (incoming/outgoing), and the wait system coordinates test flows. The UI exposes a hex dump view for binary inspection.
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant App as "Application"
|
||||
participant Net as "PacketHandler"
|
||||
participant IF as "IncomingPacketFilters"
|
||||
participant OF as "OutgoingPacketFilters"
|
||||
participant IH as "IncomingPacketHandlers"
|
||||
participant OH as "OutgoingPacketHandlers"
|
||||
participant UI as "HexDumpControl"
|
||||
App->>Net : "Send/Receive Packet"
|
||||
alt Incoming
|
||||
Net->>IF : "Evaluate filters"
|
||||
IF-->>Net : "Matched?"
|
||||
Net->>IH : "Invoke handler if matched"
|
||||
IH-->>UI : "Expose payload for inspection"
|
||||
else Outgoing
|
||||
Net->>OF : "Evaluate filters"
|
||||
OF-->>Net : "Matched?"
|
||||
Net->>OH : "Invoke handler if matched"
|
||||
OH-->>UI : "Expose payload for inspection"
|
||||
end
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [PacketHandler.cs](file://ClassicAssist.Shared/UO/Network/PacketHandler.cs)
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
|
||||
- [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs)
|
||||
- [HexDumpControl.axaml.cs](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml.cs)
|
||||
|
||||
## Detailed Component Analysis
|
||||
|
||||
### Filtering System
|
||||
The filtering subsystem supports matching packets by type, direction, and content patterns. Conditions are composed to build complex rules.
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
class PacketFilter {
|
||||
+evaluate(packet) bool
|
||||
}
|
||||
class PacketFilterCondition {
|
||||
+match(packet) bool
|
||||
}
|
||||
class PacketFilterConditions {
|
||||
+and(...)
|
||||
+or(...)
|
||||
+not(...)
|
||||
}
|
||||
class PacketFilterInfo {
|
||||
+description string
|
||||
+enabled bool
|
||||
}
|
||||
class BasePacket {
|
||||
+type int
|
||||
+data byte[]
|
||||
}
|
||||
class PacketDirection {
|
||||
<<enum>>
|
||||
}
|
||||
PacketFilter --> PacketFilterCondition : "uses"
|
||||
PacketFilter --> PacketFilterInfo : "metadata"
|
||||
PacketFilterCondition --> BasePacket : "inspects"
|
||||
PacketFilterCondition --> PacketDirection : "checks"
|
||||
```
|
||||
|
||||
Configuration guidance:
|
||||
- Direction: Use direction-aware filters to limit scope to incoming or outgoing traffic.
|
||||
- Type: Narrow by packet type to reduce noise.
|
||||
- Content: Apply pattern-based conditions on payload bytes or decoded fields.
|
||||
- Composition: Combine multiple conditions with logical operators to refine matches.
|
||||
|
||||
Best practices:
|
||||
- Prefer specific type checks before broad content scans.
|
||||
- Cache expensive computations inside conditions when possible.
|
||||
- Keep filter descriptions meaningful for UI display and debugging.
|
||||
|
||||
**Diagram sources**
|
||||
- [PacketFilter.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilter.cs)
|
||||
- [PacketFilterCondition.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterCondition.cs)
|
||||
- [PacketFilterConditions.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterConditions.cs)
|
||||
- [PacketFilterInfo.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterInfo.cs)
|
||||
- [BasePacket.cs](file://ClassicAssist.Shared/UO/Network/Packets/BasePacket.cs)
|
||||
- [PacketDirection.cs](file://ClassicAssist.Shared/UO/Data/PacketDirection.cs)
|
||||
|
||||
**Section sources**
|
||||
- [PacketFilter.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilter.cs)
|
||||
- [PacketFilterCondition.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterCondition.cs)
|
||||
- [PacketFilterConditions.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterConditions.cs)
|
||||
- [PacketFilterInfo.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterInfo.cs)
|
||||
- [BasePacket.cs](file://ClassicAssist.Shared/UO/Network/Packets/BasePacket.cs)
|
||||
- [PacketDirection.cs](file://ClassicAssist.Shared/UO/Data/PacketDirection.cs)
|
||||
|
||||
### Packet Handlers and Dispatch
|
||||
The central handler orchestrates filter evaluation and invokes registered handlers for incoming and outgoing packets.
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
Start(["Packet arrives"]) --> CheckDir{"Direction?"}
|
||||
CheckDir --> |Incoming| EvalIn["Evaluate IncomingPacketFilters"]
|
||||
CheckDir --> |Outgoing| EvalOut["Evaluate OutgoingPacketFilters"]
|
||||
EvalIn --> InMatch{"Any match?"}
|
||||
EvalOut --> OutMatch{"Any match?"}
|
||||
InMatch --> |Yes| CallIn["Call IncomingPacketHandlers"]
|
||||
InMatch --> |No| SkipIn["Skip"]
|
||||
OutMatch --> |Yes| CallOut["Call OutgoingPacketHandlers"]
|
||||
OutMatch --> |No| SkipOut["Skip"]
|
||||
CallIn --> End(["Done"])
|
||||
CallOut --> End
|
||||
SkipIn --> End
|
||||
SkipOut --> End
|
||||
```
|
||||
|
||||
Operational notes:
|
||||
- Register handlers for specific packet types to process relevant events.
|
||||
- Ensure filters are efficient to avoid blocking the network thread.
|
||||
- Separate concerns: filters decide whether to pass; handlers perform actions.
|
||||
|
||||
**Diagram sources**
|
||||
- [PacketHandler.cs](file://ClassicAssist.Shared/UO/Network/PacketHandler.cs)
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
|
||||
- [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs)
|
||||
|
||||
**Section sources**
|
||||
- [PacketHandler.cs](file://ClassicAssist.Shared/UO/Network/PacketHandler.cs)
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
|
||||
- [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs)
|
||||
|
||||
### Packet Wait System
|
||||
The wait system enables synchronization for tests and automation scenarios by waiting for specific packets or sequences.
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant Test as "Test Code"
|
||||
participant Wait as "PacketWaitEntries"
|
||||
participant Entry as "PacketWaitEntry"
|
||||
participant Net as "PacketHandler"
|
||||
Test->>Wait : "Register wait condition"
|
||||
Wait->>Entry : "Create entry with predicate"
|
||||
Test->>Net : "Perform action that triggers packet"
|
||||
Net->>Wait : "Notify matching packets"
|
||||
Wait->>Entry : "Resolve when predicate matches"
|
||||
Entry-->>Test : "Signal completion"
|
||||
```
|
||||
|
||||
Usage tips:
|
||||
- Define precise predicates to avoid false positives.
|
||||
- Set timeouts to prevent indefinite waits.
|
||||
- Clear entries after use to free resources.
|
||||
|
||||
**Diagram sources**
|
||||
- [PacketWaitEntries.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntries.cs)
|
||||
- [PacketWaitEntry.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntry.cs)
|
||||
- [PacketHandler.cs](file://ClassicAssist.Shared/UO/Network/PacketHandler.cs)
|
||||
|
||||
**Section sources**
|
||||
- [PacketWaitEntries.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntries.cs)
|
||||
- [PacketWaitEntry.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntry.cs)
|
||||
|
||||
### Hex Dump Control and Binary Inspection
|
||||
The Avalonia Hex Dump control renders raw packet bytes for analysis. Value converters bridge packet data to UI-friendly formats.
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
class HexDumpControl {
|
||||
+Render(bytes) void
|
||||
}
|
||||
class PacketEntryBinaryValueConverter {
|
||||
+Convert(value) string
|
||||
}
|
||||
class PacketEntryTextValueConverter {
|
||||
+Convert(value) string
|
||||
}
|
||||
HexDumpControl --> PacketEntryBinaryValueConverter : "uses"
|
||||
HexDumpControl --> PacketEntryTextValueConverter : "uses"
|
||||
```
|
||||
|
||||
Inspection workflow:
|
||||
- Select a packet entry to view its raw bytes.
|
||||
- Use the hex view to locate offsets and values.
|
||||
- Switch to text view for readable strings where applicable.
|
||||
|
||||
**Diagram sources**
|
||||
- [HexDumpControl.axaml.cs](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml.cs)
|
||||
- [HexDumpControl.axaml](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml)
|
||||
- [PacketEntryBinaryValueConverter.cs](file://ClassicAssist.Avalonia/Misc/PacketEntryBinaryValueConverter.cs)
|
||||
- [PacketEntryTextValueConverter.cs](file://ClassicAssist.Shared/UI/Misc/PacketEntryTextValueConverter.cs)
|
||||
|
||||
**Section sources**
|
||||
- [HexDumpControl.axaml.cs](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml.cs)
|
||||
- [HexDumpControl.axaml](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml)
|
||||
- [PacketEntryBinaryValueConverter.cs](file://ClassicAssist.Avalonia/Misc/PacketEntryBinaryValueConverter.cs)
|
||||
- [PacketEntryTextValueConverter.cs](file://ClassicAssist.Shared/UI/Misc/PacketEntryTextValueConverter.cs)
|
||||
|
||||
### Replay Functionality
|
||||
The replay utility demonstrates recording and re-sending captured sessions, useful for reproducing issues and validating fixes.
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant Recorder as "Recorder"
|
||||
participant Store as "Capture Store"
|
||||
participant Replayer as "ReplayPacketLog"
|
||||
participant Net as "PacketHandler"
|
||||
Recorder->>Store : "Record packets"
|
||||
Replayer->>Store : "Load session"
|
||||
Replayer->>Net : "Re-send recorded packets"
|
||||
Net-->>Replayer : "Dispatch to handlers"
|
||||
```
|
||||
|
||||
Guidance:
|
||||
- Record minimal necessary traffic to reduce file size.
|
||||
- Normalize timestamps or add delays to mimic real timing.
|
||||
- Validate server responses after replay to ensure correctness.
|
||||
|
||||
**Diagram sources**
|
||||
- [ReplayPacketLog.cs](file://ClassicAssist.Tests/ReplayPacketLog.cs)
|
||||
- [PacketHandler.cs](file://ClassicAssist.Shared/UO/Network/PacketHandler.cs)
|
||||
|
||||
**Section sources**
|
||||
- [ReplayPacketLog.cs](file://ClassicAssist.Tests/ReplayPacketLog.cs)
|
||||
- [PacketHandler.cs](file://ClassicAssist.Shared/UO/Network/PacketHandler.cs)
|
||||
|
||||
## Dependency Analysis
|
||||
The following diagram highlights key dependencies among filtering, dispatch, and UI components.
|
||||
|
||||
```mermaid
|
||||
graph LR
|
||||
PF["PacketFilter"] --> PFC["PacketFilterCondition"]
|
||||
PF --> PFI["PacketFilterInfo"]
|
||||
PFC --> BP["BasePacket"]
|
||||
PFC --> PD["PacketDirection"]
|
||||
PH["PacketHandler"] --> IPF["IncomingPacketFilters"]
|
||||
PH --> OPF["OutgoingPacketFilters"]
|
||||
PH --> IPH["IncomingPacketHandlers"]
|
||||
PH --> OPH["OutgoingPacketHandlers"]
|
||||
HD["HexDumpControl"] --> PBV["PacketEntryBinaryValueConverter"]
|
||||
HD --> PTB["PacketEntryTextValueConverter"]
|
||||
RPL["ReplayPacketLog"] --> PH
|
||||
```
|
||||
|
||||
**Diagram sources**
|
||||
- [PacketFilter.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilter.cs)
|
||||
- [PacketFilterCondition.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterCondition.cs)
|
||||
- [PacketFilterInfo.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterInfo.cs)
|
||||
- [BasePacket.cs](file://ClassicAssist.Shared/UO/Network/Packets/BasePacket.cs)
|
||||
- [PacketDirection.cs](file://ClassicAssist.Shared/UO/Data/PacketDirection.cs)
|
||||
- [PacketHandler.cs](file://ClassicAssist.Shared/UO/Network/PacketHandler.cs)
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
|
||||
- [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs)
|
||||
- [HexDumpControl.axaml.cs](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml.cs)
|
||||
- [PacketEntryBinaryValueConverter.cs](file://ClassicAssist.Avalonia/Misc/PacketEntryBinaryValueConverter.cs)
|
||||
- [PacketEntryTextValueConverter.cs](file://ClassicAssist.Shared/UI/Misc/PacketEntryTextValueConverter.cs)
|
||||
- [ReplayPacketLog.cs](file://ClassicAssist.Tests/ReplayPacketLog.cs)
|
||||
|
||||
**Section sources**
|
||||
- [PacketFilter.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilter.cs)
|
||||
- [PacketFilterCondition.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterCondition.cs)
|
||||
- [PacketFilterInfo.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterInfo.cs)
|
||||
- [BasePacket.cs](file://ClassicAssist.Shared/UO/Network/Packets/BasePacket.cs)
|
||||
- [PacketDirection.cs](file://ClassicAssist.Shared/UO/Data/PacketDirection.cs)
|
||||
- [PacketHandler.cs](file://ClassicAssist.Shared/UO/Network/PacketHandler.cs)
|
||||
- [IncomingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketFilters.cs)
|
||||
- [OutgoingPacketFilters.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketFilters.cs)
|
||||
- [IncomingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/IncomingPacketHandlers.cs)
|
||||
- [OutgoingPacketHandlers.cs](file://ClassicAssist.Shared/UO/Network/OutgoingPacketHandlers.cs)
|
||||
- [HexDumpControl.axaml.cs](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml.cs)
|
||||
- [PacketEntryBinaryValueConverter.cs](file://ClassicAssist.Avalonia/Misc/PacketEntryBinaryValueConverter.cs)
|
||||
- [PacketEntryTextValueConverter.cs](file://ClassicAssist.Shared/UI/Misc/PacketEntryTextValueConverter.cs)
|
||||
- [ReplayPacketLog.cs](file://ClassicAssist.Tests/ReplayPacketLog.cs)
|
||||
|
||||
## Performance Considerations
|
||||
- Filter specificity: Narrow filters by packet type and direction to minimize payload scanning.
|
||||
- Avoid heavy work in hot paths: Defer expensive operations off the network thread.
|
||||
- Limit UI updates: Batch or throttle UI rendering when logging large volumes.
|
||||
- Manage memory: Reuse buffers and clear references to avoid retention.
|
||||
- Timeouts: Always set reasonable timeouts for wait entries to prevent hangs.
|
||||
- Logging volume: Enable detailed logging only when needed; disable otherwise.
|
||||
|
||||
[No sources needed since this section provides general guidance]
|
||||
|
||||
## Troubleshooting Guide
|
||||
Common issues and resolutions:
|
||||
- No packets captured: Verify handlers are registered and filters are enabled.
|
||||
- False positives: Tighten filter predicates and validate direction/type checks.
|
||||
- Slow performance: Profile filter conditions and reduce payload inspections.
|
||||
- Stalled tests: Ensure wait entries have timeouts and are cleared after completion.
|
||||
- UI freezes: Offload conversions and avoid frequent UI updates from network threads.
|
||||
|
||||
**Section sources**
|
||||
- [PacketFilter.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilter.cs)
|
||||
- [PacketFilterCondition.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterCondition.cs)
|
||||
- [PacketFilterConditions.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketFilterConditions.cs)
|
||||
- [PacketWaitEntry.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntry.cs)
|
||||
- [PacketWaitEntries.cs](file://ClassicAssist.Shared/UO/Network/PacketFilter/PacketWaitEntries.cs)
|
||||
- [PacketHandler.cs](file://ClassicAssist.Shared/UO/Network/PacketHandler.cs)
|
||||
- [HexDumpControl.axaml.cs](file://ClassicAssist.Avalonia/Controls/HexDumpControl.axaml.cs)
|
||||
|
||||
## Conclusion
|
||||
The Packet Logger integrates robust filtering, dispatch, synchronization, and inspection tools tailored for UO protocol debugging. By configuring precise filters, leveraging the hex dump control, and using the wait system for deterministic tests, developers can efficiently diagnose network behavior and reproduce issues with replay utilities. Adhering to performance best practices ensures smooth operation even under high traffic loads.
|
||||
|
||||
[No sources needed since this section summarizes without analyzing specific files]
|
||||
|
||||
## Appendices
|
||||
|
||||
### Example Workflows
|
||||
|
||||
- Capturing and analyzing UO protocol packets:
|
||||
- Enable logging for incoming/outgoing directions.
|
||||
- Add filters by packet type and narrow by content patterns.
|
||||
- Inspect payloads using the hex dump control and text converter.
|
||||
|
||||
- Creating custom filters:
|
||||
- Implement a condition that inspects BasePacket fields and direction.
|
||||
- Compose with other conditions using logical operators.
|
||||
- Attach descriptive metadata for UI visibility.
|
||||
|
||||
- Replaying captured sessions:
|
||||
- Record a session with minimal necessary packets.
|
||||
- Load the session via the replay utility.
|
||||
- Re-send packets and validate server responses.
|
||||
|
||||
[No sources needed since this section provides conceptual guidance]
|
||||
Reference in New Issue
Block a user