CSharp StatusReport

From scripting
Jump to: navigation, search
  static void Main(string[] args)
        {
                while (true)
                {
                    Thread.Sleep(2500);
                    Console.Clear();
                    string[] fps = Directory.GetFiles(@"c:\xml");
                    if (fps.Count() > 0)
                    {
                        for (int x = 0; x < fps.Count(); x++)
                        {
                            try
                            {
                                using (StreamReader sr = new StreamReader(fps[x]))
                                {
                                    string line = sr.ReadLine();
                                    Console.WriteLine(line + "");
                                    sr.Close();
                                }
                                
                            }
                            catch
                            {
                                Console.WriteLine("Error: " + fps[x]);
                            }
                        }
                    }
                    else
                    {
                        break;
                    }
                }
        }  


This subroutine was used in the development of the Mega-Dots World's Toughest Connect-the-Dots Puzzles.

Unrelated MEL scripting help located here: YSYT.