mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
cleanup necessary namespaces and adjust namespaces for certain classes to better represent what they're for models, helpers and tools are all different and shouldnt really be under the same namespace
48 lines
1.1 KiB
C#
48 lines
1.1 KiB
C#
/*
|
|
* Roblox Studio Mod Manager (ProjectSrc/Utility/SystemEvent.cs)
|
|
* MIT License
|
|
* Copyright (c) 2015-present MaximumADHD
|
|
*/
|
|
|
|
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Bloxstrap.Tools
|
|
{
|
|
public class SystemEvent : EventWaitHandle
|
|
{
|
|
public string Name { get; private set; }
|
|
|
|
public SystemEvent(string name, bool init = false, EventResetMode mode = EventResetMode.AutoReset) : base(init, mode, name)
|
|
{
|
|
if (init)
|
|
Reset();
|
|
else
|
|
Set();
|
|
|
|
Name = name;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return Name;
|
|
}
|
|
|
|
public Task<bool> WaitForEvent()
|
|
{
|
|
return Task.Run(WaitOne);
|
|
}
|
|
|
|
public Task<bool> WaitForEvent(TimeSpan timeout, bool exitContext = false)
|
|
{
|
|
return Task.Run(() => WaitOne(timeout, exitContext));
|
|
}
|
|
|
|
public Task<bool> WaitForEvent(int millisecondsTimeout, bool exitContext = false)
|
|
{
|
|
return Task.Run(() => WaitOne(millisecondsTimeout, exitContext));
|
|
}
|
|
}
|
|
}
|