Files
geutebruck/GeViSetEditor/GeViSetEditor.CLI/Program.cs
Administrator 14893e62a5 feat: Geutebruck GeViScope/GeViSoft Action Mapping System - MVP
This MVP release provides a complete full-stack solution for managing action mappings
in Geutebruck's GeViScope and GeViSoft video surveillance systems.

## Features

### Flutter Web Application (Port 8081)
- Modern, responsive UI for managing action mappings
- Action picker dialog with full parameter configuration
- Support for both GSC (GeViScope) and G-Core server actions
- Consistent UI for input and output actions with edit/delete capabilities
- Real-time action mapping creation, editing, and deletion
- Server categorization (GSC: prefix for GeViScope, G-Core: prefix for G-Core servers)

### FastAPI REST Backend (Port 8000)
- RESTful API for action mapping CRUD operations
- Action template service with comprehensive action catalog (247 actions)
- Server management (G-Core and GeViScope servers)
- Configuration tree reading and writing
- JWT authentication with role-based access control
- PostgreSQL database integration

### C# SDK Bridge (gRPC, Port 50051)
- Native integration with GeViSoft SDK (GeViProcAPINET_4_0.dll)
- Action mapping creation with correct binary format
- Support for GSC and G-Core action types
- Proper Camera parameter inclusion in action strings (fixes CrossSwitch bug)
- Action ID lookup table with server-specific action IDs
- Configuration reading/writing via SetupClient

## Bug Fixes
- **CrossSwitch Bug**: GSC and G-Core actions now correctly display camera/PTZ head parameters in GeViSet
- Action strings now include Camera parameter: `@ PanLeft (Comment: "", Camera: 101028)`
- Proper filter flags and VideoInput=0 for action mappings
- Correct action ID assignment (4198 for GSC, 9294 for G-Core PanLeft)

## Technical Stack
- **Frontend**: Flutter Web, Dart, Dio HTTP client
- **Backend**: Python FastAPI, PostgreSQL, Redis
- **SDK Bridge**: C# .NET 8.0, gRPC, GeViSoft SDK
- **Authentication**: JWT tokens
- **Configuration**: GeViSoft .set files (binary format)

## Credentials
- GeViSoft/GeViScope: username=sysadmin, password=masterkey
- Default admin: username=admin, password=admin123

## Deployment
All services run on localhost:
- Flutter Web: http://localhost:8081
- FastAPI: http://localhost:8000
- SDK Bridge gRPC: localhost:50051
- GeViServer: localhost (default port)

Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-31 18:10:54 +01:00

245 lines
10 KiB
C#

