hypertwist/docs/Deepseek C# Prompt
2026-04-25 04:20:15 +02:00

100 lines
6 KiB
Text

Role: Principal Software Engineer at a AAA Game Studio, building tooling for Unreal Engine 5.
Project: VR Codebase Inspector and Security Pen-Testing Analyzer.
Architecture: Unreal Engine 5 (C++ Client) <---WebSocket---> C# .NET 8 Backend Analysis Server.
Constraint: The C# server runs on a local workstation (or cloud VM) alongside the VR headset. It must process arbitrary open-source codebases (C++, C#, Python, JS) and return JSON graphs of vulnerabilities and call hierarchies.
Technical Directives (To Prevent AI Model Degradation into .NET Framework patterns):
1. AOT Compatibility: This server may eventually run inside a Docker container with `-p:PublishAot=true`. Therefore, YOU CANNOT USE REFLECTION (`GetProperties()`, `GetMethods()`). All type scanning MUST use **Roslyn Source Generators** OR **Microsoft.CodeAnalysis** (Compilation APIs) which are AOT-safe.
2. Roslyn Analyzer: Write a C# Script that uses `Microsoft.CodeAnalysis.CSharp` to parse a given folder of C# code and return a list of `UnsafeMethodCall` objects (e.g., `Process.Start` usage, `DllImport` attributes). YOU MUST PROVIDE A `Solution` file and `Project` loader that handles `AdhocWorkspace`.
3. C++ Parsing: For the Unreal side, DO NOT attempt to wrap Unreal C++ in C#. Instead, C# will shell out to `clang-tidy` or `cppcheck`. Show me the `Process` spawning logic with **OutputDataReceived** event handlers that send progress updates back to the client via SignalR.
4. Performance: Use `System.IO.Pipelines` (PipeReader) to stream massive source files (e.g., 100MB `Intermediate/Build/Source.cpp`) without allocating huge strings on the Large Object Heap.
5. Frontend Interop: Generate a TypeScript client definition from the C# SignalR hub using `@microsoft/signalr-protocol-msgpack`. Include the command for `nswag` or `openapi-generator`.
Output Expected:
1. A detailed architecture diagram in Mermaid format.
2. The C# code for `RoslynAnalyzerService.cs` and `CppAnalyzerService.cs`.
3. Explanation of how to handle the **Impedance Mismatch**: C# wants deterministic disposal, Unreal expects persistent open sockets. How will you manage lifetime of the WebSocket connection?
4. A note on **Security**: This tool will be used for pen-testing. The C# server executes untrusted user scripts (via shell). Provide the `ProcessStartInfo` configuration to ensure **Sandboxing** (e.g., `UseShellExecute=false`, `WorkingDirectory` restriction, `EnvironmentVariables` scrub).
Continue generating the response now. Provide full code blocks, do not use placeholders like "// logic here". Be explicit.
---
Role: Senior systems architect for math-heavy multiplayer applications with Unreal frontends and C# backend services.
Project: Hypercubing virtual reality application. Unreal will render and handle immersive interaction. C# is being considered for simulation, multiplayer backend, persistence, telemetry, and orchestration.
Objective: Design a high-performance architecture where Unreal remains the client/runtime and C# owns the durable and computational service layer.
Hard constraints:
1. Do not propose replacing Unreal gameplay/runtime with C#.
2. Use C# for:
- simulation services where server authority is needed
- session state
- matchmaking
- persistence
- replay/event logs
- analytics
- user/session/account services
- collaboration or shared puzzle state
3. Assume the math may become non-trivial and should remain strongly typed and testable.
4. Prefer explicit contracts and deterministic state transitions.
5. No reflection-driven architecture in core simulation paths.
6. Design for low-latency updates, reconnect, state recovery, and versioned protocol evolution.
7. Assume future scale from single-user local mode up to networked synchronized sessions.
Deliverables:
- Service layout
- Unreal-to-backend communication model
- State authority model
- Sync strategy
- Persistence model
- Replay/event sourcing recommendation
- Math/simulation placement
- Testing strategy for deterministic correctness
- Deployment options from local to hosted
- AI-assisted development constraints for C# code generation on this project
If output is interrupted, continue from the exact next unfinished section. Do not summarize. Continue raw technical output only.
---
Role: Senior architect for C# backends and Unreal-integrated systems.
Project: Virtual reality codebase inspector and pentest platform. Unreal is the client/runtime. C# is being considered for backend, analysis, orchestration, collaboration, and data services.
Objective: Design the system so Unreal remains responsible for rendering and interaction, while C# owns the heavy platform logic.
Hard constraints:
1. Do not propose writing Unreal gameplay code in C#.
2. Treat Unreal as C++/Blueprint client only.
3. Use C# for:
- repository ingestion
- graph/index building
- code intelligence
- plugin and tool orchestration
- pentest job scheduling
- evidence storage
- collaboration services
- multiplayer/session backend
4. The system must support polyglot repositories and external scanners written in many languages.
5. Prefer out-of-process boundaries, gRPC/HTTP/WebSocket boundaries, or worker sandbox boundaries over in-process interop.
6. No reflection-heavy magic in core runtime paths.
7. Assume large repos, long-running scans, and untrusted tool output.
8. Design for cancellation, resumability, auditability, and multi-tenant isolation.
Deliverables:
- Full architecture with Unreal placement and C# placement
- Recommended service decomposition
- Worker sandbox strategy
- Plugin execution strategy
- Security boundaries for pentest tooling
- Repository indexing pipeline
- Real-time event streaming into VR
- Storage model for findings, graphs, evidence, and sessions
- Auth model and operator roles
- Queueing and scheduling design
- Deployment topology for local workstation, single VPS, and larger multi-node setups
- AI integration boundaries and safe prompting strategy for code and security tasks
If output is interrupted, continue exactly where you stopped. Do not summarize. Output the remaining architecture in the same level of detail.