System.Collections.Generic.List.Remove(WebMiningLedgerEntry)

Here are the examples of the csharp api System.Collections.Generic.List.Remove(WebMiningLedgerEntry) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 Source : MiningScheduleModule.cs
with GNU General Public License v3.0
from panthernet

public async Task<List<WebMiningLedgerEntry>> MergeLedgerEntries(List<WebMiningLedgerEntry> entries)
        {
            try
            {
                var result = entries.ToList();
                var found = new Dictionary<long, long>();

                foreach (var entry in entries)
                {
                    if (entry.CharacterId == 0 || found.FirstOrDefault(a=> a.Key == entry.CharacterId && a.Value == entry.OreId).Value != 0) continue;

                    var alts = await DbHelper.GetAltUserIds(entry.CharacterId);
                    if (alts.Any())
                    {
                        //alts by char and ore id
                        var altEntries = result.Where(a => alts.Contains(a.CharacterId) && a.OreId == entry.OreId)
                            .ToList();
                        var resultEntry = result.FirstOrDefault(a =>
                            a.CharacterId == entry.CharacterId && a.OreId == entry.OreId);

                        resultEntry.Alts.AddRange(altEntries);
                        foreach (var altEntry in altEntries)
                        {
                            result.Remove(altEntry);
                            //skip found alts for perf reason
                            found.Add(altEntry.CharacterId, entry.OreId);
                        }
                    }
                }

                result.ForEach(a => a.Recalculate());
                return result;
            }
            catch (Exception ex)
            {
                await LogHelper.LogEx(ex, Category);
                return null;
            }
        }