private async Task <List <IShellItem> > ParseShellBags() { bool parseAllUsers = multiUserCheck.IsChecked.GetValueOrDefault(false); bool useRegistryHiveFiles = OfflineCheck.IsChecked.GetValueOrDefault(false); string osVersion = OSVersion.SelectedItem == null ? string.Empty : OSVersion.SelectedItem.ToString(); //potentially long running operation, operate in another thread. return(await Task.Run(() => { List <IShellItem> retList = new List <IShellItem>(); ConfigParser parser = new ConfigParser(locations.GUIDFileLocation, locations.OSFileLocation, locations.ScriptFileLocation); //perform offline shellbag parsing if (useRegistryHiveFiles) { parser.OsVersion = osVersion; string[] registryFilePaths = locations.OfflineFileLocations; foreach (string registryFile in registryFilePaths) { OfflineRegistryReader offlineReader = new OfflineRegistryReader(parser, registryFile); retList.AddRange(ShellBagParser.GetShellItems(offlineReader)); } } else //perform online shellbag parsing { OnlineRegistryReader onlineReader = new OnlineRegistryReader(parser, parseAllUsers); retList.AddRange(ShellBagParser.GetShellItems(onlineReader)); } return retList; })); }
public void GetRegistryKeysTest() { OnlineRegistryReader registryReader = new OnlineRegistryReader(new MockConfigParser()); List <RegistryKeyWrapper> keys = registryReader.GetRegistryKeys(); Assert.AreNotEqual(keys.Count, 0); }