Exemple #1
0
        void genExceptionData()
        {
            this.gRestart = null;
            try
            {
                Int32 nix = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
                serPath = Program.tools + "loopstream-crash-" + nix + ".";

                var           se = new SerializableException(ex);
                StringBuilder sb = new StringBuilder();
                gi = new GeneralInfo(se, ex);

                LSSettings s = LSSettings.singleton;
                try
                {
                    if (s == null)
                    {
                        LSSettings.singleton = new LSSettings();
                        s      = LSSettings.singleton;
                        s.host = "nullsettings";
                    }
                    s.serverPresets = new List <LSSettings.LSServerPreset>();
                    s.metas         = new List <LSSettings.LSMeta>();
                    s.host          = "(redacted)";
                    s.pass          = "******";
                    sb.Append("\r\n// cfg\r\n" + GeneralInfo.ser(s));
                }
                catch (Exception exx) { }

                try
                {
                    var devs = new LSDevice[s.devs.Length];
                    for (var a = 0; a < devs.Length; a++)
                    {
                        devs[a] = s.devs[a] as LSDevice;
                    }

                    sb.Append("\r\n// devs\r\n" + GeneralInfo.ser(devs));
                }
                catch (Exception exx) { }

                sb.AppendLine();
                try
                {
                    sb.AppendLine("\n\n\n\n\nCache for opus"); sb.AppendLine(Logger.opus.compile());
                    sb.AppendLine("\n\n\n\n\nCache for ogg"); sb.AppendLine(Logger.ogg.compile());
                    sb.AppendLine("\n\n\n\n\nCache for mp3"); sb.AppendLine(Logger.mp3.compile());
                    sb.AppendLine("\n\n\n\n\nCache for pcm"); sb.AppendLine(Logger.pcm.compile());
                    sb.AppendLine("\n\n\n\n\nCache for med"); sb.AppendLine(Logger.med.compile());
                    sb.AppendLine("\n\n\n\n\nCache for mix"); sb.AppendLine(Logger.mix.compile());
                    sb.AppendLine("\n\n\n\n\nCache for tag"); sb.AppendLine(Logger.tag.compile());
                    sb.AppendLine("\n\n\n\n\nCache for app"); sb.AppendLine(Logger.app.compile());
                }
                catch { }
                serText = gi.ToString() + "\r\n" + sb.ToString();
                System.IO.File.WriteAllText(serPath + "1.txt", serText, Encoding.UTF8);

                InitializeComponent();
                gDesc.Text      = "L o a d i n g    d e t a i l s . . .";
                linkLabel1.Text = serPath + "1.txt";
                gDesc.Enabled   = gIgnOnce.Enabled = gIgnAlways.Enabled = gRestart.Enabled = false;
            }
            catch (Exception exx)
            {
                serText = null;
                string desc = "";
                try
                {
                    var msg = ex.Message + "\r\n\r\n" + ex.StackTrace;

                    desc = "Shit is properly f****d, can't send error information to devs\r\n" +
                           "This is the best I can do:\r\n\r\n" + msg;

                    System.IO.File.WriteAllText(serPath + "0.txt", msg, Encoding.UTF8);
                    linkLabel1.Text = serPath + "0.txt";
                }
                catch
                {
                    desc = "Shit is properly f****d, can't send error information to devs";
                }

                if (this.gRestart == null)
                {
                    InitializeComponent();
                }

                gDesc.Text    = desc;
                gDesc.Enabled = gIgnOnce.Enabled = gIgnAlways.Enabled = gRestart.Enabled = true;
                gRestart.Focus();
            }
        }