using System;
using System.Linq;
using GeViSetEditor.Core.Parsers;
using GeViSetEditor.Core.Models;
using GeViSetEditor.CLI.Commands;
namespace GeViSetEditor.CLI
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("=== GeViSet Configuration Editor ===\n");
if (args.Length == 0)
{
ShowHelp();
return;
}
string command = args[0].ToLower();
try
{
switch (command)
{
case "view":
case "parse":
if (args.Length < 2)
{
Console.WriteLine("Usage: GeViSetEditor view <input.set>");
return;
}
ViewSetFile(args[1]);
break;
case "export":
if (args.Length < 3)
{
Console.WriteLine("Usage: GeViSetEditor export <input.set> <output.xlsx>");
return;
}
ExportToExcel(args[1], args[2]);
break;
case "import":
if (args.Length < 3)
{
Console.WriteLine("Usage: GeViSetEditor import <input.xlsx> <output.set>");
return;
}
ImportFromExcel(args[1], args[2]);
break;
case "test-roundtrip":
case "test":
if (args.Length < 2)
{
Console.WriteLine("Usage: GeViSetEditor test-roundtrip <input.set>");
return;
}
TestRoundTripCommand.Execute(args[1]);
break;
case "parse-complete":
case "full":
if (args.Length < 2)
{
Console.WriteLine("Usage: GeViSetEditor parse-complete <input.set> [output.json]");
return;
}
string jsonOutput = args.Length >= 3 ? args[2] : null;
ParseCompleteCommand.Execute(args[1], jsonOutput);
break;
case "to-json":
case "json":
if (args.Length < 3)
{
Console.WriteLine("Usage: GeViSetEditor to-json <input.set> <output.json>");
return;
}
ExportJsonCommand.Execute(args[1], args[2]);
break;
case "enhanced":
case "full-parse":
if (args.Length < 2)
{
Console.WriteLine("Usage: GeViSetEditor enhanced <input.set> [output.json]");
return;
}
string enhancedOutput = args.Length >= 3 ? args[2] : null;
EnhancedParseCommand.Execute(args[1], enhancedOutput);
break;
case "analyze":
case "inspect":
if (args.Length < 2)
{
Console.WriteLine("Usage: GeViSetEditor analyze <input.set> [report.json]");
return;
}
string reportOutput = args.Length >= 3 ? args[2] : null;
AnalyzeStructureCommand.Execute(args[1], reportOutput);
break;
case "comprehensive":
case "all":
if (args.Length < 2)
{
Console.WriteLine("Usage: GeViSetEditor comprehensive <input.set> [output.json]");
return;
}
string comprehensiveOutput = args.Length >= 3 ? args[2] : null;
ComprehensiveParseCommand.Execute(args[1], comprehensiveOutput);
break;
case "modify":
case "edit":
if (args.Length < 2)
{
Console.WriteLine("Usage: GeViSetEditor modify <input.set> [output.set]");
return;
}
string modifyOutput = args.Length >= 3 ? args[2] : null;
ModifyConfigCommand.Execute(args[1], modifyOutput);
break;
default:
Console.WriteLine($"Unknown command: {command}");
ShowHelp();
break;
}
}
catch (Exception ex)
{
Console.WriteLine($"\n❌ Error: {ex.Message}");
Console.WriteLine($"\nStack trace:\n{ex.StackTrace}");
}
}
static void ShowHelp()
{
Console.WriteLine("Commands:");
Console.WriteLine(" view <input.set> - View configuration and action mappings");
Console.WriteLine(" test-roundtrip <input.set> - Test read/write safety (IMPORTANT!)");
Console.WriteLine(" comprehensive <input.set> [out.json] - Parse ALL config data (19K+ nodes)");
Console.WriteLine(" modify <input.set> [output.set] - Test edit/add/delete operations");
Console.WriteLine(" to-json <input.set> <output.json> - Export action mappings to JSON");
Console.WriteLine(" export <input.set> <output.xlsx> - Export to Excel for editing");
Console.WriteLine(" import <input.xlsx> <output.set> - Import from Excel to .set file");
Console.WriteLine("\nExamples:");
Console.WriteLine(" GeViSetEditor test-roundtrip TestMKS.set");
Console.WriteLine(" GeViSetEditor enhanced TestMKS.set full_config.json");
Console.WriteLine(" GeViSetEditor to-json TestMKS.set mappings.json");
Console.WriteLine(" GeViSetEditor view TestMKS.set");
Console.WriteLine(" GeViSetEditor export TestMKS.set mappings.xlsx");
}
static void ViewSetFile(string inputPath)
{
Console.WriteLine($"Parsing: {inputPath}\n");
var parser = new SetFileParser();
var config = parser.Parse(inputPath);
Console.WriteLine("\n" + new string('=', 70));
Console.WriteLine("CONFIGURATION SUMMARY");
Console.WriteLine(new string('=', 70) + "\n");
int totalRules = 0;
int totalVariations = 0;
foreach (var section in config.Sections)
{
if (section.Rules.Count > 0)
{
Console.WriteLine($"\n{section.Name}:");
Console.WriteLine(new string('-', 50));
foreach (var rule in section.Rules)
{
totalRules++;
totalVariations += rule.ActionVariations.Count;
Console.WriteLine($"\n Rule #{rule.RuleId}:");
// Show triggers
var activeTriggers = rule.TriggerProperties.Where(kv => kv.Value).ToList();
if (activeTriggers.Any())
{
Console.WriteLine($" Triggers: {string.Join(", ", activeTriggers.Select(t => t.Key))}");
}
// Show main action
if (!string.IsNullOrEmpty(rule.MainAction))
{
Console.WriteLine($" Action: {rule.MainAction}");
}
// Show variations
if (rule.ActionVariations.Count > 0)
{
Console.WriteLine($" Variations ({rule.ActionVariations.Count}):");
foreach (var variation in rule.ActionVariations)
{
Console.WriteLine($" [{variation.VariationId}] {variation.ActionString}");
if (!string.IsNullOrEmpty(variation.ActionType))
{
Console.WriteLine($" Type: {variation.ActionType}");
}
if (!string.IsNullOrEmpty(variation.FullCommand))
{
Console.WriteLine($" Command: {variation.FullCommand}");
}
if (!string.IsNullOrEmpty(variation.ServerName))
{
Console.WriteLine($" Server: {variation.ServerName}");
}
}
}
}
}
}
Console.WriteLine("\n" + new string('=', 70));
Console.WriteLine($"Total: {totalRules} rules, {totalVariations} variations");
Console.WriteLine(new string('=', 70));
}
static void ExportToExcel(string inputPath, string outputPath)
{
Console.WriteLine("Excel export not yet implemented.");
Console.WriteLine("Will be added in next step with EPPlus library.");
}
static void ImportFromExcel(string inputPath, string outputPath)
{
Console.WriteLine("Excel import not yet implemented.");
Console.WriteLine("Will be added after export functionality.");
}
}
}