Files

139 lines
4.8 KiB
C#

using System.Text.Json.Serialization;
namespace gregExtractor;
public sealed class MethodSnapshot
{
public string Assembly { get; set; } = string.Empty;
public string TypeName { get; set; } = string.Empty;
public string MethodName { get; set; } = string.Empty;
public string SignatureKey { get; set; } = string.Empty;
public string BodyHash { get; set; } = string.Empty;
[JsonIgnore]
public string IdentityKey => $"{Assembly}|{TypeName}|{MethodName}";
}
public sealed class SourceSnapshot
{
public DateTime CreatedUtc { get; set; }
public string SourceRoot { get; set; } = string.Empty;
public int FileCount { get; set; }
public List<MethodSnapshot> Methods { get; set; } = new();
}
public sealed class ChangeReport
{
public DateTime CreatedUtc { get; set; }
public int PreviousCount { get; set; }
public int CurrentCount { get; set; }
public int Added { get; set; }
public int Removed { get; set; }
public int SignatureChanged { get; set; }
public int BodyChanged { get; set; }
public bool HasChanges => Added > 0 || Removed > 0 || SignatureChanged > 0 || BodyChanged > 0;
}
public sealed class HookCatalogRow
{
public string Il2CppHookEvent { get; set; } = string.Empty;
public string GregApiCall { get; set; } = string.Empty;
public string Category { get; set; } = string.Empty;
public string Assembly { get; set; } = string.Empty;
public string PatchTarget { get; set; } = string.Empty;
public string SignatureKey => $"{Assembly}|{PatchTarget}";
}
public readonly struct HookCoverage
{
public HookCoverage(int expectedUnique, int hookedUnique, int coveredUnique)
{
ExpectedUnique = expectedUnique;
HookedUnique = hookedUnique;
CoveredUnique = coveredUnique;
}
public int ExpectedUnique { get; }
public int HookedUnique { get; }
public int CoveredUnique { get; }
public int MissingUnique => Math.Max(0, ExpectedUnique - CoveredUnique);
public double CoveragePercent => ExpectedUnique == 0 ? 0d : (100d * CoveredUnique / ExpectedUnique);
}
public readonly struct AssemblyCoverageRow
{
public AssemblyCoverageRow(string assembly, int expectedUnique, int hookedUnique, int coveredUnique)
{
Assembly = assembly;
ExpectedUnique = expectedUnique;
HookedUnique = hookedUnique;
CoveredUnique = coveredUnique;
}
public string Assembly { get; }
public int ExpectedUnique { get; }
public int HookedUnique { get; }
public int CoveredUnique { get; }
public int MissingUnique => Math.Max(0, ExpectedUnique - CoveredUnique);
public double CoveragePercent => ExpectedUnique == 0 ? 0d : (100d * CoveredUnique / ExpectedUnique);
}
public readonly struct MelonImportResult
{
public MelonImportResult(int copiedFiles, int copiedDirectories, string sourceRootUsed, string targetRoot)
{
CopiedFiles = copiedFiles;
CopiedDirectories = copiedDirectories;
SourceRootUsed = sourceRootUsed;
TargetRoot = targetRoot;
}
public int CopiedFiles { get; }
public int CopiedDirectories { get; }
public string SourceRootUsed { get; }
public string TargetRoot { get; }
}
public sealed class ModProjectAnalysisResult
{
public string ProjectRoot { get; set; } = string.Empty;
public int CSharpFileCount { get; set; }
public int HarmonyPatchCount { get; set; }
public int MelonModInheritanceCount { get; set; }
public int GregPluginInheritanceCount { get; set; }
public int GregEventSubscriptionCount { get; set; }
public int GregApiReferenceCount { get; set; }
public int IntegrationPointsTotal { get; set; }
public int IntegrationPointsMigrated { get; set; }
public int IntegrationPointsRemaining { get; set; }
public double MigrationPercent { get; set; }
public int KnownGregCoreHooks { get; set; }
public int UsedGregCoreHooks { get; set; }
public int MissingGregCoreHooks { get; set; }
public List<string> UsedHooks { get; set; } = new();
public List<string> SuggestedHooks { get; set; } = new();
public List<MigrationOpportunityRow> Opportunities { get; set; } = new();
public List<ModProjectFileInsightRow> FileInsights { get; set; } = new();
}
public sealed class MigrationOpportunityRow
{
public string Type { get; set; } = string.Empty;
public string CurrentPattern { get; set; } = string.Empty;
public string SuggestedGregHook { get; set; } = string.Empty;
public string Suggestion { get; set; } = string.Empty;
}
public sealed class ModProjectFileInsightRow
{
public string FilePath { get; set; } = string.Empty;
public int HarmonyPatches { get; set; }
public int GregSubscriptions { get; set; }
public int GregApiReferences { get; set; }
public bool NeedsMigration { get; set; }
public string Recommendation { get; set; } = string.Empty;
}