public void ProcessModCollectionLanceSlotEligibility(IModCollection modCollection)
 {
     this.logger.Info("Processing Lance Slot Eligibility...");
     using (var scopedStopwatch = new ScopedStopwatch(this.logger))
     {
         var lanceSlots = modCollection.GetReferenceableObjects()
                          .Where(o => o.ObjectType == ObjectType.LanceDef).Cast <LanceDefObjectDefinition>()
                          .SelectMany(definition => definition.LanceSlots);
         lanceSlots
         //.AsParallel().ForAll(
         .ToList().ForEach(
             o =>
         {
             this.logger.Debug($"Processing lance slot eligibility for Lance [{o.LanceDefObjectDefinition.Id}] - Slot [{o.LanceSlotNumber}]...");
             o.LoadEligibleUnitsAndPilots(modCollection);
         });
     }
 }
Exemplo n.º 2
0
        public long ProcessModCollectionReferences(IModCollection modCollection)
        {
            var allReferences = modCollection.GetReferenceableObjects();
            var sw            = new Stopwatch();

            sw.Start();

            allReferences.AsParallel().ForAll(
                // allReferences.ToList().ForEach(
                o =>
            {
                // allReferences.ForEach(o =>
                var references = this.GetObjectReferences(o);
            });

            sw.Stop();
            return(sw.ElapsedMilliseconds);
        }
        public long ProcessModCollectionReferences(IModCollection modCollection)
        {
            var allReferences  = modCollection.GetReferenceableObjects();
            var baseReferences = modCollection.Mods.FirstOrDefault(mod => mod.IsBattleTech)?.GetReferenceableObjects();
            var sw             = new Stopwatch();

            sw.Start();

            allReferences.AsParallel().ForAll(
                //allReferences.ToList().ForEach(
                o =>
            {
                var references = this.GetObjectReferences(o, baseReferences);
            });

            sw.Stop();

            this.ProcessModCollectionLanceSlotEligibility(modCollection);

            return(sw.ElapsedMilliseconds);
        }