Little Registry Cleaner/Common Tools/TaskScheduler/TaskService.cs
(开头部分) 19KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
namespace Common_Tools.TaskScheduler
{
/// <summary>
/// Provides access to the Task Scheduler service for managing registered tasks.
/// </summary>
[Description("Provides access to the Task Scheduler service.")]
public sealed class TaskService : Component, IDisposable, ISupportInitialize
{
internal static readonly bool hasV2 = (Environment.OSVersion.Version >= new Version(6, 0));
internal static readonly Version v1Ver = new Version(1, 1);
internal V1Interop.ITaskScheduler v1TaskScheduler = null;
internal V2Interop.TaskSchedulerClass v2TaskService = null;
private bool forceV1 = false;
private bool initializing = false;
private Version maxVer;
private bool maxVerSet = false;
private string targetServer = null;
private bool targetServerSet = false;
private string userDomain = null;
private bool userDomainSet = false;
private string userName = null;
private bool userNameSet = false;
private string userPassword = null;
private bool userPasswordSet = false;
private WindowsImpersonatedIdentity v1Impersonation = null;
/// <summary>
/// Creates a new instance of a TaskService connecting to the local machine as the current user.
/// </summary>
public TaskService()
{
ResetHighestSupportedVersion();
Connect();
}
/// <summary>
/// Initializes a new instance of the <see cref="TaskService"/> class.
/// </summary>
/// <param name="targetServer">The name of the computer that you want to connect to. If the this parameter is empty, then this will connect to the local computer.</param>
/// <param name="userName">The user name that is used during the connection to the computer. If the user is not specified, then the current token is used.</param>
/// <param name="accountDomain">The domain of the user specified in the <paramref name="userName"/> parameter.</param>
/// <param name="password">The password that is used to connect to the computer. If the user name and password are not specified, then the current token is used.</param>
/// <param name="forceV1">If set to <c>true</c> force Task Scheduler 1.0 compatibility.</param>
public TaskService(string targetServer, string userName = null, string accountDomain = null, string password = null, bool forceV1 = false)
{
this.BeginInit();
this.TargetServer = targetServer;
this.UserName = userName;
this.UserAccountDomain = accountDomain;
this.UserPassword = password;
this.forceV1 = forceV1;
ResetHighestSupportedVersion();
this.EndInit();
}
后面还有 476 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。