public void DeleteWorkloadInstallationRecord(WorkloadId workloadId, SdkFeatureBand featureBand) { var path = Path.Combine(_workloadMetadataDir, featureBand.ToString(), _installedWorkloadDir, workloadId.ToString()); if (File.Exists(path)) { GC.Collect(); GC.WaitForPendingFinalizers(); File.Delete(path); } }
public void WriteWorkloadInstallationRecord(WorkloadId workloadId, SdkFeatureBand featureBand) { var path = Path.Combine(_workloadMetadataDir, featureBand.ToString(), _installedWorkloadDir, workloadId.ToString()); if (!File.Exists(path)) { var pathDir = Path.GetDirectoryName(path); if (pathDir != null && !Directory.Exists(pathDir)) { Directory.CreateDirectory(pathDir); } File.Create(path); } }
public IEnumerable <WorkloadId> GetInstalledWorkloads(SdkFeatureBand featureBand) { var path = Path.Combine(_workloadMetadataDir, featureBand.ToString(), _installedWorkloadDir); if (Directory.Exists(path)) { return(Directory.EnumerateFiles(path) .Select(file => new WorkloadId(Path.GetFileName(file)))); } else { return(new List <WorkloadId>()); } }
public void DeleteWorkloadInstallationRecord(WorkloadId workloadId, SdkFeatureBand sdkFeatureBand) { Elevate(); if (IsElevated) { string workloadInstallationKeyName = Path.Combine(BasePath, $"{sdkFeatureBand}", $"{workloadId}"); Log?.LogMessage($"Deleting {workloadInstallationKeyName}"); _baseKey.DeleteSubKeyTree(workloadInstallationKeyName, throwOnMissingSubKey: false); } else if (IsClient) { InstallResponseMessage response = Dispatcher.SendWorkloadRecordRequest(InstallRequestType.DeleteWorkloadInstallationRecord, workloadId, sdkFeatureBand); ExitOnFailure(response, "Failed to delete workload record key."); } }
public void WriteWorkloadInstallationRecord(WorkloadId workloadId, SdkFeatureBand sdkFeatureBand) { Elevate(); if (IsElevated) { string subkeyName = Path.Combine(BasePath, $"{sdkFeatureBand}", $"{workloadId}"); Log?.LogMessage($"Creating {subkeyName}"); using RegistryKey workloadRecordKey = _baseKey.CreateSubKey(subkeyName); if (workloadRecordKey == null) { Log?.LogMessage($"Failed to create {subkeyName}"); } } else if (IsClient) { InstallResponseMessage response = Dispatcher.SendWorkloadRecordRequest(InstallRequestType.WriteWorkloadInstallationRecord, workloadId, sdkFeatureBand); ExitOnFailure(response, "Failed to write workload record key."); } }
public void WriteWorkloadInstallationRecord(WorkloadId workloadId, SdkFeatureBand sdkFeatureBand) { using RegistryKey wrk = _baseKey.CreateSubKey(Path.Combine(BasePath, $"{sdkFeatureBand}", $"{workloadId}")); }
public void DeleteWorkloadInstallationRecord(WorkloadId workloadId, SdkFeatureBand sdkFeatureBand) { _baseKey.DeleteSubKeyTree(Path.Combine(BasePath, $"{sdkFeatureBand}", $"{workloadId}"), throwOnMissingSubKey: false); }