public void ReadFromInfoRecord(InfoRecord ir)
 {
     if (ir.RecordSubType != RecordSubType.MachineFloatingPointInfoRecord || ir.ItemSize != 8 || ir.ItemCount != 3)
     {
         throw new Exception("Invalid items in MachineFloatingPointInfoRecord");
     }
     this.SystemMissingValue  = BitConverter.ToDouble(ir.Items[0], 0);
     this.HighestMissingValue = BitConverter.ToDouble(ir.Items[1], 0);
     this.LowestMissingValue  = BitConverter.ToDouble(ir.Items[2], 0);
 }
 public void ReadFromInfoRecord(InfoRecord ir)
 {
     if (ir.RecordSubType != RecordSubType.MachineIntegerInfoRecord || ir.ItemSize != 4 || ir.ItemCount != 8)
     {
         throw new Exception("Invalid items in MachineIntegerInfoRecord");
     }
     this.VersionMajor                = BitConverter.ToInt32(ir.Items[0], 0);
     this.VersionMinor                = BitConverter.ToInt32(ir.Items[1], 0);
     this.VersionRevision             = BitConverter.ToInt32(ir.Items[2], 0);
     this.MachineCode                 = BitConverter.ToInt32(ir.Items[3], 0);
     this.FloatingPointRepresentation = (FloatingPointRepresentation)BitConverter.ToInt32(ir.Items[4], 0);
     this.CompressionCode             = BitConverter.ToInt32(ir.Items[5], 0);
     this.Endianness    = (Endianness)BitConverter.ToInt32(ir.Items[6], 0);
     this.CharacterCode = BitConverter.ToInt32(ir.Items[7], 0);
 }
Exemplo n.º 3
0
        public void ReadFromInfoRecord(InfoRecord ir)
        {
            if (ir.RecordSubType != RecordSubType.LongVariableNamesRecord || ir.ItemSize != 1)
            {
                throw new Exception("Invalid items in LongVariableNamesRecord");
            }

            var originalBytes    = (from item in ir.Items select item[0]).ToArray();
            var dictionaryString = Encoding.Default.GetString(originalBytes); // TO DO: Globalize Encoding??
            // split on tabs:
            var entries = dictionaryString.Split('\t');

            this.VarNamePairs = new Dictionary <string, string>();
            foreach (var entry in entries)
            {
                var values = entry.Split('=');
                this.VarNamePairs.Add(values[0], values[1]);
            }
        }
Exemplo n.º 4
0
        public void ReadFromInfoRecord(InfoRecord ir)
        {
            if (ir.RecordSubType != RecordSubType.VeryLongStringRecord || ir.ItemSize != 1)
            {
                throw new Exception("Invalid items in VeryLongStringRecord");
            }

            this.StringLengths = new Dictionary <string, string>();
            var originalBytes    = (from item in ir.Items where item[0] != 0 select item[0]).ToArray();
            var dictionaryString = Encoding.Default.GetString(originalBytes);

            // split on tabs:
            var entries = dictionaryString.Split('\t');

            foreach (var entry in entries)
            {
                var values = entry.Split('=');
                this.StringLengths.Add(values[0], values[1]);
            }
        }
        public void ReadFromInfoRecord(InfoRecord ir)
        {
            if (ir.RecordSubType != RecordSubType.MultipleResponseSetsRecord || ir.ItemSize != 1)
            {
                throw new Exception("Invalid items in MultipleResponseSetsRecord");
            }

            var originalBytes    = (from item in ir.Items select item[0]).ToArray();
            var dictionaryString = Encoding.Default.GetString(originalBytes); // TO DO: Globalize Encoding??
            // split on tabs:
            var entries = dictionaryString.Split('\n');

            this.MultipleResponseSets = new List <MultipleResponseSet>();
            foreach (var entry in entries)
            {
                if (entry.Length > 0)
                {
                    MultipleResponseSet mrs = new MultipleResponseSet();
                    mrs.ReadFromString(entry);
                    this.MultipleResponseSets.Add(mrs);
                }
            }
        }
Exemplo n.º 6
0
        public void ReadFromInfoRecord(InfoRecord ir)
        {
            if (ir.RecordSubType != RecordSubType.VariableDisplayParameterRecord || ir.ItemSize != 4)
            {
                throw new Exception("Invalid items in VariableDisplayParameterRecord");
            }

            // Record can either have 2 or 3 fields per variable:
            int variableCount = ir.File.GetVariableCount();

            this.ParameterCount = ir.ItemCount / variableCount;
            if (this.ParameterCount != 2 && this.ParameterCount != 3 && ir.ItemCount % variableCount > 0)
            {
                throw new Exception("Invalid ItemCount in VariableDisplayParameterRecord");
            }

            this.VariableParameters = new List <VariableParameters>();

            for (int variableIndex = 0; variableIndex < variableCount; variableIndex++)
            {
                VariableParameters vp = new VariableParameters();
                vp.MeasurementType = (MeasurementType)BitConverter.ToInt32(ir.Items[0], 0);
                if (this.ParameterCount == 3)
                {
                    //Width parameter exists
                    vp.Width     = BitConverter.ToInt32(ir.Items[1], 0);
                    vp.Alignment = (Alignment)BitConverter.ToInt32(ir.Items[2], 0);
                }
                else if (this.ParameterCount == 2)
                {
                    //Width parameter is omitted
                    vp.Alignment = (Alignment)BitConverter.ToInt32(ir.Items[1], 0);
                }
                this.VariableParameters.Add(vp);
            }
        }