Files
DCIT/DCIT.Core/Models/DiffModels.cs

223 lines
5.4 KiB
C#
Raw Permalink Normal View History

2026-07-13 10:04:36 +08:00
using System;
using System.Collections.Generic;
namespace DCIT.Core.Models
{
public class DiffDocument
{
public string Format { get; set; } = "dcit-diff";
public string Version { get; set; } = "1.0";
public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.Now;
public bool Encrypted { get; set; }
public DiffAppInfo App { get; set; } = new DiffAppInfo();
public DiffAlgorithmInfo Algorithm { get; set; } = new DiffAlgorithmInfo();
public DiffDocumentInfo SourceDocument { get; set; } = new DiffDocumentInfo();
public DiffDocumentInfo ReplacedDocument { get; set; } = new DiffDocumentInfo();
public DiffRuleFileInfo RuleFile { get; set; } = new DiffRuleFileInfo();
public DiffIntegrityInfo Integrity { get; set; } = new DiffIntegrityInfo();
public DiffEncryptionInfo Encryption { get; set; }
public string PayloadCiphertext { get; set; }
public DiffPayload Payload { get; set; }
}
public class DiffAppInfo
{
public string Name { get; set; } = "DCIT";
public string Version { get; set; } = "1.0.0";
}
public class DiffAlgorithmInfo
{
public string DiffVersion { get; set; } = "1.0";
public string BmpCodecVersion { get; set; } = "1.0";
}
public class DiffDocumentInfo
{
public string FileName { get; set; }
public string RelativePath { get; set; }
public string Extension { get; set; }
public string FingerprintAlgorithm { get; set; } = "SHA-256";
public string Fingerprint { get; set; }
}
public class DiffRuleFileInfo
{
public string FileName { get; set; }
public string Version { get; set; } = "1.0";
public string FingerprintAlgorithm { get; set; } = "SHA-256";
public string Fingerprint { get; set; }
}
public class DiffIntegrityInfo
{
public string HashAlgorithm { get; set; } = "SHA-256";
public string PayloadHash { get; set; }
public string TamperProtectionAlgorithm { get; set; } = "HMAC-SHA256";
public string TamperProtectionValue { get; set; }
}
public class DiffEncryptionInfo
{
public string Algorithm { get; set; } = "AES-256-CBC+HMAC-SHA256";
public string KeyId { get; set; } = "default";
public string Nonce { get; set; }
public string Tag { get; set; }
}
public class DiffPayload
{
public DiffStatistics Statistics { get; set; } = new DiffStatistics();
public List<DiffOperation> Operations { get; set; } = new List<DiffOperation>();
}
public class DiffStatistics
{
public int TextReplaceCount { get; set; }
public int ImageReplaceCount { get; set; }
}
public class DiffOperation
{
public string OperationId { get; set; }
public string Type { get; set; }
public string ObjectType { get; set; }
public string ContainerKind { get; set; }
public string EmbeddedProgramId { get; set; }
public string EmbeddedPackageExtension { get; set; }
public DiffPosition Position { get; set; } = new DiffPosition();
public DiffRuleHitInfo Rule { get; set; }
public string OriginalText { get; set; }
public string ReplacementTemplateResult { get; set; }
public string WrittenText { get; set; }
public int? DisplayWidthOriginal { get; set; }
public int? DisplayWidthWritten { get; set; }
public bool? Truncated { get; set; }
public bool? PaddingApplied { get; set; }
public string SourceKind { get; set; }
public DiffImageData OriginalImage { get; set; }
public DiffImageData ConvertedBitmapImage { get; set; }
public DiffImageData NewImage { get; set; }
public int? Seed { get; set; }
public DiffNoiseSummary NoiseSummary { get; set; }
public DiffImageLayout Layout { get; set; }
}
public class DiffPosition
{
public string StoryType { get; set; }
public string ContainerPath { get; set; }
public int ParagraphIndex { get; set; }
public int ParagraphTextLength { get; set; } = -1;
public string ParagraphTextHash { get; set; }
public int StartTextOffset { get; set; } = -1;
public int EndTextOffset { get; set; } = -1;
public int StartRunIndex { get; set; }
public int StartCharOffset { get; set; }
public int EndRunIndex { get; set; }
public int EndCharOffset { get; set; }
public int? ObjectIndex { get; set; }
}
public class DiffRuleHitInfo
{
public string Id { get; set; }
public string Name { get; set; }
public string MatchMode { get; set; }
public string Pattern { get; set; }
public int HitIndex { get; set; }
}
public class DiffImageData
{
public string Format { get; set; }
public int WidthPx { get; set; }
public int HeightPx { get; set; }
public string Data { get; set; }
}
public class DiffNoiseSummary
{
public double ModifiedPixelRatio { get; set; }
}
public class DiffImageLayout
{
public long DisplayWidthEmu { get; set; }
public long DisplayHeightEmu { get; set; }
public string WrapMode { get; set; }
public double RotationDegree { get; set; }
}
}