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(); } }
private void CloseWindow() { this.MT_Enabled = false; this.TaskTrayIcon.Visible = false; // プロセス終了時にすること { using (Form f = new BusyDlg(Background.End)) { f.ShowDialog(); } } this.Close(); }
/// <summary> /// 切断する。 /// </summary> private void disconnect() { if (Ground.i.con != null) { BusyDlg.perform(delegate { Ground.i.con.Dispose(); Ground.i.con = null; }, this ); disconnected(); } }
public void saveFile(string file) { try { BusyDlg.perform(delegate { doSave(file); }); _lastSavedFile = file; } catch (Exception e) { FailedOperation.caught(e); } }
private void RecEnded() { if (Gnd.I.RecEndUnmin) { this.WindowState = FormWindowState.Normal; } string destFile = TimeData.Now().GetSimpleString() + ".bat"; for (; ;) { destFile = SaveLoadDialogs.SaveFile("保存先のバッチファイルを入力してください", "バッチ:bat", Gnd.I.OutDir, Path.GetFileName(destFile)); if (destFile != null) { if (destFile.StartsWith("\\\\")) { MessageBox.Show( "ネットワークパスは使用できません。", "ファイル名に問題があります", MessageBoxButtons.OK, MessageBoxIcon.Warning ); continue; } if (JString.IsJString(destFile, true, false, false, true, false) == false) { MessageBox.Show( "Shift_JIS で表現出来ない文字は使用できません。", "ファイル名に問題があります", MessageBoxButtons.OK, MessageBoxIcon.Warning ); continue; } Gnd.I.OutDir = Path.GetDirectoryName(destFile); this.SaveData(); // 設定反映!!! BusyDlg.Perform(delegate { new BatchConv(Gnd.I.RecFile, destFile).Perform(); }); } break; } }
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; }
private void 設定SToolStripMenuItem_Click(object sender, EventArgs e) { this.MT_Enabled = false; this.TaskTrayIcon.Visible = false; using (Form f = new BusyDlg(Background.End)) { f.ShowDialog(); } using (Form f = new SettingWin()) { f.ShowDialog(); } this.TaskTrayIcon.Visible = true; this.MT_Enabled = true; }
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; }
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 { } }
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; }
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; }); }
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; }
public static void perform(operation_d operation, IWin32Window owner = null, bool forceNoDlg = false) { if (performing || forceNoDlg) { operation(); } else { using (BusyDlg f = new BusyDlg(operation)) { performing = true; f.ShowDialog(owner); performing = false; if (f._e != null) { throw new ExceptionCarrier(f._e); } } } }
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 ); } }
private void 直ちに更新UToolStripMenuItem_Click(object sender, EventArgs e) { this.MT_Enabled = false; this.TaskTrayIcon.Visible = false; using (Form f = new BusyDlg(Background.End)) { f.ShowDialog(); } { TimeData now = TimeData.Now(); foreach (Gnd.ClientInfo info in Gnd.ClientInfos) { info.Time次回更新 = now; } } this.TaskTrayIcon.Visible = true; this.MT_Enabled = true; }
public BusyDlg(operation_d operation, bool cancellable) { self = this; _operation = operation; InitializeComponent(); if (cancellable == false) { this.btnCancel.Visible = false; this.Height = 110; } this.MinimumSize = this.Size; this.MaximumSize = new Size(this.Size.Width * 2, this.Size.Height); this.lblStatus.Text = ""; this.lblOptStatus.Text = ""; Gnd.i.progressMessage.post(null); Gnd.i.progressOptionalMessage.post(null); }
private void BtnDoTest_Click(object sender, EventArgs e) { this.Visible = false; Gnd.ClientInfo escInfo = _info; _info = new Gnd.ClientInfo(); this.SaveData(); ClientData client = new ClientData(_info); _info = escInfo; using (Form f = new BusyDlg(new ClientData.ClientDataTh(client).End)) { f.ShowDialog(); } using (Form f = new ResultWin(client)) { f.ShowDialog(); } this.Visible = true; this.UIRefresh(); }
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; }
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; }
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; }
private void BusyDlg_FormClosed(object sender, FormClosedEventArgs e) { this.mtEnabled = false; self = null; }
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; } }); } }
/// <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!"); } } } } }