Пример #1
1
        public static void PluginExc(Exception z,   jZmPlugin plug)
        {
            TaskDialog diag = new TaskDialog();
            diag.InstructionText = "'" + plug.Name + "' by '" + plug.Author + "' has thrown a exception.";
            diag.Text = "One of your plugins has thrown an unhandled exception.\nThis means that one of your plugin may be unstable.";
            diag.Caption = "WTF?";
            diag.Icon = TaskDialogStandardIcon.Error;
            diag.DetailsExpandedText = z.ToString();
            TaskDialogCommandLink linkz = new TaskDialogCommandLink("r", "Restart jZm");
            linkz.ShowElevationIcon = true;
            linkz.Click += delegate(object sender, EventArgs argz)
            {
                diag.Close();
                Application.Restart();
            };
            diag.Controls.Add(linkz);
            linkz = new TaskDialogCommandLink("r", "Exit jZm");
            linkz.Click += delegate(object sender, EventArgs argz)
            {
                diag.Close();
                Environment.Exit(-1);
            };
            diag.Controls.Add(linkz);

            linkz = new TaskDialogCommandLink("r", "Ignore error", "Warning: Plugin might throw more errors, You'll probably be better off contacting the owner and/or removing the plugin.");
            linkz.Click += delegate(object sender, EventArgs argz)
            {
                diag.Close();
            };
            diag.Controls.Add(linkz);
            diag.Show();
        }
Пример #2
0
 static void API_OnPluginCrash(Exception exep, jZmPlugin plugin)
 {
     Console.ForegroundColor = ConsoleColor.Yellow;
     Console.Write("WARNING: ");
     Console.ForegroundColor = ConsoleColor.White;
     Console.WriteLine("Plugin '{0}' by '{1} has caused an {2}. Details:\r\n{3}", plugin.Name, plugin.Author, exep.GetType().FullName, exep.ToString());
 }