示例#1
0
        /// <summary>
        /// Reads a binary file into a list of points
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public static List <NumCoordCell> ReadCells(string fileName)
        {
            FileStream          stream = File.OpenRead(fileName);
            BinaryReader        reader = new BinaryReader(stream);
            List <NumCoordCell> retVal = new List <NumCoordCell>();

            while (reader.BaseStream.Position != reader.BaseStream.Length)
            {
                NumCoordCell cell = ReadCell(reader);
                retVal.Add(cell);
            }
            reader.Close();
            stream.Close();
            return(retVal);
        }
示例#2
0
 /// <summary>
 /// Comparable for two cells
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public bool CompareTo(NumCoordCell other)
 {
     //check x
     if (coords.x == other.coords.x)
     {
         //if x is equal check y
         if (coords.y == other.coords.z)
         {
             //if y is equal, return the compare of z
             return(coords.z == other.coords.z);
         }
         //otherwise fall through
     }
     //otherwise return this
     return(false);
 }
示例#3
0
 /// <summary>
 /// Given a binary writer and a cell, writes the cell to a
 /// file using the writer
 /// </summary>
 /// <param name="writer"></param>
 /// <param name="cell"></param>
 public static void WriteCell(BinaryWriter writer, NumCoordCell cell)
 {
     writer.Write(cell.cellNumber);
     Point.WritePoint(writer, cell.coords);
 }