/// <summary> /// Creates the constant from the string input /// </summary> /// <param name="input">string as in SEG-Y EBCDIC Header file</param> public SEGY_Constant(string name, string unit, int location, int type, byte[] input, string description) { this.Name = name; this.Unit = unit; this.Location = location; this.Type = type; this.Description = description; NumberUnion nu = new NumberUnion(); switch (type) { case SEGY_Constant.Int16: this.Value = BufferConverter.GetBytesInt16_BE(input, nu, location).ToString(); break; case SEGY_Constant.UInt16: this.Value = BufferConverter.GetBytesUInt16_BE(input, nu, location).ToString(); break; case SEGY_Constant.Int32: this.Value = BufferConverter.GetBytesInt32_BE(input, nu, location).ToString(); break; default: break; } }
/// <summary> /// Sets value to the buffer /// </summary> /// <param name="Buffer"></param> public void GetBuffer(byte[] Buffer) { NumberUnion nu = new NumberUnion(); switch (Type) { case LDF_Constant.Int16: this.Value = BufferConverter.GetBytesInt16_BE(Buffer, nu, Location).ToString(); break; case LDF_Constant.UInt16: this.Value = BufferConverter.GetBytesUInt16_BE(Buffer, nu, Location).ToString(); break; case LDF_Constant.Int32: this.Value = BufferConverter.GetBytesInt32_BE(Buffer, nu, Location).ToString(); break; case LDF_Constant.Float32: this.Value = BufferConverter.GetBytesFloat_BE(Buffer, nu, Location).ToString(); break; case LDF_Constant.String: this.Value = BufferConverter.GetBytesString(Buffer, nu, Length, Location); break; default: break; } }