private static void AddMissingResource(string resourname, int refBody, Dictionary <string, AtmosphericResource> bodyComposition)
        {
            // verify it is a defined resource
            var definition = PartResourceLibrary.Instance.GetDefinition(resourname);

            if (definition == null)
            {
                Debug.LogWarning("[KSPI] - AddMissingResource : Failed to find resource definition for '" + resourname + "'");
                return;
            }

            // skip it already registred or used as a Synonym
            if (bodyComposition.Values.Any(m => m.ResourceName == definition.name || m.DisplayName == definition.displayName || m.Synonyms.Contains(definition.name)))
            {
                Debug.Log("[KSPI] - AddMissingResource : Already found existing composition for '" + resourname + "'");
                return;
            }

            // retreive abundance
            var abundance = GetAbundance(definition.name, refBody);

            if (abundance <= 0)
            {
                Debug.LogWarning("[KSPI] - AddMissingResource : Abundance for resource '" + resourname + "' was " + abundance);
                return;
            }

            // create resource from definition and abundance
            var resource = new AtmosphericResource(definition, abundance);

            // add to composition
            Debug.Log("[KSPI] - AddMissingResource : add resource '" + resourname + "'");
            bodyComposition.Add(resource.ResourceName, resource);
        }
        public static double getAtmosphericResourceContentByDisplayName(int refBody, string resourcename)
        {
            List <AtmosphericResource> bodyAtmosphericComposition = GetAtmosphericCompositionForBody(refBody);
            AtmosphericResource        resource = bodyAtmosphericComposition.FirstOrDefault(oor => oor.DisplayName == resourcename);

            return(resource != null ? resource.ResourceAbundance : 0);
        }
        private static void AddResource(int refBody, List <AtmosphericResource> bodyComposition, string outputResourname, string inputResource1, string inputResource2, string inputResource3, string displayname)
        {
            var abundances = new[] { GetAbundance(inputResource1, refBody), GetAbundance(inputResource2, refBody), GetAbundance(inputResource2, refBody) };

            var Resource = new AtmosphericResource(outputResourname, abundances.Max(), displayname, new[] { inputResource1, inputResource2, inputResource3 });

            if (Resource.ResourceAbundance > 0)
            {
                var existingResource = bodyComposition.FirstOrDefault(a => a.ResourceName == outputResourname);
                if (existingResource != null)
                {
                    Debug.Log("[KSPI] - replaced resource " + outputResourname + " with stock defined abundance " + Resource.ResourceAbundance);
                    bodyComposition.Remove(existingResource);
                }
                bodyComposition.Add(Resource);
            }
        }
        private static void AddResource(string outputResourname, string displayname, int refBody, List <AtmosphericResource> bodyComposition, string[] variants)
        {
            var abundances = new[] { GetAbundance(outputResourname, refBody) }.Concat(variants.Select(m => GetAbundance(m, refBody)));

            var Resource = new AtmosphericResource(outputResourname, abundances.Max(), displayname, variants);

            if (Resource.ResourceAbundance > 0)
            {
                var existingResource = bodyComposition.FirstOrDefault(a => a.ResourceName == outputResourname);
                if (existingResource != null)
                {
                    Debug.Log("[KSPI] - replaced resource " + outputResourname + " with stock defined abundance " + Resource.ResourceAbundance);
                    bodyComposition.Remove(existingResource);
                }
                bodyComposition.Add(Resource);
            }
        }
        private static void AddResource(int refBody, IDictionary <string, AtmosphericResource> bodyComposition, string outputResourname, string inputResource1, string inputResource2, string inputResource3, string displayname)
        {
            var abundances = new[] { GetAbundance(inputResource1, refBody), GetAbundance(inputResource2, refBody), GetAbundance(inputResource2, refBody) };

            var resource = new AtmosphericResource(outputResourname, abundances.Max(), displayname, new[] { inputResource1, inputResource2, inputResource3 });

            if (resource.ResourceAbundance <= 0)
            {
                return;
            }

            AtmosphericResource existingResource;

            if (bodyComposition.TryGetValue(outputResourname, out existingResource))
            {
                Debug.Log("[KSPI] - replaced resource " + outputResourname + " with stock defined abundance " + resource.ResourceAbundance);
                bodyComposition.Remove(existingResource.ResourceName);
            }
            bodyComposition.Add(resource.ResourceName, resource);
        }
        private static void AddResource(string outputResourname, string displayname, int refBody, IDictionary <string, AtmosphericResource> bodyComposition, string[] variants)
        {
            var abundances = new[] { GetAbundance(outputResourname, refBody) }.Concat(variants.Select(m => GetAbundance(m, refBody)));

            var resource = new AtmosphericResource(outputResourname, abundances.Max(), displayname, variants);

            if (resource.ResourceAbundance <= 0)
            {
                return;
            }

            AtmosphericResource existingResource;

            if (bodyComposition.TryGetValue(outputResourname, out existingResource))
            {
                Debug.Log("[KSPI] - Replaced resource " + outputResourname + " with stock defined abundance " + resource.ResourceAbundance);
                bodyComposition.Remove(existingResource.ResourceName);
            }
            bodyComposition.Add(resource.ResourceName, resource);
        }