示例#1
0
        void medic()
        {
            Logger.med.a("active");
            while (true)
            {
                if (qt()) break;
                for (int a = 0; a < encoders.Count; a++)
                {
                    LSEncoder enc = encoders[a];
                    if (enc.crashed)
                    {
                        if (res_cd == 0) Logger.pcm.a("pending resurrect " + enc.enc.ext);
                        if (++res_cd < 50) continue;
                        res_cd = 0;

                        Logger.pcm.a("resurrecting " + enc.enc.ext);
                        enc.Dispose();
                        try
                        {
                            if (enc.enc.ext == "mp3")
                            {
                                enc = new LSLame(settings, this);
                            }
                            else if (enc.enc.ext == "ogg")
                            {
                                enc = new LSVorbis(settings, this);
                            }
                            else
                            {
                                System.Windows.Forms.MessageBox.Show("this shouldn't happen");
                                Program.kill();
                            }
                            lock (locker)
                            {
                                encoders[a] = enc;
                            }
                            Logger.pcm.a("resurrected " + enc.enc.ext);
                        }
                        catch
                        {
                            Logger.pcm.a("resurrect failure: " + enc.enc.ext);
                            Program.ni.ShowBalloonTip(1000, "Connection error", "Failed to restart " + enc.enc.ext, System.Windows.Forms.ToolTipIcon.Error);
                        }
                    }
                    else if (enc.aborted)
                    {
                        string msg = "Removing " + enc.enc.ext + " encoder";

                        Logger.pcm.a(msg);
                        encoders.RemoveAt(a--);
                        Program.ni.ShowBalloonTip(1000, "Connection error", msg, System.Windows.Forms.ToolTipIcon.Error);
                    }
                }
                System.Threading.Thread.Sleep(10);
            }
            Logger.med.a("disposed");
        }
示例#2
0
        void medic()
        {
            Logger.med.a("active");
            while (!qt("medic"))
            {
                for (int a = 0; a < encoders.Count; a++)
                {
                    LSEncoder enc = encoders[a];
                    if (enc.crashed)
                    {
                        if (res_cd == 0)
                        {
                            Logger.pcm.a("pending resurrect " + enc.enc.ext);
                        }
                        if (++res_cd < 50)
                        {
                            continue;
                        }
                        res_cd = 0;

                        Logger.pcm.a("resurrecting " + enc.enc.ext);
                        enc.Dispose();
                        try
                        {
                            if (enc.enc.ext == "mp3")
                            {
                                enc = new LSLame(settings, this);
                            }
                            else if (enc.enc.ext == "ogg")
                            {
                                enc = new LSVorbis(settings, this);
                            }
                            else if (enc.enc.ext == "opus")
                            {
                                enc = new LSOpus(settings, this);
                            }
                            else
                            {
                                System.Windows.Forms.MessageBox.Show("this shouldn't happen");
                                Program.kill();
                            }
                            lock (locker)
                            {
                                encoders[a] = enc;
                            }
                            Logger.pcm.a("resurrected " + enc.enc.ext);
                        }
                        catch
                        {
                            Logger.pcm.a("resurrect failure: " + enc.enc.ext);
                            if (Program.BALLOONS)
                            {
                                Program.ni.ShowBalloonTip(1000, "Connection error", "Failed to restart " + enc.enc.ext, System.Windows.Forms.ToolTipIcon.Error);
                            }
                        }
                    }
                    else if (enc.aborted)
                    {
                        string msg = "Removing " + enc.enc.ext + " encoder";

                        Logger.pcm.a(msg);
                        encoders.RemoveAt(a--);
                        if (Program.BALLOONS)
                        {
                            Program.ni.ShowBalloonTip(1000, "Connection error", msg, System.Windows.Forms.ToolTipIcon.Error);
                        }
                    }
                }
                System.Threading.Thread.Sleep(10);
            }
            Logger.med.a("disposed");
        }