static void Main(string[] args)
        {
            Console.WriteLine("Brady PLC Code Challenge Application Running..");

            try
            {
                //Parsing config file
                ConfigFileHelper.ParseConfigFile();

                //check the File exists in the directory
                //If not check evey 10 seconds
                while (!File.Exists(ConfigFileHelper.GenerationReportFilePath))
                {
                    Console.WriteLine(string.Format("File Not Available in the directory : {0}", ConfigFileHelper.GenerationReportFilePath));
                    Console.WriteLine("Will check evey ten seconds");
                    Thread.Sleep(10000);
                }

                GenerationReport GenerationReport = XMLHelper.ParsingXML();

                GenerationOutput GenerationOutput = new GenerationOutput(GenerationReport);

                XMLHelper.CreateXML(GenerationOutput);
            }
            catch (Exception e)
            {
                Console.WriteLine(string.Format("Caught an Exception {0}", e.Message));
            }
            finally
            {
                Console.WriteLine("Press Any Key to Exit...");
                Console.ReadLine();
            }
        }
        public static GenerationReport ParsingXML()
        {
            GenerationReport GenerationReport = null;

            XmlSerializer serializer = new XmlSerializer(typeof(GenerationReport));

            StreamReader reader = new StreamReader(ConfigFileHelper.GenerationReportFilePath);

            GenerationReport = (GenerationReport)serializer.Deserialize(reader);

            reader.Close();

            return(GenerationReport);
        }
Example #3
0
 public GenerationOutput(GenerationReport generationReport)
 {
     this.generationReport = generationReport;
     GenerateOutput();
 }