/// <summary> /// Returns an instance of <see cref="InstallerDescription"/> built from data read from the given <paramref name="line"/>. /// If no instance can be build, null is returned. /// </summary> /// <param name="line"></param> /// <returns></returns> private static InstallerDescription ReadInstallerDescriptionFromLine(string line) { string irTypeString, irId, irDescr; if (!ReadValue(line, "Installer", null, out line) || !ReadValue(line, "Type", "\"", out irTypeString) || !ReadValue(line, "Id", "\"", out irId) || !ReadValue(line, "Description", "\"", out irDescr)) { return(null); } InstallerType irType; if (!ParserHelper.TryParseEnum(irTypeString, out irType)) { return(null); } if (irType == InstallerType.File && File.Exists(irId)) { return(InstallerDescription.CreateForFile(irDescr, irId)); } if (irType == InstallerType.OpaqueString) { return(InstallerDescription.CreateForOpaqueString(irDescr, irId)); } if (irType == InstallerType.Installer) { return(InstallerDescription.CreateForInstaller(irDescr, irId)); } return(null); }
/// <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; }
protected InsuranceBase(Guid insuranceIdentifier, InstallerDescription installerDescription, string machineId, DateTime creationDateTime, IEnumerable <AssemblyName> assemblies) { _insuranceId = insuranceIdentifier; _installerDescription = installerDescription; _machineId = machineId; _dateTime = creationDateTime; _assemblies = new List <AssemblyName>(assemblies); }
/// <summary> /// Initializes a new instance of <see cref="InsuranceFile"/>, which represents an insurance with the specified data. /// </summary> /// <param name="fileName"></param> /// <param name="guid"></param> /// <param name="installerDescription"></param> /// <param name="machineId"></param> /// <param name="timeStamp"></param> /// <param name="assemblies"></param> public InsuranceFile(string fileName, Guid guid, InstallerDescription installerDescription, string machineId, DateTime timeStamp, IEnumerable<AssemblyName> assemblies) : base(guid, installerDescription, machineId, timeStamp, assemblies) { if (!Path.IsPathRooted(fileName)) throw new ArgumentException("The filename specified must be a rooted path.", "fileName"); if (!Directory.Exists(Path.GetDirectoryName(fileName))) throw new DirectoryNotFoundException("\"" + Path.GetDirectoryName(fileName) + "\" can not be found."); _fileName = fileName; }
/// <summary> /// Initializes a new instance of <see cref="InsuranceFile"/>, which represents an insurance with the specified data. /// </summary> /// <param name="fileName"></param> /// <param name="guid"></param> /// <param name="installerDescription"></param> /// <param name="machineId"></param> /// <param name="timeStamp"></param> /// <param name="assemblies"></param> public InsuranceFile(string fileName, Guid guid, InstallerDescription installerDescription, string machineId, DateTime timeStamp, IEnumerable <AssemblyName> assemblies) : base(guid, installerDescription, machineId, timeStamp, assemblies) { if (!Path.IsPathRooted(fileName)) { throw new ArgumentException("The filename specified must be a rooted path.", "fileName"); } if (!Directory.Exists(Path.GetDirectoryName(fileName))) { throw new DirectoryNotFoundException("\"" + Path.GetDirectoryName(fileName) + "\" can not be found."); } _fileName = fileName; }
private void LoadDefaults() { DefaultApplicationDataFile = "ApplicationData.xml"; LibtoInject = "AppStract.Inject.dll"; WatcherExecutable = "AppStract.Watcher.exe"; WrapperExecutable = "Appstract.Wrapper.exe"; LibsToShare = new List <string>( new[] { "EasyHook.dll", "AppStract.Engine.dll", "AppStract.Host.dll", "AppStract.Inject.dll", "AppStract.Utilities.dll" }); GacCleanUpInsuranceFolder = HostCore.Runtime.StartUpDirectory + @"\GAC"; GacCleanUpInsuranceRegistryKey = @"Software\AppStract"; GacInstallerDescription = InstallerDescription.CreateForFile("AppStract Server", HostCore.Runtime.RunningExecutable); }
/// <summary> /// Returns an <see cref="InstallerDescription"/> built from data read from the specified registry key. /// </summary> /// <exception cref="ArgumentException"> /// An <see cref="ArgumentException"/> is thrown if any of the values specified in the registrykey is invalid. /// </exception> /// <param name="regKey"></param></param> /// <returns></returns> private static InstallerDescription ReadInstallerDescription(RegistryKey regKey) { var tmp = regKey.GetValue("type"); if (tmp == null) { throw new ArgumentException("The specified registry key doesn't contain a value for \"type\"", "regKey"); } var id = regKey.GetValue("id"); if (id == null) { throw new ArgumentException("The specified registry key doesn't contain a value for \"id\"", "regKey"); } var descr = regKey.GetValue("descr"); if (descr == null) { throw new ArgumentException("The specified registry key doesn't contain a value for \"descr\"", "regKey"); } InstallerType type; if (!ParserHelper.TryParseEnum(tmp.ToString(), out type)) { throw new ArgumentException("The specified registry key contains an invalid value for \"type\"", "regKey"); } switch (type) { case InstallerType.File: return(InstallerDescription.CreateForFile(descr.ToString(), id.ToString())); case InstallerType.Installer: return(InstallerDescription.CreateForInstaller(descr.ToString(), id.ToString())); case InstallerType.OpaqueString: return(InstallerDescription.CreateForOpaqueString(descr.ToString(), id.ToString())); } throw new Exception(); }
public InsuranceRegistryKey(string registryKey, Guid guid, InstallerDescription installerDescription, string machineId, DateTime timeStamp, IEnumerable<AssemblyName> assemblies) : base(guid, installerDescription, machineId, timeStamp, assemblies) { _registryKeyName = registryKey; }
public InsuranceRegistryKey(string registryKey, Guid guid, InstallerDescription installerDescription, string machineId, DateTime timeStamp, IEnumerable <AssemblyName> assemblies) : base(guid, installerDescription, machineId, timeStamp, assemblies) { _registryKeyName = registryKey; }
protected InsuranceBase(Guid insuranceIdentifier, InstallerDescription installerDescription, string machineId, DateTime creationDateTime, IEnumerable<AssemblyName> assemblies) { _insuranceId = insuranceIdentifier; _installerDescription = installerDescription; _machineId = machineId; _dateTime = creationDateTime; _assemblies = new List<AssemblyName>(assemblies); }