Files
RobustToolbox/Robust.Shared/Network/NetApproval.cs
Acruid 2183cd7ca1 Massive Namespace Cleanup (#1544)
* Removed the Interfaces folder.
* All objects inside the GameObjects subfolders are now in the GameObjects namespace.
* Added a Resharper DotSettings file to mark the GameObjects subfolders as not providing namespaces.
* Simplified Robust.client.Graphics namespace.
* Automated remove redundant using statements.
2021-02-10 23:27:19 -08:00

31 lines
666 B
C#

using System;
namespace Robust.Shared.Network
{
public struct NetApproval
{
public bool IsApproved => _denyReason == null;
public string DenyReason => _denyReason != null
? _denyReason!
: throw new InvalidOperationException("This was not a denial.");
private readonly string? _denyReason;
private NetApproval(string? denyReason)
{
_denyReason = denyReason;
}
public static NetApproval Deny(string reason)
{
return new(reason);
}
public static NetApproval Allow()
{
return new(null);
}
}
}