Esempio n. 1
0
        public MainFrm()
        {
            InitializeComponent();

            if (LicenseManager.UsageMode == LicenseUsageMode.Runtime)
            {
                this.Icon = Resources.App;

                //ProfessionalColorTable colorTable = new ProfessionalColorTable();
                //colorTable.UseSystemColors = true;
                //statusStrip1.Renderer = new ToolStripProfessionalRenderer(colorTable);
                //toolStrip1.Renderer = new ToolStripProfessionalRenderer(colorTable);

                Trace.Listeners.Add(_eltl);

                ProgramArguments args = new ProgramArguments();

                try
                {
                    args.Parse(false, Environment.GetCommandLineArgs());

                    if (args.Help)
                    {
                        ShowHelp();
                    }

                    if (args.ComparisonSet.Items.Count > 0)
                    {
                        _set = args.ComparisonSet;

                        this.Show();

                        UpdateCheckStates();
                        UpdateTitleBar();

                        Compare();
                    }
                }
                catch (ArgumentParserException ex)
                {
                    MessageBox.Show(this, ex.Message, "Error Parsing Arguments", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }

                Application.Idle += new EventHandler(Application_Idle);
            }
        }
Esempio n. 2
0
        static int Main(string[] arguments)
        {
            foreach (TraceListener tl in Trace.Listeners)
            {
                if (tl is RelayingTraceListener)
                {
                    ((RelayingTraceListener)tl).Message += new EventHandler<TraceEventArgs>(Program_Message);
                }
            }

            Log.Info("BitDiffer Console");
            Log.Info("Version {0} ({1:d})", Assembly.GetExecutingAssembly().GetName().Version, DateTime.Today);
            Log.Info("");

            ProgramArguments args = new ProgramArguments();

            try
            {
                args.Parse(true, arguments);
            }
            catch (ArgumentParserException ex)
            {
                string message = "ERROR: " + ex.Message;

                if (args.LogFile != null)
                {
                    File.WriteAllText(args.LogFile, message);
                }

                Console.WriteLine(message);
                Console.WriteLine();

                Usage();

                return -1;
            }

            if (args.Help)
            {
                Usage();

                Console.WriteLine("Press any key to exit...");
                Console.Read();

                return 1;
            }

            if (args.LogFile != null)
            {
                _logFileWriter = new StreamWriter(args.LogFile, false);
            }

            AssemblyComparison ac = new AssemblyComparer().CompareAssemblies(args.ComparisonSet);

            ac.WriteReport(args.ReportFile, AssemblyComparisonXmlWriteMode.Normal);

            if (args.RawFile != null)
            {
                ac.WriteXmlReport(args.RawFile, AssemblyComparisonXmlWriteMode.Raw);
            }

            Log.Info("Done!");

            if (_logFileWriter != null)
            {
                _logFileWriter.Flush();
                _logFileWriter.Close();
            }

            return 0;
        }