diff --git a/AppControl Manager/AppControl Manager.csproj b/AppControl Manager/AppControl Manager.csproj
index 20f7bf6c8..32836a671 100644
--- a/AppControl Manager/AppControl Manager.csproj
+++ b/AppControl Manager/AppControl Manager.csproj
@@ -88,7 +88,7 @@
AppControlManager
False
send
- 1.6.0.0
+ 1.7.0.0
$(FileVersion)
en-US
LICENSE
@@ -101,7 +101,7 @@
$(FileVersion)
- © 2024–Present
+ © 2024-Present
AppControl Manager
diff --git a/AppControl Manager/Logic/App Control Simulation/Arbitrator.cs b/AppControl Manager/Logic/App Control Simulation/Arbitrator.cs
index 8c6ee4e8e..591052c8b 100644
--- a/AppControl Manager/Logic/App Control Simulation/Arbitrator.cs
+++ b/AppControl Manager/Logic/App Control Simulation/Arbitrator.cs
@@ -83,13 +83,12 @@ internal static SimulationOutput Compare(SimulationInput simulationInput)
// At this point the file is definitely WHQL-Signed
// Get the WHQL chain packages by checking for any chain whose leaf certificate contains the WHQL EKU OID
- List WHQLChainPackagesCandidates = simulationInput.AllFileSigners
+ List WHQLChainPackagesCandidates = [.. simulationInput.AllFileSigners
.Where(sig => sig.LeafCertificate is not null &&
sig.LeafCertificate.Certificate.Extensions
.OfType()
.Any(eku => eku.EnhancedKeyUsages.Cast()
- .Any(oid => oid.Value is not null && oid.Value.Contains("1.3.6.1.4.1.311.10.3.5", StringComparison.OrdinalIgnoreCase))))
- .ToList();
+ .Any(oid => oid.Value is not null && oid.Value.Contains("1.3.6.1.4.1.311.10.3.5", StringComparison.OrdinalIgnoreCase))))];
// HashSet to store all of the Opus data from the WHQL chain packages candidates
@@ -106,7 +105,7 @@ internal static SimulationOutput Compare(SimulationInput simulationInput)
try
{
// Try to get the Opus data of the current chain (essentially the current chain's leaf certificate)
- CurrentOpusData = Opus.GetOpusData(chainPackage.SignedCms).Select(p => p.CertOemID).ToList();
+ CurrentOpusData = [.. Opus.GetOpusData(chainPackage.SignedCms).Select(p => p.CertOemID)];
}
catch
{
diff --git a/AppControl Manager/Logic/IntelGathering/GetMDEAdvancedHuntingLogsData.cs b/AppControl Manager/Logic/IntelGathering/GetMDEAdvancedHuntingLogsData.cs
index a079e66b6..c0ed017cd 100644
--- a/AppControl Manager/Logic/IntelGathering/GetMDEAdvancedHuntingLogsData.cs
+++ b/AppControl Manager/Logic/IntelGathering/GetMDEAdvancedHuntingLogsData.cs
@@ -52,7 +52,7 @@ internal static HashSet Retrieve(List data
MDEAdvancedHuntingData? possibleAppLockerBlockEvent = group.FirstOrDefault(g => string.Equals(g.ActionType, "AppControlCIScriptBlocked", StringComparison.OrdinalIgnoreCase));
// Get the possible correlated data
- List correlatedEvents = group.Where(g => string.Equals(g.ActionType, "AppControlCodeIntegritySigningInformation", StringComparison.OrdinalIgnoreCase)).ToList();
+ List correlatedEvents = [.. group.Where(g => string.Equals(g.ActionType, "AppControlCodeIntegritySigningInformation", StringComparison.OrdinalIgnoreCase))];
// The SHA256 must be available in Audit/Block type of events for either Code Integrity or AppLocker
diff --git a/AppControl Manager/Logic/Main/AppControlSimulation.cs b/AppControl Manager/Logic/Main/AppControlSimulation.cs
index 7db3a2bda..3cea634ba 100644
--- a/AppControl Manager/Logic/Main/AppControlSimulation.cs
+++ b/AppControl Manager/Logic/Main/AppControlSimulation.cs
@@ -231,7 +231,7 @@ internal static ConcurrentDictionary Invoke(
if (catRootPath is not null && catRootPath.Count > 0)
{
- catRootDirectories = catRootPath.Select(dir => new DirectoryInfo(dir)).ToArray();
+ catRootDirectories = [.. catRootPath.Select(dir => new DirectoryInfo(dir))];
}
else
{
@@ -266,7 +266,7 @@ internal static ConcurrentDictionary Invoke(
// Hash Sha256 values of all the file rules based on hash in the supplied xml policy file
Logger.Write("Getting the Sha256 Hash values of all the file rules based on hash in the supplied xml policy file");
- HashSet SHA256HashesFromXML = GetFileRuleOutput.Get(XMLData).Select(i => i.HashValue).ToHashSet();
+ HashSet SHA256HashesFromXML = [.. GetFileRuleOutput.Get(XMLData).Select(i => i.HashValue)];
Logger.Write("Getting all of the file paths of the files that App Control supports, from the user provided directory");
diff --git a/AppControl Manager/Logic/Main/BasePolicyCreator.cs b/AppControl Manager/Logic/Main/BasePolicyCreator.cs
index 70dd4c0aa..1a6104413 100644
--- a/AppControl Manager/Logic/Main/BasePolicyCreator.cs
+++ b/AppControl Manager/Logic/Main/BasePolicyCreator.cs
@@ -604,7 +604,7 @@ internal static void GetBlockRules(string StagingArea, bool deploy)
Logger.Write($"Checking if the {policyName} policy is already deployed");
// Getting the list of the deployed base policies whose names match the policyName
- List CurrentlyDeployedBlockRules = CiToolHelper.GetPolicies(false, true, false).Where(policy => string.Equals(policy.FriendlyName, policyName, StringComparison.OrdinalIgnoreCase)).ToList();
+ List CurrentlyDeployedBlockRules = [.. CiToolHelper.GetPolicies(false, true, false).Where(policy => string.Equals(policy.FriendlyName, policyName, StringComparison.OrdinalIgnoreCase))];
// If any policy was found
if (CurrentlyDeployedBlockRules.Count > 0)
diff --git a/AppControl Manager/Logic/SupplementalForSelf.cs b/AppControl Manager/Logic/SupplementalForSelf.cs
index fcc6b64fc..ce3ef12dc 100644
--- a/AppControl Manager/Logic/SupplementalForSelf.cs
+++ b/AppControl Manager/Logic/SupplementalForSelf.cs
@@ -54,9 +54,9 @@ internal static void Deploy(string StagingArea, string basePolicyID)
List CurrentlyDeployedSupplementalPolicyNoFilter = CiToolHelper.GetPolicies(false, false, true);
- List CurrentlyDeployedSupplementalPolicy1stFilter = CurrentlyDeployedSupplementalPolicyNoFilter.Where(policy => string.Equals(policy.FriendlyName, policyName, StringComparison.OrdinalIgnoreCase)).ToList();
+ List CurrentlyDeployedSupplementalPolicy1stFilter = [.. CurrentlyDeployedSupplementalPolicyNoFilter.Where(policy => string.Equals(policy.FriendlyName, policyName, StringComparison.OrdinalIgnoreCase))];
- List CurrentlyDeployedSupplementalPolicy = CurrentlyDeployedSupplementalPolicy1stFilter.Where(policy => string.Equals(policy.BasePolicyID, trimmedBasePolicyID, StringComparison.OrdinalIgnoreCase)).ToList();
+ List CurrentlyDeployedSupplementalPolicy = [.. CurrentlyDeployedSupplementalPolicy1stFilter.Where(policy => string.Equals(policy.BasePolicyID, trimmedBasePolicyID, StringComparison.OrdinalIgnoreCase))];
if (CurrentlyDeployedSupplementalPolicy.Count > 0)
{
diff --git a/AppControl Manager/Logic/XMLOps/NewPFNLevelRules.cs b/AppControl Manager/Logic/XMLOps/NewPFNLevelRules.cs
index 5120e68ae..68cc94d89 100644
--- a/AppControl Manager/Logic/XMLOps/NewPFNLevelRules.cs
+++ b/AppControl Manager/Logic/XMLOps/NewPFNLevelRules.cs
@@ -40,7 +40,7 @@ internal static void Create(string xmlFilePath, List packageFamilyNames)
}
// Make sure the PackageFamilyNames are unique and have no duplicates
- packageFamilyNames = packageFamilyNames.Distinct().ToList();
+ packageFamilyNames = [.. packageFamilyNames.Distinct()];
foreach (string PFN in packageFamilyNames)
{
diff --git a/AppControl Manager/MainWindow.xaml.cs b/AppControl Manager/MainWindow.xaml.cs
index b7af63fc2..8792ac612 100644
--- a/AppControl Manager/MainWindow.xaml.cs
+++ b/AppControl Manager/MainWindow.xaml.cs
@@ -910,9 +910,7 @@ private void SearchBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChan
string query = sender.Text.ToLowerInvariant();
// Filter menu items based on the search query
- List suggestions = menuItems.Keys
- .Where(name => name.Contains(query, StringComparison.OrdinalIgnoreCase))
- .ToList();
+ List suggestions = [.. menuItems.Keys.Where(name => name.Contains(query, StringComparison.OrdinalIgnoreCase))];
// Set the filtered items as suggestions in the AutoSuggestBox
diff --git a/AppControl Manager/Package.appxmanifest b/AppControl Manager/Package.appxmanifest
index bf71d0e35..35691fafe 100644
--- a/AppControl Manager/Package.appxmanifest
+++ b/AppControl Manager/Package.appxmanifest
@@ -11,7 +11,7 @@
+ Version="1.7.0.0" />
diff --git a/AppControl Manager/Pages/AllowNewApps/AllowNewAppsEventLogsDataGrid.xaml.cs b/AppControl Manager/Pages/AllowNewApps/AllowNewAppsEventLogsDataGrid.xaml.cs
index fa33d6e9d..a4ed9e6ec 100644
--- a/AppControl Manager/Pages/AllowNewApps/AllowNewAppsEventLogsDataGrid.xaml.cs
+++ b/AppControl Manager/Pages/AllowNewApps/AllowNewAppsEventLogsDataGrid.xaml.cs
@@ -320,7 +320,7 @@ private void DeSelectAll_Click(object sender, RoutedEventArgs e)
private void DataGridFlyoutMenuDelete_Click(object sender, RoutedEventArgs e)
{
// Collect the selected items to delete
- List itemsToDelete = FileIdentitiesDataGrid.SelectedItems.Cast().ToList();
+ List itemsToDelete = [.. FileIdentitiesDataGrid.SelectedItems.Cast()];
// Remove each selected item from the FileIdentities collection
foreach (FileIdentity item in itemsToDelete)
diff --git a/AppControl Manager/Pages/AllowNewApps/AllowNewAppsLocalFilesDataGrid.xaml.cs b/AppControl Manager/Pages/AllowNewApps/AllowNewAppsLocalFilesDataGrid.xaml.cs
index 4b1cfba64..d991b48be 100644
--- a/AppControl Manager/Pages/AllowNewApps/AllowNewAppsLocalFilesDataGrid.xaml.cs
+++ b/AppControl Manager/Pages/AllowNewApps/AllowNewAppsLocalFilesDataGrid.xaml.cs
@@ -319,7 +319,7 @@ private void DeSelectAll_Click(object sender, RoutedEventArgs e)
private void DataGridFlyoutMenuDelete_Click(object sender, RoutedEventArgs e)
{
// Collect the selected items to delete
- List itemsToDelete = FileIdentitiesDataGrid.SelectedItems.Cast().ToList();
+ List itemsToDelete = [.. FileIdentitiesDataGrid.SelectedItems.Cast()];
// Remove each selected item from the FileIdentities collection
foreach (FileIdentity item in itemsToDelete)
diff --git a/AppControl Manager/Pages/AllowNewApps/AllowNewAppsStart.xaml.cs b/AppControl Manager/Pages/AllowNewApps/AllowNewAppsStart.xaml.cs
index 5d2699a08..c6fe22906 100644
--- a/AppControl Manager/Pages/AllowNewApps/AllowNewAppsStart.xaml.cs
+++ b/AppControl Manager/Pages/AllowNewApps/AllowNewAppsStart.xaml.cs
@@ -10,7 +10,6 @@
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
-using System.Runtime.InteropServices.WindowsRuntime;
using System.Threading.Tasks;
@@ -244,7 +243,7 @@ await Task.Run(() =>
List allDeployedBasePolicies = CiToolHelper.GetPolicies(false, true, false);
// Get all the deployed base policyIDs
- List CurrentlyDeployedBasePolicyIDs = allDeployedBasePolicies.Select(p => p.BasePolicyID).ToList();
+ List CurrentlyDeployedBasePolicyIDs = [.. allDeployedBasePolicies.Select(p => p.BasePolicyID)];
// Trim the curly braces from the policyID
string trimmedPolicyID = codeIntegrityPolicy.PolicyID.TrimStart('{').TrimEnd('}');
@@ -382,7 +381,7 @@ await Task.Run(() =>
DirectoryInfo[] selectedDirectories = [];
// Convert user selected folder paths that are strings to DirectoryInfo objects
- selectedDirectories = selectedDirectoriesToScan.Select(dir => new DirectoryInfo(dir)).ToArray();
+ selectedDirectories = [.. selectedDirectoriesToScan.Select(dir => new DirectoryInfo(dir))];
// Get all of the AppControl compatible files from user selected directories
List DetectedFilesInSelectedDirectories = FileUtility.GetFilesFast(selectedDirectories, null, null);
@@ -434,9 +433,7 @@ await Task.Run(() =>
// Filter the logs and keep only ones generated after audit mode policy was deployed
await Task.Run(() =>
{
- Output = Output
- .Where(fileIdentity => fileIdentity.TimeCreated >= LogsScanStartTime)
- .ToHashSet();
+ Output = [.. Output.Where(fileIdentity => fileIdentity.TimeCreated >= LogsScanStartTime)];
});
diff --git a/AppControl Manager/Pages/CreateSupplementalPolicy.xaml.cs b/AppControl Manager/Pages/CreateSupplementalPolicy.xaml.cs
index b1b32dfda..8afaf57b8 100644
--- a/AppControl Manager/Pages/CreateSupplementalPolicy.xaml.cs
+++ b/AppControl Manager/Pages/CreateSupplementalPolicy.xaml.cs
@@ -372,12 +372,12 @@ await Task.Run(() =>
DirectoryInfo[] selectedDirectories = [];
// Convert user selected folder paths that are strings to DirectoryInfo objects
- selectedDirectories = filesAndFoldersFolderPaths.Select(dir => new DirectoryInfo(dir)).ToArray();
+ selectedDirectories = [.. filesAndFoldersFolderPaths.Select(dir => new DirectoryInfo(dir))];
FileInfo[] selectedFiles = [];
// Convert user selected file paths that are strings to FileInfo objects
- selectedFiles = filesAndFoldersFilePaths.Select(file => new FileInfo(file)).ToArray();
+ selectedFiles = [.. filesAndFoldersFilePaths.Select(file => new FileInfo(file))];
// Collect all of the AppControl compatible files from user selected directories and files
List DetectedFilesInSelectedDirectories = FileUtility.GetFilesFast(selectedDirectories, selectedFiles, null);
diff --git a/AppControl Manager/Pages/EventLogsPolicyCreation.xaml.cs b/AppControl Manager/Pages/EventLogsPolicyCreation.xaml.cs
index 8d584227f..2ff00ef01 100644
--- a/AppControl Manager/Pages/EventLogsPolicyCreation.xaml.cs
+++ b/AppControl Manager/Pages/EventLogsPolicyCreation.xaml.cs
@@ -464,7 +464,7 @@ private void DeSelectAll_Click(object sender, RoutedEventArgs e)
private void DataGridFlyoutMenuDelete_Click(object sender, RoutedEventArgs e)
{
// Collect the selected items to delete
- List itemsToDelete = FileIdentitiesDataGrid.SelectedItems.Cast().ToList();
+ List itemsToDelete = [.. FileIdentitiesDataGrid.SelectedItems.Cast()];
// Remove each selected item from the FileIdentities collection
foreach (FileIdentity item in itemsToDelete)
diff --git a/AppControl Manager/Pages/MDEAHPolicyCreation.xaml.cs b/AppControl Manager/Pages/MDEAHPolicyCreation.xaml.cs
index fe1de8006..78d066e8c 100644
--- a/AppControl Manager/Pages/MDEAHPolicyCreation.xaml.cs
+++ b/AppControl Manager/Pages/MDEAHPolicyCreation.xaml.cs
@@ -457,7 +457,7 @@ private void DeSelectAll_Click(object sender, RoutedEventArgs e)
private void DataGridFlyoutMenuDelete_Click(object sender, RoutedEventArgs e)
{
// Collect the selected items to delete
- List itemsToDelete = FileIdentitiesDataGrid.SelectedItems.Cast().ToList();
+ List itemsToDelete = [.. FileIdentitiesDataGrid.SelectedItems.Cast()];
// Remove each selected item from the FileIdentities ObservableCollection, they won't be included in the policy
foreach (FileIdentity item in itemsToDelete)
diff --git a/AppControl Manager/Pages/Settings.xaml.cs b/AppControl Manager/Pages/Settings.xaml.cs
index b2a6351f5..35bc22283 100644
--- a/AppControl Manager/Pages/Settings.xaml.cs
+++ b/AppControl Manager/Pages/Settings.xaml.cs
@@ -475,9 +475,7 @@ private void CertificateCNAutoSuggestBox_TextChanged(AutoSuggestBox sender, Auto
string query = sender.Text.ToLowerInvariant();
// Filter menu items based on the search query
- List suggestions = CertCommonNames
- .Where(name => name.Contains(query, StringComparison.OrdinalIgnoreCase))
- .ToList();
+ List suggestions = [.. CertCommonNames.Where(name => name.Contains(query, StringComparison.OrdinalIgnoreCase))];
// Set the filtered items as suggestions in the AutoSuggestBox
sender.ItemsSource = suggestions;
diff --git a/AppControl Manager/Pages/Simulation.xaml.cs b/AppControl Manager/Pages/Simulation.xaml.cs
index d7c693d96..de914f039 100644
--- a/AppControl Manager/Pages/Simulation.xaml.cs
+++ b/AppControl Manager/Pages/Simulation.xaml.cs
@@ -225,7 +225,7 @@ private void SearchBox_TextChanged(object sender, TextChangedEventArgs e)
string searchTerm = SearchBox.Text.Trim().ToLowerInvariant();
// Perform a case-insensitive search in all relevant fields
- List filteredResults = AllSimulationOutputs.Where(output =>
+ List filteredResults = [.. AllSimulationOutputs.Where(output =>
(output.Path is not null && output.Path.Contains(searchTerm, StringComparison.OrdinalIgnoreCase)) ||
(output.Source is not null && output.Source.Contains(searchTerm, StringComparison.OrdinalIgnoreCase)) ||
(output.MatchCriteria is not null && output.MatchCriteria.Contains(searchTerm, StringComparison.OrdinalIgnoreCase)) ||
@@ -233,7 +233,7 @@ private void SearchBox_TextChanged(object sender, TextChangedEventArgs e)
(output.CertSubjectCN is not null && output.CertSubjectCN.Contains(searchTerm, StringComparison.OrdinalIgnoreCase)) ||
(output.SignerName is not null && output.SignerName.Contains(searchTerm, StringComparison.OrdinalIgnoreCase)) ||
(output.FilePath is not null && output.FilePath.Contains(searchTerm, StringComparison.OrdinalIgnoreCase))
- ).ToList();
+ )];
// Update the ObservableCollection on the UI thread with the filtered results
diff --git a/AppControl Manager/Pages/SystemInformation/ViewCurrentPolicies.xaml.cs b/AppControl Manager/Pages/SystemInformation/ViewCurrentPolicies.xaml.cs
index a8e6842a3..1ab56a45a 100644
--- a/AppControl Manager/Pages/SystemInformation/ViewCurrentPolicies.xaml.cs
+++ b/AppControl Manager/Pages/SystemInformation/ViewCurrentPolicies.xaml.cs
@@ -141,7 +141,7 @@ private void SearchBox_TextChanged(object sender, TextChangedEventArgs e)
string searchTerm = SearchBox.Text.Trim().ToLowerInvariant();
// Perform a case-insensitive search in all relevant fields
- List filteredResults = AllPoliciesOutput.Where(p =>
+ List filteredResults = [.. AllPoliciesOutput.Where(p =>
(p.PolicyID?.ToLowerInvariant().Contains(searchTerm, StringComparison.OrdinalIgnoreCase) ?? false) ||
(p.FriendlyName?.ToLowerInvariant().Contains(searchTerm, StringComparison.OrdinalIgnoreCase) ?? false) ||
(p.VersionString?.ToLowerInvariant().Contains(searchTerm, StringComparison.OrdinalIgnoreCase) ?? false) ||
@@ -150,7 +150,7 @@ private void SearchBox_TextChanged(object sender, TextChangedEventArgs e)
(p.IsOnDisk.ToString().ToLowerInvariant().Contains(searchTerm, StringComparison.OrdinalIgnoreCase)) || // Convert bool to string for comparison
(p.IsEnforced.ToString().ToLowerInvariant().Contains(searchTerm, StringComparison.OrdinalIgnoreCase)) || // Convert bool to string for comparison
(p.PolicyOptionsDisplay?.ToLowerInvariant().Contains(searchTerm, StringComparison.OrdinalIgnoreCase) ?? false)
- ).ToList();
+ )];
// Update the ObservableCollection on the UI thread with the filtered results
AllPolicies.Clear();
@@ -248,9 +248,9 @@ await Task.Run(() =>
{
currentlyDeployedPolicies = CiToolHelper.GetPolicies(false, true, true);
- currentlyDeployedBasePolicyIDs = currentlyDeployedPolicies.Where(x => string.Equals(x.PolicyID, x.BasePolicyID, StringComparison.OrdinalIgnoreCase)).Select(p => p.BasePolicyID).ToList();
+ currentlyDeployedBasePolicyIDs = [.. currentlyDeployedPolicies.Where(x => string.Equals(x.PolicyID, x.BasePolicyID, StringComparison.OrdinalIgnoreCase)).Select(p => p.BasePolicyID)];
- currentlyDeployedAppControlManagerSupplementalPolicies = currentlyDeployedPolicies.Where(p => string.Equals(p.FriendlyName, AppControlPolicyName, StringComparison.OrdinalIgnoreCase)).ToList();
+ currentlyDeployedAppControlManagerSupplementalPolicies = [.. currentlyDeployedPolicies.Where(p => string.Equals(p.FriendlyName, AppControlPolicyName, StringComparison.OrdinalIgnoreCase))];
});
@@ -312,7 +312,7 @@ await Task.Run(() =>
// Remove all the policies from the system
await Task.Run(() =>
{
- CiToolHelper.RemovePolicy(policiesToRemove.Select(x => x.PolicyID!).ToList());
+ CiToolHelper.RemovePolicy([.. policiesToRemove.Select(x => x.PolicyID!)]);
});
// Refresh the DataGrid's policies and their count
diff --git a/AppControl Manager/SiPolicy/Merger.cs b/AppControl Manager/SiPolicy/Merger.cs
index 0047a3b34..4a88d0c2c 100644
--- a/AppControl Manager/SiPolicy/Merger.cs
+++ b/AppControl Manager/SiPolicy/Merger.cs
@@ -268,19 +268,18 @@ private static void EnsureUniqueEKUs(string xmlFilePath)
XNamespace ns = "urn:schemas-microsoft-com:sipolicy";
// Get all EKU elements
- List ekuElements = doc.Descendants(ns + "EKU").ToList();
+ List ekuElements = [.. doc.Descendants(ns + "EKU")];
// Group EKUs by their Value attribute to identify duplicates
- List> duplicateGroups = ekuElements
+ List> duplicateGroups = [.. ekuElements
.GroupBy(e => (string)e.Attribute("Value")!)
- .Where(g => g.Count() > 1) // Only consider duplicates
- .ToList();
+ .Where(g => g.Count() > 1)];
foreach (IGrouping group in duplicateGroups)
{
// Keep the first EKU as the "master" and remove the others
XElement ekuToKeep = group.First();
- List ekusToRemove = group.Skip(1).ToList();
+ List ekusToRemove = [.. group.Skip(1)];
// Update Signer CertEKU references to point to the retained EKU
foreach (XElement ekuToRemove in ekusToRemove)
diff --git a/AppControl Manager/app.manifest b/AppControl Manager/app.manifest
index 5211e10f5..0d8425819 100644
--- a/AppControl Manager/app.manifest
+++ b/AppControl Manager/app.manifest
@@ -1,7 +1,7 @@
-
+