示例#1
0
        //-------------------------------------------------------------------------
        // FMEをすべてコロ助
        //-------------------------------------------------------------------------
        public static bool Kill()
        {
            Process[] ps = Process.GetProcessesByName("FlashMediaLiveEncoder");
            if (ps.Length > 0)
            {
                foreach (System.Diagnostics.Process p in ps)
                {
                    p.Kill();
                }
                using (Bouyomi bm = new Bouyomi())
                {
                    bm.Talk("えふえむいー配信を停止しました");
                }
            }

            // すべてのFMEがいなくなったことを確認する
            do
            {
                System.Threading.Thread.Sleep(1000);
                ps = Process.GetProcessesByName("FlashMediaLiveEncoder");
            } while (ps.Length > 0);

            // セッションファイルを殺す
            FMLE.DeleteSessionfile();

            if (mFMEprocess != null)
            {
                mFMEprocess.Close();
                mFMEprocess = null;
            }
            mFMEStarted = false;

            return(ps.Length > 0);
        }
示例#2
0
        public static void Stop()
        {
            Thread th = new Thread(delegate()
            {
                FMLE.Stop();
                NLE.Stop();
                XSplit.Stop();
            });

            th.Name = "NivoLive.HQ.Stop()";
            th.Start();
        }
示例#3
0
        //-------------------------------------------
        // process をスタート
        //-------------------------------------------
        public static bool Start(Dictionary <string, string> iParams)
        {
            try
            {
                // 現在、動作しているプロセスをすべてコロ助
                Kill();

                // プロセスをスタートさせる

                // プロファイルのパス
                //string profile_path = Path.GetTempPath() + "nicovideo_fme.xml";
                string profile_path = Properties.Settings.Default.fmle_profile_path + "\\" + Properties.Settings.Default.fmle_default_profile;


                // FlashMediaEncoderのパス
                string path = Properties.Settings.Default.fmle_path.Replace("FMLECmd", "FlashMediaLiveEncoder");

                // プロファイル作成
                if (!FMLE.MakeProfile(profile_path, iParams))
                {
                    mFMEStarted = false;
                    return(false);
                }

                // FMLECmd起動
                string args = " /g /p \"" + profile_path + "\"";
                mFMEprocess = System.Diagnostics.Process.Start(path, args);
                // ウインドウハンドルが生成されるまで待つ
                mFMEprocess.WaitForInputIdle();

                // 立ち上がるのを待つ
                using (Bouyomi bm = new Bouyomi())
                {
                    bm.Talk("えふえむいー起動中です");
                }
                System.Threading.Thread.Sleep(8000);

                return(PushStart());
            }
            catch (Exception e)
            {
                Utils.WriteLog(e.ToString());
                return(false);
            }
        }
示例#4
0
        //-------------------------------------------------------------------------
        // 外部エンコーダー起動
        //-------------------------------------------------------------------------
        public static void Exec(string LiveID)
        {
            Thread th = new Thread(delegate()
            {
                // NLE
                if (Properties.Settings.Default.use_nle)
                {
                    if (NLE.IsAlive)
                    {
                        NLE.Start();
                        using (Bouyomi bm = new Bouyomi())
                        {
                            bm.Talk("えぬえるいー配信を開始します。");
                        }
                    }
                    else
                    {
                        using (Bouyomi bm = new Bouyomi())
                        {
                            bm.Talk("えぬえるいー配信なんてなかった。");
                        }
                    }
                    return;
                }

                // XSplit
                if (Properties.Settings.Default.use_xsplit)
                {
                    XSplit.Start();
                    using (Bouyomi bm = new Bouyomi())
                    {
                        bm.Talk("エックスプリット配信を開始します。");
                    }
                    return;
                }


                // FME
                if (Properties.Settings.Default.use_fme)
                {
                    string path = Properties.Settings.Default.fmle_profile_path + "\\" + Properties.Settings.Default.fmle_default_profile;;

                    if (!File.Exists(path) && !Properties.Settings.Default.use_xsplit && !Properties.Settings.Default.use_nle)
                    {
                        using (Bouyomi bm = new Bouyomi())
                        {
                            bm.Talk("えふえむいープロファイルが見つかりませんでした");
                        }
                        return;
                    }
                    Nico nico = Nico.Instance;
                    string fmle_profile_path = Properties.Settings.Default.fmle_profile_path + "\\" + Properties.Settings.Default.fmle_default_profile;

                    string lv = LiveID;
                    if (lv.Length > 2)
                    {
                        Dictionary <string, string> fme_profiles = nico.GetFMEProfile(lv);
                        if (fme_profiles == null)
                        {
                            return;
                        }
                        if (fme_profiles.Count <= 1)
                        {
                            return;
                        }
                        if (fme_profiles["status"].Equals("ok"))
                        {
                            FMLE.Start(fme_profiles, fmle_profile_path);
                        }
                    }
                }
            });

            th.Name = "NivoLive.HQ.Exec(): FME";
            th.Start();
        }
示例#5
0
 public static bool hasHQ()
 {
     return(FMLE.hasFME() || NLE.IsBroadCast || XSplit.IsBroadCast);
 }