/// <summary>Move an element from the buffer into a data array.</summary> /// <param name="offset"> The offset within buffer at which the element starts.</param> /// <param name="length"> The number of bytes in the buffer for the element.</param> /// <param name="array"> An array of objects, each of which is a simple array.</param> /// <param name="col"> Which element of array is to be modified?</param> /// <param name="row"> Which index into that element is to be modified?</param> /// <param name="nullFld">What string signifies a null element?</param> private bool ExtractElement(int offset, int length, Array array, int col, int row, String nullFld) { bp.Offset = offset; if (nullFld != null) { String s = bp.GetString(length); if (s.Trim().Equals(nullFld)) { return(false); } bp.Skip(-length); } try { Object el = array.GetValue(col); if (el is String[]) { ((String[])el)[row] = bp.GetString(length); } else if (el is int[]) { ((int[])el)[row] = bp.GetInt(length); } else if (el is float[]) { ((float[])el)[row] = bp.GetFloat(length); } else if (el is double[]) { ((double[])el)[row] = bp.GetDouble(length); } else if (el is long[]) { ((long[])el)[row] = bp.GetLong(length); } else { throw new FitsException("Invalid type for ASCII table conversion:" + el); } } catch (Exception e) { throw new FitsException("Error parsing data at row,col:" + row + "," + col + " " + e); } return(true); }