Exemplo n.º 1
0
        private void ファイルを閉じるCToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.mtEnabled = false;

            try
            {
                confirmSaveFile(true, true, false);

                if (Gnd.i.md != null)
                {
                    BusyDlg.perform(delegate
                    {
                        Gnd.i.md.Dispose();
                        Gnd.i.md = null;
                    });
                }
            }
            catch (Exception ex)
            {
                FailedOperation.caught(ex);
            }

            refreshTitle();
            refreshVideo();
            refreshEnable();

            this.mtEnabled = true;
        }
Exemplo n.º 2
0
        private void quickSaveMenuItem_Click(object sender, EventArgs e)
        {
            this.mtEnabled = false;

            try
            {
                if (Gnd.i.md == null)
                {
                    throw new FailedOperation("ファイルを開いていないのでクイックセーブ出来ません。");
                }

                BusyDlg.perform(() =>
                {
                    if (Gnd.i.qsd != null)
                    {
                        Gnd.i.qsd.Dispose();
                    }

                    Gnd.i.qsd = Gnd.i.md.quickSave();
                });

                throw new Completed();
            }
            catch (Exception ex)
            {
                FailedOperation.caught(ex);
            }

            refreshEnable();

            this.mtEnabled = true;
        }
Exemplo n.º 3
0
 private void endService()
 {
     if (Ground.i.service != null)
     {
         BusyDlg.perform(delegate
         {
             Ground.i.service.Dispose();
             Ground.i.service = null;
         });
     }
 }
Exemplo n.º 4
0
        private void beforeDeletePlayingRow()
        {
            // oc の中なので mtBusy == true であるはず!
            BusyDlg.perform(delegate
            {
                Gnd.i.client.sendLine("D");
                Gnd.i.client.sendLine("+");

                Thread.Sleep(2000);                 // 確実に停止するのを待つ。XXX ちゃんと同期したい。
            });
        }
Exemplo n.º 5
0
        static void Main()
        {
            onBoot();

            Application.ThreadException += new ThreadExceptionEventHandler(applicationThreadException);
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(currentDomainUnhandledException);
            SystemEvents.SessionEnding += new SessionEndingEventHandler(sessionEnding);

            Mutex procMutex = new Mutex(false, APP_IDENT);

            if (procMutex.WaitOne(0) && GlobalProcMtx.Create(APP_IDENT, APP_TITLE))
            {
                checkSelfDir();
                Directory.SetCurrentDirectory(selfDir);
                checkAloneExe();
                checkLogonUser();

                Gnd.i.loadConf();
                Gnd.i.loadData();

                Directory.CreateDirectory(Utils.getMediaDir());

                // orig >

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new MainWin());

                // < orig

                ProcessTools._終了を待っているプロセスを捨てて例外を投げろ = true;

                Gnd.i.saveData();

                BusyDlg.perform(delegate
                {
                    if (Conv.curr != null)
                    {
                        Conv.curr.end();
                        Conv.curr = null;
                    }
                    FileTools.deletePath(Utils.getMediaDir());
                });

                FileTools.clearTMP();

                GlobalProcMtx.Release();
                procMutex.ReleaseMutex();
            }
            procMutex.Close();
        }
