MalwareSourceCode/MSIL/Virus/Win32/N/Virus.Win32.Nimnul.c-d5c6463b93131b3c485115414cf5809e01323986e3d4274a4868222cbb54aa43/Shared/ErrorUtilities.cs

194 lines
5.8 KiB
C#
Raw Normal View History

2022-08-18 11:28:56 +00:00
// Decompiled with JetBrains decompiler
// Type: Microsoft.Build.Shared.ErrorUtilities
// Assembly: MSBuild, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// MVID: E42BAB90-704E-4C03-B5C0-D4E3A6B884E3
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00001-msil\Virus.Win32.Nimnul.c-d5c6463b93131b3c485115414cf5809e01323986e3d4274a4868222cbb54aa43.exe
using System;
namespace Microsoft.Build.Shared
{
internal static class ErrorUtilities
{
private static void ThrowInternalError(
bool showAssert,
string unformattedMessage,
params object[] args)
{
throw new InternalErrorException(ResourceUtilities.FormatString(unformattedMessage, args), showAssert);
}
internal static void VerifyThrowNoAssert(bool condition, string unformattedMessage)
{
if (condition)
return;
ErrorUtilities.ThrowInternalError(false, unformattedMessage, (object[]) null);
}
internal static void VerifyThrow(bool condition, string unformattedMessage)
{
if (condition)
return;
ErrorUtilities.ThrowInternalError(true, unformattedMessage, (object[]) null);
}
internal static void VerifyThrow(bool condition, string unformattedMessage, object arg0)
{
if (condition)
return;
ErrorUtilities.ThrowInternalError(true, unformattedMessage, arg0);
}
internal static void VerifyThrow(
bool condition,
string unformattedMessage,
object arg0,
object arg1)
{
if (condition)
return;
ErrorUtilities.ThrowInternalError(true, unformattedMessage, arg0, arg1);
}
internal static void VerifyThrow(
bool condition,
string unformattedMessage,
object arg0,
object arg1,
object arg2)
{
if (condition)
return;
ErrorUtilities.ThrowInternalError(true, unformattedMessage, arg0, arg1, arg2);
}
internal static void VerifyThrow(
bool condition,
string unformattedMessage,
object arg0,
object arg1,
object arg2,
object arg3)
{
if (condition)
return;
ErrorUtilities.ThrowInternalError(true, unformattedMessage, arg0, arg1, arg2, arg3);
}
private static void ThrowInvalidOperation(string resourceName, params object[] args) => throw new InvalidOperationException(ResourceUtilities.FormatResourceString(resourceName, args));
internal static void VerifyThrowInvalidOperation(bool condition, string resourceName)
{
if (condition)
return;
ErrorUtilities.ThrowInvalidOperation(resourceName, (object[]) null);
}
internal static void VerifyThrowInvalidOperation(
bool condition,
string resourceName,
object arg0)
{
if (condition)
return;
ErrorUtilities.ThrowInvalidOperation(resourceName, arg0);
}
internal static void VerifyThrowInvalidOperation(
bool condition,
string resourceName,
object arg0,
object arg1)
{
if (condition)
return;
ErrorUtilities.ThrowInvalidOperation(resourceName, arg0, arg1);
}
internal static void VerifyThrowInvalidOperation(
bool condition,
string resourceName,
object arg0,
object arg1,
object arg2)
{
if (condition)
return;
ErrorUtilities.ThrowInvalidOperation(resourceName, arg0, arg1, arg2);
}
private static void ThrowArgument(
Exception innerException,
string resourceName,
params object[] args)
{
throw new ArgumentException(ResourceUtilities.FormatResourceString(resourceName, args), innerException);
}
internal static void VerifyThrowArgument(bool condition, string resourceName) => ErrorUtilities.VerifyThrowArgument(condition, (Exception) null, resourceName);
internal static void VerifyThrowArgument(bool condition, string resourceName, object arg0) => ErrorUtilities.VerifyThrowArgument(condition, (Exception) null, resourceName, arg0);
internal static void VerifyThrowArgument(
bool condition,
string resourceName,
object arg0,
object arg1)
{
ErrorUtilities.VerifyThrowArgument(condition, (Exception) null, resourceName, arg0, arg1);
}
internal static void VerifyThrowArgument(
bool condition,
Exception innerException,
string resourceName)
{
if (condition)
return;
ErrorUtilities.ThrowArgument(innerException, resourceName, (object[]) null);
}
internal static void VerifyThrowArgument(
bool condition,
Exception innerException,
string resourceName,
object arg0)
{
if (condition)
return;
ErrorUtilities.ThrowArgument(innerException, resourceName, arg0);
}
internal static void VerifyThrowArgument(
bool condition,
Exception innerException,
string resourceName,
object arg0,
object arg1)
{
if (condition)
return;
ErrorUtilities.ThrowArgument(innerException, resourceName, arg0, arg1);
}
internal static void VerifyThrowArgumentOutOfRange(bool condition, string parameterName)
{
if (!condition)
throw new ArgumentOutOfRangeException(parameterName);
}
internal static void VerifyThrowArgumentLength(string parameter, string parameterName)
{
ErrorUtilities.VerifyThrowArgumentNull((object) parameter, parameterName);
if (parameter.Length == 0)
throw new ArgumentException(ResourceUtilities.FormatResourceString("Shared.ParameterCannotHaveZeroLength", (object) parameterName));
}
internal static void VerifyThrowArgumentNull(object parameter, string parameterName)
{
if (parameter == null)
throw new ArgumentNullException(ResourceUtilities.FormatResourceString("Shared.ParameterCannotBeNull", (object) parameterName), (Exception) null);
}
}
}