/// <summary>
        /// Remove PAD settings, not attached to any device.
        /// </summary>
        void CleanupPadSettings()
        {
            // Get all settings used by PADs.
            var usedPadSettings = Settings.Items.Select(x => x.PadSettingChecksum).Distinct().ToArray();
            // Get all stored padSettings.
            var allPadSettings = PadSettings.Items.Select(x => x.PadSettingChecksum).Distinct().ToArray();
            // Wipe all pad settings not attached to devices.
            var notUsed = allPadSettings.Except(usedPadSettings);

            foreach (var nu in notUsed)
            {
                var notUsedItems = PadSettings.Items.Where(x => x.PadSettingChecksum == nu).ToArray();
                PadSettings.Remove(notUsedItems);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Remove PAD settings, not attached to any device.
        /// </summary>
        public void CleanupPadSettings()
        {
            // Get all records used by Settings.
            var usedPadSettings = UserSettings.Items.Select(x => x.PadSettingChecksum).Distinct().ToList();
            // Get all records used by Summaries.
            var usedPadSettings2 = Summaries.Items.Select(x => x.PadSettingChecksum).Distinct().ToList();
            // Get all records used by Presets.
            var usedPadSettings3 = Presets.Items.Select(x => x.PadSettingChecksum).Distinct().ToList();

            // Combine all pad settings.
            usedPadSettings.AddRange(usedPadSettings2);
            usedPadSettings.AddRange(usedPadSettings3);
            // Get all stored padSettings.
            var allPadSettings = PadSettings.Items.Select(x => x.PadSettingChecksum).Distinct().ToArray();
            // Wipe all not used pad settings.
            var notUsed = allPadSettings.Except(usedPadSettings);

            foreach (var nu in notUsed)
            {
                var notUsedItems = PadSettings.Items.Where(x => x.PadSettingChecksum == nu).ToArray();
                PadSettings.Remove(notUsedItems);
            }
        }