Пример #1
0
 public XmlOutputter(string path)
 {
     this.path = path;
     index = new GenerationIndex(path);
     directory = Path.GetDirectoryName(path);
     prefix = Path.GetFileNameWithoutExtension(path);
 }
Пример #2
0
        /// <summary>
        /// Initialises a new XmlOutputter
        /// </summary>
        /// <param name="path">The path to save the index file to</param>
        public XmlOutputter(string path)
        {
            if (path == null)
            {
                throw new ArgumentNullException("path must not be null");
            }

            this.path = path;
            index = new GenerationIndex(path);
            directory = Path.GetDirectoryName(path);
            prefix = Path.GetFileNameWithoutExtension(path);
        }
        /// <summary>
        /// Load output file and check if the file is an XML one.  If not, terminate program
        /// Otherwise show the maximum generation value. 
        /// </summary>
        /// <param name="filename"></param>
        private void loadFile(string filename)
        {
            string extension = Path.GetExtension(filename);
            if (extension != ".xml")
            {
                    MessageBox.Show("Cannot open file for reading XML.\n Terminating program now");
                    this.Dispose(true);
            }
            else
            {
                XmlTextReader reader = new XmlTextReader(filename);
                reader.MoveToContent();
                if (reader.Name != "results")
                {
                    throw new Exception("Results XML file must have <results> element as root.");
                }
                results = new GenerationIndex(filename,reader);
                drawIndividual(0, 0);
                generation.Maximum = results.Count - 1;
                maxGeneration.Text = "Max : " + (results.Count-1);

            }
        }