Fix unreachable code warnings

This commit is contained in:
Slendy 2022-09-24 20:00:02 -05:00
commit ea5f216b1f
No known key found for this signature in database
GPG key ID: 7288D68361B91428
3 changed files with 11 additions and 12 deletions

View file

@ -144,9 +144,7 @@
</div>
</div>
</noscript>
@* ReSharper disable HeuristicUnreachableCode *@
@* ReSharper disable CSharpWarnings::CS0162 *@
@if (!ServerStatics.IsDebug && VersionHelper.IsDirty)
@if (!ServerStatics.IsDebug() && VersionHelper.IsDirty)
{
<div class="ui bottom attached red message large">
<div class="ui container">
@ -166,8 +164,6 @@
</div>
</div>
}
@* ReSharper restore CSharpWarnings::CS0162 *@
@* ReSharper restore HeuristicUnreachableCode *@
</header>
<div class="main">
<div class="ui container">
@ -197,7 +193,7 @@
}
</div>
</div>
@if (ServerStatics.IsDebug)
@if (ServerStatics.IsDebug())
{
<div class="ui red attached inverted segment">
<div class="ui container">

View file

@ -85,7 +85,7 @@
<br><br>
@if (ServerStatics.IsDebug)
@if (ServerStatics.IsDebug())
{
<button class="ui red button" onclick="fill()">DEBUG: Fill with everything but email</button>

View file

@ -27,11 +27,14 @@ public static class ServerStatics
// FIXME: This needs to go at some point.
public static bool IsUnitTesting => AppDomain.CurrentDomain.GetAssemblies().Any(assembly => assembly.FullName!.StartsWith("xunit"));
public static bool IsDebug()
{
#if DEBUG
public const bool IsDebug = true;
return true;
#else
public const bool IsDebug = false;
return false;
#endif
}
/// <summary>
/// The servertype, determined on startup. Shouldn't be null unless very very early in startup.