Exemplo n.º 6
0
        private void main2()
        {
            // set Gnd.i.mediaDir
            {
                string dir = Environment.GetEnvironmentVariable("TMP");

                if (dir == null || dir == "" || Directory.Exists(dir) == false)
                {
                    throw new Exception("Wrong TMP env");
                }

                Gnd.i.mediaDir = Path.Combine(dir, Consts.MEDIA_DIR_ID);
            }

            FileTools.deletePath(Gnd.i.mediaDir);
            Directory.CreateDirectory(Gnd.i.mediaDir);

            Gnd.i.ffmpge    = new FFmpeg();
            Gnd.i.wavMaster = new WavMaster();
            Gnd.i.monitors  = new Monitors();

            BusyDlg.perform(delegate
            {
                // スクリーン_既に起動しているかチェック
                {
                    using (Nectar2.Recver recver = new Nectar2.Recver(Consts.N2_RECV_IDENT))
                    {
                        Thread.Sleep(2000);                         // 受信待ち。

                        if (recver.recv() != null)                  // ? 何かを受信した。== 既に起動している。-> 停止する。
                        {
                            using (Nectar2.Sender sender = new Nectar2.Sender(Consts.N2_SEND_IDENT))
                            {
                                sender.send(new byte[] { 0x58, 0x00 });             // send "X"

                                Thread.Sleep(5000);                                 // 送信完了待ち。+ スクリーンが完全に終了するまで待つ。
                            }
                        }
                    }
                }
            });

            Gnd.i.bootScreen();             // スクリーン_起動

            using (PlayListWin f = new PlayListWin())
            {
                f.ShowDialog();
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 切断する。
        /// </summary>
        private void disconnect()
        {
            if (Ground.i.con != null)
            {
                BusyDlg.perform(delegate
                {
                    Ground.i.con.Dispose();
                    Ground.i.con = null;
                },
                                this
                                );

                disconnected();
            }
        }
Exemplo n.º 8
0
        public void saveFile(string file)
        {
            try
            {
                BusyDlg.perform(delegate
                {
                    doSave(file);
                });

                _lastSavedFile = file;
            }
            catch (Exception e)
            {
                FailedOperation.caught(e);
            }
        }
Exemplo n.º 9
0
        private void 切り捨てるCToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (Gnd.i.md == null)
            {
                return;
            }

            this.mtEnabled = false;

            try
            {
                if (MessageBox.Show(
                        "時間選択された範囲をカットします。",
                        "エフェクト:切り捨てる",
                        MessageBoxButtons.OKCancel,
                        MessageBoxIcon.Information
                        ) != DialogResult.OK
                    )
                {
                    throw new Ended();
                }

                BusyDlg.perform(delegate
                {
                    new EffectCut().perform();
                });

                // 切り取った範囲が、動画の長さの範囲外になる場合があるため。
                {
                    this.seekBar.Value = Gnd.i.md.ed.a.selectBegin;
                    Gnd.i.md.ed.a.clearSelection();
                }

                throw new Completed();
            }
            catch (Exception ex)
            {
                FailedOperation.caught(ex);
            }

            refreshVideo();
            refreshStatus();
            refreshEnable();             // 時間選択解除されるので!

            this.mtEnabled = true;
        }
Exemplo n.º 10
0
        private void MainWin_DragDrop(object sender, DragEventArgs e)
        {
            try
            {
                string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, false);

                if (files.Length < 1)
                {
                    return;
                }

                string file = files[0];
                file = FileTools.toFullPath(file);                 // 2bs

                mtInvokers.Enqueue(delegate
                {
                    try
                    {
                        confirmSaveFile(true, true, false);

                        BusyDlg.perform(delegate
                        {
                            if (Gnd.i.md != null)
                            {
                                Gnd.i.md.Dispose();
                                Gnd.i.md = null;
                            }
                            Gnd.i.md = new MediaData(file);
                        },
                                        this
                                        );
                    }
                    catch (Exception ex)
                    {
                        FailedOperation.caught(ex);
                    }

                    refreshTitle();
                    refreshVideo();
                    refreshEnable();
                });
            }
            catch
            { }
        }
Exemplo n.º 11
0
        private void ファイルを開くOToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.mtEnabled = false;

            try
            {
                confirmSaveFile(false, true, false);

                string presetFile = Gnd.i.lastOpenedFile;

                string selectedFile = selectedFile = SaveLoadDialogs.LoadFile(
                    "動画ファイルを選択してください",
                    "",
                    Path.GetDirectoryName(presetFile),
                    Path.GetFileName(presetFile),
                    dlg =>
                {
                    dlg.Filter      = Gnd.i.movieExtensions.getFilter();
                    dlg.FilterIndex = Gnd.i.movieExtensions.indexOf(".mp4") + 1;
                });

                if (selectedFile != null)
                {
                    BusyDlg.perform(delegate
                    {
                        if (Gnd.i.md != null)
                        {
                            Gnd.i.md.Dispose();
                            Gnd.i.md = null;
                        }
                        Gnd.i.md = new MediaData(selectedFile);
                    });
                }
            }
            catch (Exception ex)
            {
                FailedOperation.caught(ex);
            }

            refreshTitle();
            refreshVideo();
            refreshEnable();

            this.mtEnabled = true;
        }
Exemplo n.º 12
0
        private void ぼかし2KToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (Gnd.i.md == null)
            {
                return;
            }

            this.mtEnabled = false;

            try
            {
                if (MessageBox.Show(
                        "画面選択・時間選択された範囲にぼかしを「強めに」入れます。\nこの処理には時間が掛かります。",
                        "ぼかし2",
                        MessageBoxButtons.OKCancel,
                        MessageBoxIcon.Information
                        ) != DialogResult.OK
                    )
                {
                    throw new Ended();
                }

                Gnd.i.cancelled = false;

                BusyDlg.perform(delegate
                {
                    new EffectBokashi().perform(true);
                },
                                this,
                                true
                                );

                throw new Completed();
            }
            catch (Exception ex)
            {
                FailedOperation.caught(ex);
            }

            refreshVideoFrame();
            refreshStatus();

            this.mtEnabled = true;
        }
