/// <summary> /// Initializes a new instance of <see cref="InsuranceData"/>, /// which can be used with <see cref="CleanUpInsurance.CreateInsurance"/>. /// </summary> /// <param name="usingInstaller">The <see cref="InstallerDescription"/> for the application that's installing and uninstalling the insured assemblies.</param> /// <param name="flags">The flags to base the method of insurance on.</param> /// <param name="trackingFilesFolder">The folder containing all files used to track insurances.</param> /// <param name="trackingRegistryKey">The registry key containing all keys used to track insurances.</param> /// <param name="trackingProcessExecutable">The filename of the executable to use when starting a watcher process.</param> public InsuranceData(InstallerDescription usingInstaller, CleanUpInsuranceFlags flags, string trackingFilesFolder, string trackingRegistryKey, string trackingProcessExecutable) { _installer = usingInstaller; _flags = flags; _trackingFilesFolder = trackingFilesFolder; _trackingRegistryKey = trackingRegistryKey; _trackingProcessExe = trackingProcessExecutable; }
/// <summary> /// Removes all specified ways of insuring from the local system, for the current <see cref="CleanUpInsurance"/>. /// The specified assemblies are NOT uninstalled from the global assembly cache. /// </summary> /// <param name="flags">The ways of insuring that need to be disposed.</param> public void Dispose(CleanUpInsuranceFlags flags) { if (flags.IsSpecified(CleanUpInsuranceFlags.TrackByFile)) { DisposeFileInsurance(); } if (flags.IsSpecified((CleanUpInsuranceFlags.TrackByRegistry))) { DisposeRegistryInsurance(); } if (flags.IsSpecified(CleanUpInsuranceFlags.ByWatchService)) { DisposeProcessInsurance(); } }
/// <summary> /// Returns whether the <see cref="CleanUpInsuranceFlags"/> specified is/are defined in the current <see cref="CleanUpInsuranceFlags"/>. /// </summary> /// <param name="flags"></param> /// <param name="flag"></param> /// <returns></returns> public static bool IsSpecified(this CleanUpInsuranceFlags flags, CleanUpInsuranceFlags flag) { return ((flags & flag) == flag); }
private void LoadDefaults() { LogFile = "AppStract.log"; GacCleanUpInsuranceFlags = CleanUpInsuranceFlags.TrackByRegistry | CleanUpInsuranceFlags.ByWatchService; }
/// <summary> /// Removes all specified ways of insuring from the local system, for the current <see cref="CleanUpInsurance"/>. /// The specified assemblies are NOT uninstalled from the global assembly cache. /// </summary> /// <param name="flags">The ways of insuring that need to be disposed.</param> public void Dispose(CleanUpInsuranceFlags flags) { if (flags.IsSpecified(CleanUpInsuranceFlags.TrackByFile)) DisposeFileInsurance(); if (flags.IsSpecified((CleanUpInsuranceFlags.TrackByRegistry))) DisposeRegistryInsurance(); if (flags.IsSpecified(CleanUpInsuranceFlags.ByWatchService)) DisposeProcessInsurance(); }
/// <summary> /// Returns whether the <see cref="CleanUpInsuranceFlags"/> specified is/are defined in the current <see cref="CleanUpInsuranceFlags"/>. /// </summary> /// <param name="flags"></param> /// <param name="flag"></param> /// <returns></returns> public static bool IsSpecified(this CleanUpInsuranceFlags flags, CleanUpInsuranceFlags flag) { return((flags & flag) == flag); }