Files
GameLauncher/Engines/Evb/EvbDetector.cs
T
armonica 05e7bdb3c0 chore: bundle evbunpack tool and add EVB control/launch fixes
- Add Enigma Virtual Box (EVB) engine support: detection, badge, unpack/restore UI
- Bundle evbunpack.exe under Engines/Evb/Tools/evbunpack (Apache-2.0, with LICENSE/README)
- Copy Engines\\**\\Tools\\** to build output via csproj (publish already covered by publish.ps1)
- Throttle evbunpack progress reporting and shorten timeout to stop UI freeze
- Rename original packed exe to .glbak and write a completion marker; make Restore reverse it
- Launch the unpacked exe from _evb_extracted so script mods apply
- Replace EVB MessageBox dialogs with readable log summaries
- Remove obsolete boxed/7zip extraction code (NwjsPackageUnpacker, TkoolPackagedExtractionService)
2026-10-07 09:30:09 +09:00

63 lines
2.4 KiB
C#

using System;
using System.IO;
using GameLauncher.Engines.Common;
namespace GameLauncher.Engines.Evb
{
/// <summary>
/// Backwards-compatible facade over <see cref="EvbDetectionHelper"/>.
///
/// The plan names the detection primitive <see cref="EvbDetectionHelper"/>, but
/// several callers (the engine module, the unpack service and the game scanner)
/// were written against the shorter <c>EvbDetector</c> API. This facade keeps those
/// call sites stable while the authoritative PE-signature logic lives in
/// <see cref="EvbDetectionHelper"/>.
///
/// This class is engine-local and has no side effects.
/// </summary>
public static class EvbDetector
{
/// <summary>
/// Returns true when the game directory holds an EVB packed executable.
/// A packed project file (<c>*.evb</c>) in the folder is also accepted as a
/// decisive signal, in addition to the PE-signature check.
/// </summary>
public static bool IsEvbGame(string gameDirectory)
{
if (string.IsNullOrWhiteSpace(gameDirectory) || !Directory.Exists(gameDirectory))
{
return false;
}
try
{
// A packed project file in the folder is the strongest single signal.
if (Directory.GetFiles(gameDirectory, "*.evb", SearchOption.TopDirectoryOnly).Length > 0)
{
return true;
}
}
catch
{
// Fall through to the executable signature check.
}
return EvbDetectionHelper.FindEvbPackedExecutable(gameDirectory) != null;
}
/// <summary>
/// Resolves the executable that should be passed to the unpacker: the first
/// <c>.exe</c> in the folder that carries a decisive EVB signature, or null.
/// </summary>
public static string? FindPackedExecutable(string gameDirectory)
=> EvbDetectionHelper.FindEvbPackedExecutable(gameDirectory);
/// <summary>Returns true when the given executable is packed with EVB.</summary>
public static bool ContainsEvbSignature(string exePath)
=> EvbDetectionHelper.IsEvbPacked(exePath);
/// <summary>Re-exposes the engine name constant for callers that only reference this helper.</summary>
public static string EngineName => EngineDetectionHelper.EngineEvb;
}
}