using System.Collections.Generic;
namespace GeViSetEditor.Core.Models
{
///
/// Safe representation of a .set file that preserves original binary data
/// Only parses action mappings, everything else stays as original bytes
///
public class SafeSetFile
{
///
/// Complete original file data - preserved for round-trip
///
public byte[] OriginalData { get; set; }
///
/// File size in bytes
///
public int FileSize { get; set; }
///
/// Header string (usually "GeViSoft Parameters")
///
public string Header { get; set; } = "";
///
/// Extracted action mappings with their file offsets
///
public List ActionMappings { get; set; } = new();
///
/// Get a clean copy of the original data for writing
///
public byte[] GetDataForWriting()
{
byte[] copy = new byte[OriginalData.Length];
System.Array.Copy(OriginalData, copy, OriginalData.Length);
return copy;
}
}
///
/// Action mapping entry with its location in the file
///
public class ActionMappingEntry
{
///
/// File offset where this mapping starts
///
public int FileOffset { get; set; }
///
/// Offset of the "Rules" marker
///
public int RulesMarkerOffset { get; set; }
///
/// Offset where action data starts (after metadata)
///
public int ActionDataStartOffset { get; set; }
///
/// Offset where action data ends
///
public int ActionDataEndOffset { get; set; }
///
/// Original bytes for this entire mapping (for preservation)
///
public byte[] OriginalBytes { get; set; }
///
/// Extracted action strings
///
public List Actions { get; set; } = new();
///
/// Optional: Parsed trigger conditions (if needed later)
///
public Dictionary TriggerConditions { get; set; } = new();
///
/// Display-friendly description of this mapping
///
public string GetDescription()
{
return $"Mapping at offset {FileOffset}: {Actions.Count} actions";
}
}
}