Little Registry Cleaner/Common Tools/TaskScheduler/NotV1SupportedException.cs

(完整代码) 1KB

using System;
using System.Diagnostics;
using System.Reflection;

namespace Common_Tools.TaskScheduler
{
	/// <summary>
	/// Abstract class for throwing a method specific exception.
	/// </summary>
	[System.Diagnostics.DebuggerStepThrough]
	public abstract class TSNotSupportedException : Exception
	{
		string myMessage;
		internal TSNotSupportedException()
		{
			StackTrace stackTrace = new StackTrace();
			StackFrame stackFrame = stackTrace.GetFrame(2);
			MethodBase methodBase = stackFrame.GetMethod();
			myMessage = string.Format("{0}.{1} is not supported on {2}", methodBase.DeclaringType.Name, methodBase.Name, this.LibName);
		}

		internal TSNotSupportedException(string message)
		{
			myMessage = message;
		}

		/// <summary>
		/// Gets a message that describes the current exception.
		/// </summary>
		public override string Message
		{
			get { return myMessage; }
		}

		internal abstract string LibName { get; }
	}

	/// <summary>
	/// Thrown when the calling method is not supported by Task Scheduler 1.0.
	/// </summary>
	[System.Diagnostics.DebuggerStepThrough]
	public class NotV1SupportedException : TSNotSupportedException
	{
		internal NotV1SupportedException() : base() { }
		internal NotV1SupportedException(string message) : base(message) { }
		internal override string LibName { get { return "Task Scheduler 1.0"; } }
	}

	/// <summary>
	/// Thrown when the calling method is not supported by Task Scheduler 1.0.
	/// </summary>
	[System.Diagnostics.DebuggerStepThrough]
	public class NotV2SupportedException : TSNotSupportedException
	{
		internal NotV2SupportedException() : base() { }
		internal NotV2SupportedException(string message) : base(message) { }
		internal override string LibName { get { return "Task Scheduler 2.0 (1.2)"; } }
	}
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。