Exemplo n.º 13
0
        public void endTh(bool plClosing = false)
        {
            BusyDlg.perform(delegate
            {
                if (plClosing)
                {
                    ffmpegTh.Dispose();
                    ffmpegTh = null;
                }
                clientTh.Dispose();
                clientTh = null;

                convTh.Dispose();
                convTh = null;

                bgConvTh.Dispose();
                bgConvTh = null;
            });
        }
Exemplo n.º 14
0
        private void  前を付けて保存AToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.mtEnabled = false;

            try
            {
                if (Gnd.i.md == null)
                {
                    return;
                }

                string presetFile = Gnd.i.md.ed.getLastSavedFile();
                //string presetFile = Gnd.i.md.getOriginalFile(); // old

                string selectedFile = SaveLoadDialogs.SaveFile(
                    "保存先のファイルを選択してください",
                    "",
                    Path.GetDirectoryName(presetFile),
                    Path.GetFileName(presetFile),
                    dlg =>
                {
                    dlg.Filter      = Gnd.i.movieExtensions.getFilter();
                    dlg.FilterIndex = Gnd.i.movieExtensions.indexOf(".mp4") + 1;
                });

                if (selectedFile != null)
                {
                    BusyDlg.perform(delegate
                    {
                        Gnd.i.md.ed.saveFile(selectedFile);
                    });
                }
            }
            catch (Exception ex)
            {
                FailedOperation.caught(ex);
            }

            refreshTitle();

            this.mtEnabled = true;
        }
Exemplo n.º 15
0
        public void dispose(IWin32Window owner = null, bool suspending = false)
        {
            if (_n2w != null)
            {
                BusyDlg.perform(delegate
                {
#if true
                    if (suspending)
                    {
                        _n2w.sendLine("D");                         // 動画を直ちに停止
                    }
                    else
                    {
                        _n2w.sendLine("F");                         // 動画・音楽フェードアウト
                        _n2w.sendLine("-");                         // 壁紙非表示

                        Thread.Sleep(2000);
                    }
                    _n2w.sendLine("X");

                    Gnd.i.waitForScreenRunning(5000);       // スクリーンが完全に終了するまで待つ。
#else // old
                    _n2w.sendLine("F");                     // 動画・音楽フェードアウト
                    _n2w.sendLine("-");                     // 壁紙非表示

                    Thread.Sleep(2000);

                    _n2w.sendLine("X");
                    _n2w.waitForBusySending();

                    Thread.Sleep(2000);                     // スクリーンが完全に終了するまで待つ。
#endif

                    _n2w.Dispose();
                    _n2w = null;
                },
                                owner
                                );
            }
        }
Exemplo n.º 16
0
        private void 枠外切り捨てToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (Gnd.i.md == null)
            {
                return;
            }

            this.mtEnabled = false;

            try
            {
                if (MessageBox.Show(
                        "画面選択された範囲外を切り捨てます。",
                        "枠外切り捨て",
                        MessageBoxButtons.OKCancel,
                        MessageBoxIcon.Information
                        ) != DialogResult.OK
                    )
                {
                    throw new Ended();
                }

                BusyDlg.perform(delegate
                {
                    new Effect枠外切り捨て().perform();
                });

                throw new Completed();
            }
            catch (Exception ex)
            {
                FailedOperation.caught(ex);
            }

            refreshVideoFrame();
            refreshStatus();

            this.mtEnabled = true;
        }
Exemplo n.º 17
0
        private void quickLoadMenuItem_Click(object sender, EventArgs e)
        {
            this.mtEnabled = false;

            try
            {
                if (Gnd.i.qsd == null)
                {
                    throw new FailedOperation("クイックセーブしていません。");
                }

                if (Gnd.i.md == null)
                {
                    throw new FailedOperation("ファイルを開いていないのでクイックロード出来ません。");
                }

                BusyDlg.perform(() =>
                {
                    Gnd.i.md.quickLoad(Gnd.i.qsd);
                });

                throw new Completed();
            }
            catch (Exception ex)
            {
                FailedOperation.caught(ex);
            }

            // 全部リフレッシュする。
            {
                refreshVideo();
                refreshStatus();
                refreshEnable();
            }

            this.mtEnabled = true;
        }
