예제 #1
0
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        /// <param name="args">The arguments.</param>
        private static void Main(string[] args)
        {
            LogHelper logHelper = null;
            Stopwatch sw        = Stopwatch.StartNew();

            sw.Start();

            // Time stamp current time for delta value
            DateTime CurrentTime = DateTime.Now;

            try
            {
                if (args.Length == 0)
                {
                    throw new Exception("Please specify the input file...");
                }

                PropertyMapper mapper = null;

                using (TextReader reader = new StreamReader(args[0]))
                {
                    mapper = Deserialize <PropertyMapper>(reader);
                }

                if (mapper == null)
                {
                    throw new Exception("An error occurred whilst serializing the data. Ensure that the XML adheres to the schema");
                }

                logHelper = LogHelper.Instance(mapper.Loggers);

                RecurseActions(mapper.Actions, logHelper, CurrentTime);
            }
            catch (Exception ex)
            {
                if (logHelper != null)
                {
                    logHelper.LogException(string.Empty, ex);
                }
            }
            finally
            {
                sw.Stop();

                if (logHelper != null)
                {
                    logHelper.LogVerbose(string.Format(CultureInfo.CurrentCulture, "Operation completed. Execution time (s) {0}", sw.Elapsed.TotalSeconds));
                    logHelper.Dispose();
                }
            }
        }