Beispiel #1
0
 public static void RegisterProblem(IMinecraftProblem prob)
 {
     for (int i = 0; i < problems.Count; i++)
     {
         if ((problems[i] as IMinecraftProblem) == null)
         {
             continue;
         }
         if (prob.GetPriority() > (problems[i] as IMinecraftProblem).GetPriority())
         {
             problems.Insert(i, prob);
             return;
         }
     }
     problems.Add(prob);
 }
Beispiel #2
0
        void InstOutput(object sender, DataReceivedEventArgs e)
        {
            IMinecraftProblem prob = Problems.GetRelevantProblem(e.Data);

            if (prob != null)
            {
                string errorMsg = prob.GetErrorMessage(e.Data);

                Invoke((o, args) =>
                       MultiMC.GUI.MessageDialog.Show(this, errorMsg, "Error Detected"));
                if (prob.ShouldTerminate(e.Data) && AppSettings.Main.QuitIfProblem)
                {
                    KillMinecraft(false);
                }
            }

            Message(e.Data);
        }
Beispiel #3
0
        void ScanOutput(string mcOutput)
        {
            if (mcOutput == null)
            {
                return;
            }

            bool killMC            = false;
            IMinecraftProblem prob = Problems.GetRelevantProblem(mcOutput);

            if (prob != null)
            {
                Application.Invoke(
                    (sender2, e2) =>
                {
                    if (!Visible)
                    {
                        Show();
                    }
                    else
                    {
                        GdkWindow.Raise();
                    }
                    GUI.MessageDialog.Show(this,
                                           prob.GetErrorMessage(mcOutput),
                                           "You dun goofed!");
                });
                killMC        = prob.ShouldTerminate(mcOutput) && AppSettings.Main.QuitIfProblem;
                ErrorOccurred = killMC;
            }

            if (killMC)
            {
                new Thread(() =>
                {
                    Thread.Sleep(1000);
                    if (Inst.InstProcess != null &&
                        !Inst.InstProcess.HasExited)
                    {
                        Inst.InstProcess.Kill();
                    }
                }).Start();
            }
        }
Beispiel #4
0
 public static void LoadProblemsFromAssembly(Assembly asm)
 {
     foreach (Type type in asm.GetTypes())
     {
         if (type.IsClass && type.IsPublic && !type.IsAbstract)
         {
             if (typeof(IMinecraftProblem).IsAssignableFrom(type))
             {
                 if (type.GetConstructor(Type.EmptyTypes) != null)
                 {
                     try
                     {
                         IMinecraftProblem problem = (IMinecraftProblem)
                                                     Activator.CreateInstance(type);
                         RegisterProblem(problem);
                     } catch
                     {
                     }
                 }
             }
         }
     }
 }
Beispiel #5
0
 public static void UnregisterProblem(IMinecraftProblem prob)
 {
     problems.Remove(prob);
 }
Beispiel #6
0
 public static void UnregisterProblem(IMinecraftProblem prob)
 {
     problems.Remove(prob);
 }
Beispiel #7
0
 public static void RegisterProblem(IMinecraftProblem prob)
 {
     for (int i = 0; i < problems.Count; i++)
     {
         if ((problems[i] as IMinecraftProblem) == null)
             continue;
         if (prob.GetPriority() > (problems[i] as IMinecraftProblem).GetPriority())
         {
             problems.Insert(i, prob);
             return;
         }
     }
     problems.Add(prob);
 }