using System;
using System.Windows.Forms;

namespace MBox
{
    internal static class Program
    {
        /// <summary>
        ///  The main entry point for the application.
        /// </summary>
        [STAThread]
        private static int Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var title = args.Length > 0 ? args[0] : "";
            var text = args.Length > 1 ? args[1] : "";

            var buttons = args.Length > 2 ? (MessageBoxButtons)Enum.Parse(typeof(MessageBoxButtons), args[2]) : 0;
            var icon = args.Length > 3 ? (MessageBoxIcon)Enum.Parse(typeof(MessageBoxIcon), args[3]) : 0;
            var def = args.Length > 4 ? (MessageBoxDefaultButton)Enum.Parse(typeof(MessageBoxDefaultButton), args[4]) : 0;
            var opt = args.Length > 5 ? (MessageBoxOptions)Enum.Parse(typeof(MessageBoxOptions), args[5]) : 0;

            var dr = MessageBox.Show(text, title, buttons, icon, def, opt);
            Environment.ExitCode = (int)dr;
            Environment.Exit((int)dr);
            return (int)dr;
        }
    }
}