private void InitialiseExtensions() { var softwareKey = Registry.CurrentUser.OpenSubKey("Software"); if (softwareKey == null) { return; } using (var key = softwareKey.OpenSubKey("Classes")) { if (key == null) { Extensions = new ExtensionViewModel[0]; return; } Extensions = Constants.DefaultExtensions .Select(s => { var openSubKey = key.OpenSubKey(s); return(new ExtensionViewModel(s, Enabled(s, key, openSubKey))); }) .Where(e => e != null) .ToArray(); } }
public IEnumerable<ExtensionViewModel> GetExtensionsFromRegistry() { IEnumerable<ExtensionViewModel> extensions = new ExtensionViewModel[0]; var softwareKey = Registry.CurrentUser.OpenSubKey("Software"); if(softwareKey != null) { using (var key = softwareKey.OpenSubKey("Classes")) { using (var key = softwareKey.OpenSubKey("Classes")) { if (key != null) { extensions = Constants.DefaultExtensions .Select(s => { var openSubKey = key.OpenSubKey(s); return new ExtensionViewModel(s, Enabled(s, key, openSubKey)); }) .Where(e => e != null) .ToArray(); } } } } }
private void InitialiseExtensions() { var softwareKey = Registry.CurrentUser.OpenSubKey("Software"); if (softwareKey == null) return; using (var key = softwareKey.OpenSubKey("Classes")) { if (key == null) { Extensions = new ExtensionViewModel[0]; return; } Extensions = Constants.DefaultExtensions .Select(s => { var openSubKey = key.OpenSubKey(s); return new ExtensionViewModel(s, Enabled(s, key, openSubKey)); }) .Where(e => e != null) .ToArray(); } }