mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-01-15 05:42:46 +01:00
39 lines
761 B
C#
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();
|
|
}
|
|
}
|
|
}
|
|
}
|