1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2024-10-17 09:42:45 +02:00
TweetDuck/lib/TweetLib.Utils/Startup/LockResult.cs

39 lines
761 B
C#

using System;
using System.Diagnostics;
namespace TweetLib.Utils.Startup {
public class LockResult {
private readonly string name;
private LockResult(string name) {
this.name = name;
}
public override string ToString() {
return name;
}
public static LockResult Success { get; } = new ("Success");
public sealed class Fail : LockResult {
public Exception Exception { get; }
internal Fail(Exception exception) : base("Fail") {
this.Exception = exception;
}
}
public sealed class HasProcess : LockResult, IDisposable {
public Process Process { get; }
internal HasProcess(Process process) : base("HasProcess") {
this.Process = process;
}
public void Dispose() {
Process.Dispose();
}
}
}
}