private void IncludeDirectory(TestProgram parent, DirectoryInfo includedDirectory)
 {
     Console.WriteLine("Handling included directory " + includedDirectory.FullName);
     foreach (FileInfo thisListing in includedDirectory.GetFiles())
     {
         HandleInclusion(parent, thisListing);
     }
 }
        internal void ProcessConfigSet(TestProgram parent, string[] args)
        {
            for (int index = 0; index < args.Length; index++)
            {
                switch (args[index].ToUpper())
                {
                case RUN_ARG:
                    index++;
                    immediateRun = args[index].ToUpper();
                    break;

                case EXCLUDE_ARG:
                    index++;
                    exclusions.Add(args[index]);
                    break;

                case INCLUDE_ARG:
                    index++;
                    HandleInclusion(parent, new FileInfo(args[index]));
                    break;

                case DECLARE_ARG:
                    DoDeclare(args, index + 1);
                    return;

                case PORT_ARG:
                    index++;
                    if (!parent.ContinueService)
                    {
                        parent.WEBUI_PORT = int.Parse(args[index]);
                    }                             // will silently ignore if serving.
                    return;

                /*
                 * case ADDRESS_ARG:
                 * index++;
                 * if (!parent.ContinueService)
                 * {
                 * try
                 * {
                 *      parent.address = InetAddress.getByName(args[index]);
                 * }
                 * catch (UnknownHostException e)
                 * {
                 *      Console.WriteLine("Unable to set local address to " + args[index]);
                 * }
                 * } // will silently ignore if serving.
                 * return;
                 */
                default:
                    UnprocessedArguments.Add(args[index]);
                    break;
                }
            }
        }
 private void HandleInclusion(TestProgram parent, FileInfo inclusion)
 {
     if (inclusion.Exists)
     {
         if (inclusion.Attributes.HasFlag(FileAttributes.Directory))
         {
             IncludeDirectory(parent, new DirectoryInfo(inclusion.DirectoryName));
         }
         else
         {
             IncludeFile(parent, inclusion);
         }
     }
     else
     {
         Console.WriteLine("Ignoring non-existent inclusion " + inclusion.FullName);
     }
 }
        private void IncludeFile(TestProgram parent, FileInfo includedFile)
        {
            string[] args = null;

            Console.WriteLine("Handling included file " + includedFile.FullName);
            try
            {
                args = File.ReadAllLines(includedFile.FullName);
            }
            catch (IOException)
            {
                Console.WriteLine("Unable to read included file " + includedFile.FullName);
            }

            if (args != null)
            {
                ProcessConfigSet(parent, args);
            }
        }