Skip to content

Commit

Permalink
fix: モード切替における無限ループの判定方法を変更
Browse files Browse the repository at this point in the history
  • Loading branch information
automatic9045 committed Jan 3, 2025
1 parent f817e11 commit 2613fe8
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 286 deletions.
2 changes: 0 additions & 2 deletions BveEx/BveEx.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,6 @@
<Content Include="Resources\Plugins\Native\Library.resx" />
<Content Include="Resources\PluginListTabPage.resx" />
<Content Include="Resources\PluginListTabPage.ja.resx" />
<Content Include="Resources\LaunchModeManager.ja.resx" />
<Content Include="Resources\LaunchModeManager.resx" />
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
Expand Down
33 changes: 1 addition & 32 deletions BveEx/Launching/LaunchModeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,19 @@
using System.Text;
using System.Threading.Tasks;

using UnembeddedResources;

using BveEx.PluginHost;

namespace BveEx.Launching
{
internal static class LaunchModeManager
{
private class ResourceSet
{
private readonly ResourceLocalizer Localizer = ResourceLocalizer.FromResXOfType(typeof(LaunchModeManager), "Core");

[ResourceStringHolder(nameof(Localizer))] public Resource<string> ConflictedMessage { get; private set; }
[ResourceStringHolder(nameof(Localizer))] public Resource<string> ConflictedApproach { get; private set; }

public ResourceSet()
{
ResourceLoader.LoadAndSetAll(this);
}
}

private static readonly Lazy<ResourceSet> Resources = new Lazy<ResourceSet>();

static LaunchModeManager()
{
#if DEBUG
_ = Resources.Value;
#endif
}

public static void RestartAsLegacyMode(string scenarioPath)
{
string[] commandLineArgs = Environment.GetCommandLineArgs();
if (commandLineArgs.Contains("/bveex-modechanged", StringComparer.OrdinalIgnoreCase))
{
ErrorDialog.Show(5, Resources.Value.ConflictedMessage.Value, Resources.Value.ConflictedApproach.Value);
throw new InvalidOperationException(Resources.Value.ConflictedMessage.Value);
}

string legacyFilePath = Path.Combine(Path.GetDirectoryName(App.Instance.BveExLauncherAssembly.Location), ".LEGACY");
File.Create(legacyFilePath).Close();
File.SetAttributes(legacyFilePath, FileAttributes.Hidden);

Process.Start(App.Instance.BveAssembly.Location, scenarioPath is null ? string.Empty : $"\"{scenarioPath}\" /bveex-modechanged");
Process.Start(App.Instance.BveAssembly.Location, scenarioPath is null ? string.Empty : $"\"{scenarioPath}\"");
Environment.Exit(0);
}
}
Expand Down
126 changes: 0 additions & 126 deletions BveEx/Resources/LaunchModeManager.ja.resx

This file was deleted.

126 changes: 0 additions & 126 deletions BveEx/Resources/LaunchModeManager.resx

This file was deleted.

0 comments on commit 2613fe8

Please sign in to comment.