Exemple #2
0
        void t_Tick(object sender, EventArgs e)
        {
            ((Timer)sender).Stop();
            try
            {
                var se = new SerializableException(ex);
                gi = new GeneralInfo(se, ex);

                LSSettings s = LSSettings.singleton;
                try
                {
                    if (s == null)
                    {
                        s      = new LSSettings();
                        s.host = "nullsettings";
                    }
                    s.serverPresets = new List <LSSettings.LSServerPreset>();
                    s.pass          = "******";
                    GeneralInfo.ser(s);
                }
                catch { }
                try
                {
                    if (s.devs == null)
                    {
                        s.devs = new LSDevice[0];
                    }
                    GeneralInfo.ser(s.devs);
                }
                catch
                {
                    try { s.devs = new LSDevice[0]; }
                    catch { }
                }

                StringBuilder sb = new StringBuilder();
                sb.AppendLine();
                bool ok1, ok2, ok3, oks;
                ok1 = ok2 = ok3 = oks = false;
                try
                {
                    ok1 = s.devRec != null && s.devRec.mm != null;
                    ok2 = s.devMic != null && s.devMic.mm != null;
                    ok3 = s.devOut != null && s.devOut.mm != null;
                    sb.AppendLine("dev state indicated: " + ok1 + ", " + ok2 + ", " + ok3);
                    LSSettings.singleton.init();
                    s.runTests(null, true);
                    ok1 = ok1 == (s.devRec != null && s.devRec.mm != null);
                    ok2 = ok2 == (s.devMic != null && s.devMic.mm != null);
                    ok3 = ok3 == (s.devOut != null && s.devOut.mm != null);
                    sb.AppendLine("dev state correct: " + ok1 + ", " + ok2 + ", " + ok3);
                    oks = true;
                }
                catch { }
                try
                {
                    sb.AppendLine("\n\n\n\n\nCache for ogg"); sb.AppendLine(Logger.ogg.compile());
                    sb.AppendLine("\n\n\n\n\nCache for mp3"); sb.AppendLine(Logger.mp3.compile());
                    sb.AppendLine("\n\n\n\n\nCache for pcm"); sb.AppendLine(Logger.pcm.compile());
                    sb.AppendLine("\n\n\n\n\nCache for med"); sb.AppendLine(Logger.med.compile());
                    sb.AppendLine("\n\n\n\n\nCache for mix"); sb.AppendLine(Logger.mix.compile());
                    sb.AppendLine("\n\n\n\n\nCache for tag"); sb.AppendLine(Logger.tag.compile());
                    sb.AppendLine("\n\n\n\n\nCache for app"); sb.AppendLine(Logger.app.compile());
                }
                catch { }
                gi.moar = sb.ToString();
                string serialized = gi.ToString();

                gDesc.Enabled = true;
                gDesc.Text    = defaultmsg;
                gExit.Enabled = true;
                gSend.Enabled = true;
                gSend.Focus();

                /*string one = Z.gze(serialized);
                 * string two = Z.lze(serialized);
                 * gDesc.Text =
                 *  one.Length + "\n" +
                 *  two.Length + "\n\n" +
                 *  Convert.FromBase64String(one).Length + "\n" +
                 *  Convert.FromBase64String(two).Length + "\n\n" +
                 *  serialized;
                 *
                 * System.IO.File.WriteAllBytes("dump.txt", Encoding.UTF8.GetBytes(serialized));
                 * System.IO.File.WriteAllBytes("dump.gz", Convert.FromBase64String(one));
                 * System.IO.File.WriteAllBytes("dump.lzma", Convert.FromBase64String(two));*/

                if (oks && (!ok1 || !ok2 || !ok3))
                {
                    if (DialogResult.Yes == MessageBox.Show(
                            "The  bad  news:   Loopstream just crashed :(\n" +
                            "The good news:   I think I know why!\n\n" +
                            "Did you disconnect or disable your speakers or microphone?\n" +
                            "'cause you need to restart Loopstream every time you do that.\n\n" +
                            "Wanna go for a restart?", "Dirty devices detected",
                            MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation))
                    {
                        Program.fixWorkingDirectory();
                    }
                }
            }
            catch (Exception exx)
            {
                gDesc.Enabled = true;
                try
                {
                    gDesc.Text = "Shit is properly f****d, can't send error information to devs\r\n" +
                                 "This is the best I can do:\r\n\r\n" +
                                 ex.Message + "\r\n\r\n" + ex.StackTrace;
                }
                catch
                {
                    gDesc.Text = "Shit is properly f****d, can't send error information to devs";
                }
                gExit.Enabled = true;
                gExit.Focus();
            }
        }
Exemple #3
0
        internal GeneralInfo(SerializableException serializableException, Exception exception)
        {
            this.exception = serializableException;

            if (this.exception == null)
            {
                this.exception = new SerializableException();
            }

            HostApplicationVersion = System.Windows.Forms.Application.ProductVersion + "-" + Program.beta;

            this.CLRVersion = Environment.Version.ToString();

            this.DateTimeLC = System.DateTime.Now.ToString("yyyy-MM-dd_HH.mm.ss");

            this.DateTimeUTC = System.DateTime.UtcNow.ToString("yyyy-MM-dd_HH.mm.ss");

            this.os = string.Format(
                "CLR: {1}{0}" +
                "OS: {2}{0}" +
                "i64: {3}, {4}{0}" +
                "Sysdir: {5}{0}",
                "\r\n",
                Environment.Version.ToString(),
                Environment.OSVersion.VersionString,
                Environment.Is64BitOperatingSystem,
                IntPtr.Size,
                Environment.SystemDirectory);

            if (serializableException != null)
            {
                this.ExceptionType = serializableException.Type;

                if (!string.IsNullOrEmpty(serializableException.TargetSite))
                {
                    this.TargetSite = serializableException.TargetSite;
                }
                else if (serializableException.InnerException != null && !string.IsNullOrEmpty(serializableException.InnerException.TargetSite))
                {
                    this.TargetSite = serializableException.InnerException.TargetSite;
                }

                this.ExceptionMessage = serializableException.Message;
            }

            /*Variables vars = new Variables();
             * this.vars = vars;
             * try
             * {
             *  var trace = new System.Diagnostics.StackTrace(exception);
             *  var frame = trace.GetFrame(1);
             *  var methodName = frame.GetMethod().Name;
             *  var properties = this.GetType().GetProperties();
             *  var fields = this.GetType().GetFields();
             *  foreach (var prop in properties)
             *  {
             *      vars.properties.Add(prop.GetValue(exception. null).ToString());
             *  }
             *
             * }
             * catch { }*/
        }