BetterExplorer.MainWindow.LoadBadgesData C# (CSharp) Method

LoadBadgesData() private method

Gets the badges from the folder Badges located in the .EXE's directory and the badges from SQLite database
private LoadBadgesData ( ) : Dictionary>>
return Dictionary>>
    private Dictionary<String, Dictionary<IListItemEx, List<string>>> LoadBadgesData() {
      var result = new Dictionary<String, Dictionary<IListItemEx, List<string>>>();
      var badgesDirectory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Badges");
      var badgesIshellItem = FileSystemListItem.ToFileSystemItem(this._ShellListView.LVHandle, badgesDirectory);
      foreach (var item in badgesIshellItem.Where(w => w.IsFolder)) {
        var innerDict = new Dictionary<IListItemEx, List<string>>();
        foreach (var badgeItem in item.Where(w => w.Extension.ToLowerInvariant() == ".ico")) {
          innerDict.Add(badgeItem, new List<String>());
        }

        result.Add(item.DisplayName, innerDict);
      }

      try {
        var m_dbConnection = new System.Data.SQLite.SQLiteConnection($"Data Source={this._DBPath};Version=3;");
        m_dbConnection.Open();

        var command1 = new System.Data.SQLite.SQLiteCommand("SELECT * FROM badges", m_dbConnection);

        var Reader = command1.ExecuteReader();
        while (Reader.Read()) {
          var values = Reader.GetValues();
          var path = values.GetValues("Path").Single();
          var collectionName = values.GetValues("Collection").Single();
          var badgeName = values.GetValues("Badge").Single();
          var badgeDBItem = FileSystemListItem.ToFileSystemItem(this._ShellListView.LVHandle, Path.Combine(badgesDirectory, collectionName, badgeName));
          var collectionDict = result[collectionName];
          var collectionItemKey = collectionDict.Keys.SingleOrDefault(w => w.ParsingName.Equals(badgeDBItem.ParsingName));

          if (collectionItemKey != null) {
            result[collectionName][collectionItemKey].Add(path);
          }
        }
        Reader.Close();
      } catch (Exception) {
      }

      return result;
    }
MainWindow