Exemple #1
0
        public static List <FullCell> ReadCells(string filename)
        {
            FileStream   stream = File.OpenRead(filename);
            BinaryReader reader = new BinaryReader(stream);
            //read the number of headers
            int numOfHeaders = reader.ReadInt32();

            //for each header, read a string and add it to the static headers
            FullCell.headers = new string[numOfHeaders];
            for (int i = 0; i < numOfHeaders; i++)
            {
                if (reader.BaseStream.Position != reader.BaseStream.Length)
                {
                    headers[i] = reader.ReadString();
                }
            }
            List <FullCell> cells = new List <FullCell>();

            //read the cells
            while (reader.BaseStream.Position != reader.BaseStream.Length)
            {
                FullCell cell = ReadCell(reader, numOfHeaders);
                cells.Add(cell);
            }
            reader.Close();
            stream.Close();
            return(cells);
        }
Exemple #2
0
 /// <summary>
 /// Writes a singular cell to a binary writer
 /// </summary>
 /// <param name="writer"></param>
 /// <param name="cell"></param>
 public static void WriteCell(BinaryWriter writer, FullCell cell)
 {
     writer.Write(cell.cellNumber);
     foreach (double val in cell.values)
     {
         writer.Write(val);
     }
 }
Exemple #3
0
 public bool CompareTo(FullCell f1)
 {
     if (cellNumber != f1.cellNumber)
     {
         return(false);
     }
     for (int i = 0; i < headers.Length; i++)
     {
         if (values[i] != f1.values[i])
         {
             return(false);
         }
     }
     return(true);
 }