Esempio n. 1
0
        /* Validate Opened file */
        private void OpenValidation()
        {
            //List<int> priorities = new List<int>();
            foreach (PortEntry new_entry in Ports)
            {
                //priorities.Add(new_entry.GetPriority());
                if (CheckDup(new_entry))
                {
                    if (FileValidator.ValidEntry(new_entry))
                    {
                        new_entry.SetValid(true);
                        new_entry.SetReason("");
                    }
                }
            }

            /*priorities.Sort();
             * bool test = false;
             * Console.WriteLine("Length: " + Ports.ToString());
             * for (int i = 0; i < priorities.Count - 1; i++)
             * {
             *  MessageBox.Show(i.ToString());
             *  if (i < priorities.Count - 2 && priorities[i] + 1 != priorities[i + 1])
             *  {
             *      PriorityError.Text = "Note That Priority " + (priorities[i] + 1).ToString() + " is not in the list";
             *      test = true;
             *      break;
             *  }
             * }
             * if (!test)
             *  PriorityError.Text = "All priorities are good!";*/
            ColorInValid();
        }
Esempio n. 2
0
 /* Open a file */
 private void OpenButton_Click(object sender, EventArgs e)
 {
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         DialogResult res = MessageBox.Show("Whould you like to clear the current table (without saving!)?", "Warning", MessageBoxButtons.YesNo);
         if (res == DialogResult.Yes)
         {
             Clear_Click(sender, e);
         }
         FileValidator fv = new FileValidator(openFileDialog1.FileName);
         if (fv.IsFileValid())
         {
             UpdateFilePath(openFileDialog1.FileName);
             File.WriteAllText(@"file_path.txt", openFileDialog1.FileName);
             Console.WriteLine("Adding entries to table...");
             AddManyPorts(fv.GetPortList());
         }
     }
 }