Ejemplo n.º 1
0
 public static void Initialize()
 {
     try
     {
         DuckRig._hatPoints.Clear();
         DuckRig._chestPoints.Clear();
         BinaryReader binaryReader = new BinaryReader((Stream)File.OpenRead(Content.path + "rig_duckRig.rig"));
         int          num          = binaryReader.ReadInt32();
         for (int index = 0; index < num; ++index)
         {
             DuckRig._hatPoints.Add(new Vec2()
             {
                 x = (float)binaryReader.ReadInt32(),
                 y = (float)binaryReader.ReadInt32()
             });
             DuckRig._chestPoints.Add(new Vec2()
             {
                 x = (float)binaryReader.ReadInt32(),
                 y = (float)binaryReader.ReadInt32()
             });
         }
         binaryReader.Close();
         binaryReader.Dispose();
     }
     catch (Exception ex)
     {
         Program.LogLine(MonoMain.GetExceptionString((object)ex));
     }
 }
Ejemplo n.º 2
0
        private static void UnhandledExceptionTrapperTestServer(
            object sender,
            UnhandledExceptionEventArgs e)
        {
            string       exceptionString = MonoMain.GetExceptionString(e);
            StreamWriter streamWriter    = new StreamWriter("ducklog.txt", true);

            streamWriter.WriteLine(exceptionString + "\n");
            streamWriter.Close();
            Environment.Exit(1);
        }
Ejemplo n.º 3
0
        public static void HandleGameCrash(Exception e)
        {
            try
            {
                string    s         = !MonoMain.hadInfiniteLoop ? MonoMain.GetExceptionString((object)e) : MonoMain.infiniteLoopDetails;
                Exception exception = e;
                bool      flag1     = false;
                bool      flag2     = false;
                Assembly  assembly  = (Assembly)null;
                try
                {
                    foreach (Mod allMod in (IEnumerable <Mod>)ModLoader.allMods)
                    {
                        switch (allMod)
                        {
                        case CoreMod _:
                        case DisabledMod _:
                            continue;

                        default:
                            bool flag3 = allMod.configuration.assembly == exception.TargetSite.DeclaringType.Assembly;
                            if (!flag3)
                            {
                                foreach (System.Type type in allMod.configuration.assembly.GetTypes())
                                {
                                    if (e.StackTrace.Contains(type.ToString()))
                                    {
                                        flag3 = true;
                                        break;
                                    }
                                    if (e.InnerException != null && e.InnerException.StackTrace.Contains(type.ToString()))
                                    {
                                        flag3 = true;
                                        break;
                                    }
                                }
                            }
                            if (flag3)
                            {
                                assembly = allMod.configuration.assembly;
                                flag1    = true;
                                if (!MonoMain.modDebugging)
                                {
                                    allMod.configuration.Disable();
                                    flag2 = true;
                                    continue;
                                }
                                continue;
                            }
                            continue;
                        }
                    }
                    Exception innerException = e.InnerException;
                }
                catch (Exception ex)
                {
                }
                try
                {
                    s = s.Replace("E:\\gamedev\\DuckGame_Steam\\duckgame_halloween_new\\duckgame\\", "");
                }
                catch (Exception ex)
                {
                }
                Program.WriteToLog(s);
                Program.SendMessage(Program.main.Window.Handle, 16U, IntPtr.Zero, IntPtr.Zero);
                Process.Start("CrashWindow.exe", "-modResponsible " + (flag1 ? "1" : "0") + " -modDisabled " + (flag2 ? "1" : "0") + " -modAssembly " + (assembly != (Assembly)null ? assembly.GetName().Name : "UNKNOWN") + " -exceptionString \"" + s.Replace("\n", "|NEWLINE|").Replace("\r", "|NEWLINE2|") + "\" -source " + exception.Source + " -commandLine \"" + Program.commandLine + "\" -executable \"" + Application.ExecutablePath + "\"");
                Environment.Exit(1);
            }
            catch (Exception ex)
            {
                StreamWriter streamWriter = new StreamWriter("ducklog.txt", true);
                streamWriter.WriteLine("Failed to write exception to log.\n");
                streamWriter.Close();
            }
        }