示例#1
0
        private double?ReadDouble()
        {
            var bytes = GetBlock();
            var value = _metadataInfo.ConvertDouble(bytes);

            // ReSharper disable once CompareOfFloatsByEqualityOperator
            return(value == double.MinValue ? (double?)null : value);
        }
示例#2
0
        private void UpdateVariableShortValueLabels(List <Variable> variables, Dictionary <int, int> rawIndex2Index)
        {
            foreach (var entry in _metadataInfo.ShortValueLabels)
            {
                var indexes     = entry.Indexes.Select(x => rawIndex2Index[x]).ToList();
                var isString    = variables[indexes.First()].FormatType == FormatType.A;
                var valueLabels = entry.Labels;
                var v           = new Dictionary <object, string>();
                foreach (var(valueBytes, labelBytes) in valueLabels)
                {
                    var value = isString ? _encoding.GetString(valueBytes).TrimEnd() : (object)_metadataInfo.ConvertDouble(valueBytes);
                    var label = _encoding.GetString(labelBytes).TrimEnd();
                    v[value] = label;
                }

                indexes.ForEach(x => variables[x].ValueLabels = v);
            }
        }