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