NumberParseDecimalMilli() static public method

parses a decimal number and returns the number multiplied by thousand.
static public NumberParseDecimalMilli ( this numberString ) : Int64?
numberString this
return Int64?
Example #1
0
        static public IInventoryCapacityGauge ParseAsInventoryCapacityGaugeMilli(this string gaugeString)
        {
            if (null == gaugeString)
            {
                return(null);
            }

            var Match = Regex.Match(gaugeString, CapacityGaugeTextPattern, RegexOptions.IgnoreCase);

            if (!Match.Success)
            {
                return(null);
            }

            var Used     = Number.NumberParseDecimalMilli(Match.Groups[CapacityGaugeGroupUsedId].Value);
            var Max      = Number.NumberParseDecimalMilli(Match.Groups[CapacityGaugeGroupMaxId].Value);
            var Selected = Number.NumberParseDecimalMilli(Match.Groups[CapacityGaugeGroupSelectedId].Value);

            return(new InventoryCapacityGauge()
            {
                Used = Used,
                Max = Max,
                Selected = Selected,
            });
        }
Example #2
0
        static public void DistanceParse(
            string DistanceString,
            out Int64?DistanceMin,
            out Int64?DistanceMax)
        {
            DistanceMin = null;
            DistanceMax = null;

            if (null == DistanceString)
            {
                return;
            }

            var Match = DistanceRegex.Match(DistanceString);

            if (!Match.Success)
            {
                return;
            }

            var ComponentValueString = Match.Groups[DistanceRegexPatternGroupValueId].Value;
            var ComponentUnitString  = Match.Groups[DistanceRegexPatternGroupUnitId].Value;

            Int64?UnitInMeter = null;

            if (string.Equals("m", ComponentUnitString))
            {
                UnitInMeter = 1;
            }

            if (string.Equals("km", ComponentUnitString))
            {
                UnitInMeter = 1000;
            }

            if (string.Equals("AU", ComponentUnitString))
            {
                UnitInMeter = AstronomicalUnit;
            }

            var ValueMilli = Number.NumberParseDecimalMilli(ComponentValueString);

            var DistanceParsed = (ValueMilli * UnitInMeter) / 1000;

            //	eventually lower and upper bounds should be determined by NumberParseValueMilli but that is not implemented yet.
            //	assume zero fraction digits as default.
            var DiffBetweenLowerAndUpperBound = UnitInMeter;

            if (1e+6 < UnitInMeter)
            {
                //	assume one fraction digit for unit AU.
                DiffBetweenLowerAndUpperBound = UnitInMeter / 10;
            }

            //	Eve Online Client seems to always round down.
            DistanceMin = DistanceParsed;
            DistanceMax = DistanceMin + DiffBetweenLowerAndUpperBound;
        }
Example #3
0
        static public DialogueMissionLocation MissionLocationFromDialogue(this HtmlAgilityPack.HtmlNode node)
        {
            var SecurityLevelMilli =
                node?.Descendants()?.Select(descendant => Number.NumberParseDecimalMilli(descendant?.InnerText?.Trim()))
                ?.WhereNotDefault()
                ?.FirstOrDefault();

            var NameNode = node?.SelectSingleNode(".//a");

            var Name = NameNode?.InnerText?.Trim();

            return(new DialogueMissionLocation()
            {
                Name = Name,
                SecurityLevelMilli = (int?)SecurityLevelMilli,
                SystemName = Name?.AsLocation()?.SystemName,
            });
        }
Example #4
0
        static public DialogueMissionObjectiveItem ObjectiveItemFromDialogueText(this string dialogueText)
        {
            var Match = dialogueText.RegexMatchIfSuccess(ObjectiveItemFromDialogueTextRegexPattern, RegexOptions.IgnoreCase);

            if (null == Match)
            {
                return(null);
            }

            var VolumeValueMatch = Number.DefaultNumberFormatRegexAllowLeadingAndTrailingChars.Match(Match?.Groups["volume"]?.Value);

            var VolumeValueMilli = (int?)Number.NumberParseDecimalMilli(VolumeValueMatch?.Value);

            return(new DialogueMissionObjectiveItem()
            {
                Quantity = Match.Groups["quant"].Value.TryParseInt(),
                Name = Match.Groups["name"].Value?.Trim(),
                VolumeMilli = VolumeValueMilli,
            });
        }