Exemplo n.º 18
0
        private void 字幕を入れるToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (Gnd.i.md == null)
            {
                return;
            }

            this.mtEnabled = false;

            try
            {
                using (Input字幕Dlg f = new Input字幕Dlg())
                {
                    f.ShowDialog();

                    if (f.OkPressed)
                    {
                        BusyDlg.perform(delegate
                        {
                            new Effect字幕入力().perform(f.Ret_Line1, f.Ret_Align1, f.Ret_Line2, f.Ret_Align2);
                        });

                        throw new Completed();
                    }
                }
            }
            catch (Exception ex)
            {
                FailedOperation.caught(ex);
            }

            refreshVideoFrame();
            refreshStatus();

            this.mtEnabled = true;
        }
Exemplo n.º 19
0
        private void perform()
        {
            if (FFmpeg.isFFmpegDir(Gnd.i.ffmpegDir) == false)
            {
                using (FFmpegDirDlg f = new FFmpegDirDlg())
                {
                    f.ShowDialog();
                }
                if (Gnd.i.ffmpegDir == "")
                {
                    throw new Cancelled("ffmpeg のパスが指定されていないため、続行出来ません。");
                }
                if (FFmpeg.isFFmpegDir(Gnd.i.ffmpegDir) == false)
                {
                    throw new Cancelled("ffmpeg のパスが見つからないため、続行出来ません。");
                }
            }

            try
            {
                BusyDlg.perform(delegate
                {
                    FFmpegBin.i = new FFmpegBin(FFmpeg.getBinDir());

                    try
                    {
                        FFmpegBinTester.doTest();
                    }
                    catch (Exception e)
                    {
                        Gnd.i.ffmpegDir = "";                         // 次回起動時に再設定出来るように..
                        throw new ExceptionCarrier(e);
                    }

                    if (Gnd.i.bootOpenFile != null)
                    {
                        Gnd.i.md = new MediaData(Gnd.i.bootOpenFile);
                    }
                });

                using (MainWin f = new MainWin())
                {
                    f.ShowDialog();
                }
            }
            finally
            {
                BusyDlg.perform(delegate
                {
                    if (Gnd.i.md != null)
                    {
                        Gnd.i.md.Dispose();
                        Gnd.i.md = null;
                    }
                    if (Gnd.i.qsd != null)
                    {
                        Gnd.i.qsd.Dispose();
                        Gnd.i.qsd = null;
                    }
                    if (FFmpegBin.i != null)
                    {
                        FFmpegBin.i.Dispose();
                        FFmpegBin.i = null;
                    }
                });
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// プレイリスト中の未変換 ogg, ogv を一気に変換する。
        /// mainTimerTick の中から呼ばれること!
        /// </summary>
        private void convBypass(int needConvOcxIndex)
        {
            List <ConvBypassEntry> entries = new List <ConvBypassEntry>();

            if (Gnd.i.convBypassまとめて実行)
            {
                for (int rowidx = 0; rowidx < plSheet.RowCount; rowidx++)
                {
                    MediaInfo mi = plSheetGetRow(rowidx);

                    if (mi.status == Consts.MediaStatus_e.NEED_CONVERSION && Utils.isOgxPath(mi.file))
                    {
                        entries.Add(new ConvBypassEntry()
                        {
                            rowidx = rowidx,
                            mi     = mi,
                        });
                    }
                }
            }
            else
            {
                entries.Add(new ConvBypassEntry()
                {
                    rowidx = needConvOcxIndex,
                    mi     = plSheetGetRow(needConvOcxIndex),
                });
            }

            {
                OperationCenter convOcBk = Gnd.i.convOc;
                Gnd.i.convOc = new OperationCenter();

                BusyDlg.perform(delegate
                {
                    foreach (ConvBypassEntry cbe in entries)
                    {
                        using (Conv conv = new Conv(cbe.mi.file, Path.Combine(Gnd.i.mediaDir, StringTools.zPad(cbe.mi.serial, 10))))
                        {
                            while (conv.completed == false)
                            {
                                Gnd.i.convOc.eachTimerTick();
                            }
                            cbe.mi.status = Consts.MediaStatus_e.READY;
                            completedConvToMediaInfo(conv, cbe.mi);
                            cbe.proced = true;
                        }
                    }
                },
                                this,
                                entries.Count == 1
                                );

                Gnd.i.convOc = convOcBk;
            }

            foreach (ConvBypassEntry cbe in entries)
            {
                if (cbe.proced)
                {
                    plSheetSetRow(cbe.rowidx, cbe.mi);

                    if (cbe.rowidx == 0 && Gnd.i.autoPlayTop)                     // 自動再生
                    {
                        int playingIndex = getPlayingIndex();

                        if (playingIndex == -1)                         // ? 未再生
                        {
                            Gnd.i.lastPlayedSerial = cbe.mi.serial;
                            Gnd.i.client.sendLine("ES!");
                        }
                    }
                }
            }
        }