Exemple #1
0
        /*
         * Reads from file
         */
        public override void readFromFile()
        {
            StreamReader reader = new StreamReader(fileName);

            while (!reader.EndOfStream)
            {
                String   line   = reader.ReadLine();
                String[] tokens = line.Split('#');
                if (tokens.Length == 2)
                {
                    OptionFormatValidator.validateFormat(tokens[0], tokens[1]);
                    Option option = new Option(int.Parse(tokens[0]), int.Parse(tokens[1]));
                    base.saveInMemory(option);
                }
            }
            reader.Close();
        }
 /*
  * Formats an element
  * Throws ValidatorException if format is invalid
  */
 public override Option formatElement(params string[] fields)
 {
     OptionFormatValidator.validateFormat(fields);
     return(new Option(int.Parse(fields[0]), int.Parse(fields[1])));
 }