Minor tweaks
This commit is contained in:
parent
c512934ba2
commit
c4c7489fef
@ -1,17 +1,15 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
using AutoRetainerAPI;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Services;
|
||||
using ECommons;
|
||||
using FFXIVClientStructs.FFXIV.Client.System.Framework;
|
||||
using LLib;
|
||||
|
||||
namespace AutoShutdown;
|
||||
|
||||
public class Plogon : IDalamudPlugin
|
||||
public sealed class Plogon : IDalamudPlugin
|
||||
{
|
||||
private readonly AutoRetainerApi _autoRetainerApi;
|
||||
private readonly DalamudReflector _reflector;
|
||||
|
@ -2,16 +2,24 @@
|
||||
|
||||
namespace TheWatcher;
|
||||
|
||||
internal class Program
|
||||
internal sealed class Program
|
||||
{
|
||||
public static async Task Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("o.O");
|
||||
|
||||
CancellationTokenSource cts = new CancellationTokenSource();
|
||||
using CancellationTokenSource cts = new CancellationTokenSource();
|
||||
Console.CancelKeyPress += (_, e) =>
|
||||
{
|
||||
cts.Cancel();
|
||||
try
|
||||
{
|
||||
// ReSharper disable once AccessToDisposedClosure
|
||||
cts.Cancel();
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
{
|
||||
}
|
||||
|
||||
e.Cancel = true;
|
||||
};
|
||||
|
||||
@ -27,8 +35,8 @@ internal class Program
|
||||
else if (launchers.Length == 1)
|
||||
{
|
||||
Console.WriteLine($"Waiting for launcher {launchers.Single().Id} to finish");
|
||||
await launchers.Single().WaitForExitAsync(cts.Token);
|
||||
await Task.Delay(1000, cts.Token);
|
||||
await launchers.Single().WaitForExitAsync(cts.Token).ConfigureAwait(false);
|
||||
await Task.Delay(1000, cts.Token).ConfigureAwait(false);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -42,7 +50,7 @@ internal class Program
|
||||
else if (ffxiv.Length == 1)
|
||||
{
|
||||
Console.WriteLine($"Waiting for FFXIV {ffxiv.Single().Id} to finish");
|
||||
await ffxiv.Single().WaitForExitAsync(cts.Token);
|
||||
await ffxiv.Single().WaitForExitAsync(cts.Token).ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -54,14 +62,14 @@ internal class Program
|
||||
});
|
||||
if (process != null)
|
||||
{
|
||||
await process.WaitForExitAsync(cts.Token);
|
||||
await process.WaitForExitAsync(cts.Token).ConfigureAwait(false);
|
||||
Console.WriteLine("Started launcher...");
|
||||
}
|
||||
else
|
||||
Console.WriteLine("No process started?");
|
||||
}
|
||||
|
||||
await Task.Delay(1000, cts.Token);
|
||||
await Task.Delay(1000, cts.Token).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user