예제 #1
0
        public void TestFilePass()
        {
            string relativePath = "..\\..\\TestFiles\\MOV045.MOI";
            MOIPathParser pathParser = new MOIPathParser(relativePath);
            pathParser.Parse();

            Assert.IsEmpty(pathParser.ParseErrors.ToList());
            Assert.IsNotEmpty(pathParser.ParsedMOIFiles.ToList());
        }
예제 #2
0
        /// <summary>
        /// Button event that does the parsing of the files and opens a form to display the results.
        /// </summary>
        private void btnGo_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string moiPath = GetMoiPath();
                MOIPathParser moiParser = new MOIPathParser(moiPath);
                moiParser.Parse();

                DisplayParserResults(moiParser);
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message + Environment.NewLine + ex.StackTrace, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
예제 #3
0
 /// <summary>
 /// Displays the results if there are any
 /// </summary>
 private void DisplayParserResults(MOIPathParser moiParser)
 {
     if (moiParser.ParsedMOIFiles.Count() == 0 && moiParser.ParseErrors.Count() == 0)
     {
         MessageBox.Show(this, "No MOI Files Found", this.Title, MessageBoxButton.OK, MessageBoxImage.Information);
     }
     else
     {
         OpenMOIFileViewerForm(moiParser);
     }
 }
예제 #4
0
        /// <summary>
        /// Opens the MOI file viewer form to show the parse results.
        /// </summary>
        /// <param name="moiParser">The parser which should have already run</param>
        private void OpenMOIFileViewerForm(MOIPathParser moiParser)
        {
            MOIFileViewer moiFileViewer = new MOIFileViewer();
            moiFileViewer.PopulateFileGrid(moiParser.ParsedMOIFiles);
            moiFileViewer.PopulateErrorGrid(moiParser.ParseErrors);

            moiFileViewer.Show();
        }
예제 #5
0
 public void TestNoFile()
 {
     string relativePath = "..\\..\\TestFiles\\NOTHERE.MOI";
     MOIPathParser pathParser = new MOIPathParser(relativePath);
     pathParser.Parse();
 }