-
Notifications
You must be signed in to change notification settings - Fork 244
Expand file tree
/
Copy pathDeprecationHandler.cs
More file actions
25 lines (23 loc) · 1.01 KB
/
DeprecationHandler.cs
File metadata and controls
25 lines (23 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using kOS.Safe.Encapsulation;
using kOS.Safe.Exceptions;
namespace kOS.Safe.Utilities
{
public static class DeprecationHandler
{
private const string DeprecationMessage =
"WARNING: Usage of {0} is being deprecated.\nUse {1} instead.\n"+
"At kOS version {2} this usage will be removed.\n"+
"To disable these warnings do \"config:deprecatedwarnings off.\"";
public static void DeprecatedUsage(SafeSharedObjects shared, string oldUsage, string newUsage, VersionInfo completeDeprecationVersion)
{
if (SafeHouse.Version.SystemVersion >= completeDeprecationVersion.SystemVersion)
{
throw new KOSObsoletionException(completeDeprecationVersion.ToString(), oldUsage, newUsage, null);
}
if (SafeHouse.Config.DeprecatedWarnings)
{
shared.Screen.Print(string.Format(DeprecationMessage, oldUsage, newUsage, completeDeprecationVersion), true);
}
}
}
}