Example #1
0
 private void saveListToFile(IList <IList <Number> > newList, string name)
 {
     try
     {
         using (System.IO.StreamWriter bw = new System.IO.StreamWriter(new File(name)))
         {
             writeList(newList, bw);
         }
     }
     catch (IOException e)
     {
         DataException dataException = new DataException("Unable to write file " + name);
         dataException.initCause(e);
         throw dataException;
     }
 }
Example #2
0
 private IList <Number []> buildOriginalList(string name)
 {
     try
     {
         using (System.IO.StreamReader br = new System.IO.StreamReader(new File(name)))
         {
             ignoreFirstLine(br);
             return(DataUtils.createLineList(br));
         }
     }
     catch (IOException e)
     {
         DataException dataException = new DataException("Unable to read file " + name);
         dataException.initCause(e);
         throw dataException;
     }
 }
Example #3
0
        public static IList <Number []> createLineList(System.IO.StreamReader br)
        {
            IList <Number []> list = new List <Number []>();
            int linesRead          = 1;

            try
            {
                buildLines(br, list);
                return(list);
            }
            catch (System.Exception ex) when(ex is IOException || ex is System.FormatException || ex is System.IndexOutOfRangeException)
            {
                DataException de = new DataException("Error reading line " + linesRead);

                de.initCause(ex);
                throw de;
            }
        }
Example #4
0
        private DataSet createDataSet(string name, UserOutput output)
        {
            try
            {
                using (System.IO.StreamReader br = new System.IO.StreamReader(new File(name)))
                {
                    IList <Number []> lines = DataUtils.createLineList(br);
                    output.infoMessage("Got " + lines.Count + " lines");
                    return(new DataSet(lines, name));
                }
            }
            catch (System.Exception e) when(e is IOException || e is DataException)
            {
                DataException de = new DataException("Unable to process file: " + name);

                de.initCause(e);
                throw de;
            }
        }