private void btnExport_Click(object sender, EventArgs e) { try { if (txtIdent.Text == "") // ? 未生成 { throw new FailedOperation("鍵を生成して下さい。"); } string keyFile = SaveLoadDialogs.SaveFile( "保存先の鍵ファイルを選択してください", "鍵:unreal-remo-key", Environment.GetFolderPath(Environment.SpecialFolder.Desktop), this.txtIdent.Text + ".unreal-remo-key" ); if (keyFile != null) { XNode root = new XNode("UnrealRemoco-Key"); root.children.Add(new XNode("Ident", this.txtIdent.Text)); root.children.Add(new XNode("Key", this.txtRaw.Text)); root.children.Add(new XNode("Hash", this.txtHash.Text)); root.save(keyFile); throw new Completed("鍵ファイルに保存しました。"); } } catch (Exception ex) { FailedOperation.caught(ex); } }
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; }
private void btnOk_Click(object sender, EventArgs e) { try { try { if (IntTools.isRange(int.Parse(this.txtRelayPortNo.Text), 1, 65535) == false) { throw null; } } catch { throw new FailedOperation( "中継用ポート番号に問題があります。\n" + "・指定できる値は 1 以上 65535 以下の整数です。" ); } // save { Ground.i.relayPortNo = int.Parse(this.txtRelayPortNo.Text); Ground.i.mouseActiveOutOfScreen = this.cbActivateOutOfScreen.Checked; } this.Close(); } catch (Exception ex) { FailedOperation.caught(ex); } }
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; }
public IEnumerator TestFailedLoad() { PreInstall(); Container.BindAsync <GameObject>().FromMethod(async() => { FailedOperation failingOperation = new FailedOperation(); var customHandle = Addressables.ResourceManager.StartOperation(failingOperation, default(AsyncOperationHandle)); await customHandle.Task; if (customHandle.Status == AsyncOperationStatus.Failed) { throw new Exception("Async operation failed", customHandle.OperationException); } return(customHandle.Result); }).AsCached(); PostInstall(); yield return(new WaitForEndOfFrame()); LogAssert.ignoreFailingMessages = true; AsyncInject <GameObject> asyncGameObj = Container.Resolve <AsyncInject <GameObject> >(); LogAssert.ignoreFailingMessages = false; Assert.IsFalse(asyncGameObj.HasResult); Assert.IsTrue(asyncGameObj.IsCompleted); Assert.IsTrue(asyncGameObj.IsFaulted); }
private void btnFFmpegDir_Click(object sender, EventArgs e) { //FolderBrowserDialogクラスのインスタンスを作成 using (FolderBrowserDialog fbd = new FolderBrowserDialog()) { //上部に表示する説明テキストを指定する fbd.Description = "ffmpegのフォルダを指定して下さい。"; //ルートフォルダを指定する //デフォルトでDesktop fbd.RootFolder = Environment.SpecialFolder.MyComputer; //最初に選択するフォルダを指定する //RootFolder以下にあるフォルダである必要がある fbd.SelectedPath = txtFFmpegDir.Text; //ユーザーが新しいフォルダを作成できるようにする //デフォルトでTrue fbd.ShowNewFolderButton = false; //ダイアログを表示する if (fbd.ShowDialog(this) == DialogResult.OK) { //選択されたフォルダを表示する //Console.WriteLine(fbd.SelectedPath); try { string dir = fbd.SelectedPath; dir = FileTools.toFullPath(dir); { string sysRootDir = Environment.SystemDirectory[0] + ":\\"; if (StringTools.equalsIgnoreCase(dir, sysRootDir)) { throw new FailedOperation("システムドライブのルートフォルダは指定出来ません。"); } } if (FFmpeg.isFFmpegDir(dir) == false) { throw new FailedOperation("ffmpeg のパスではありません。"); } txtFFmpegDir.Text = dir; } catch (Exception ex) { FailedOperation.caught(ex); } } } }
private void 前を変更するRToolStripMenuItem_Click(object sender, EventArgs e) { int rowidx = getFirstSelectedRowIndex(); if (rowidx == -1) { return; } Ground.ServerInfo si = siSheetGetRow(rowidx); string valTitle = si.title; for (; ;) { if (InputStringDlg.perform( "新しい名前を入力して下さい。", ref valTitle, 1000 ) == false ) { break; } try { if (valTitle == "") { throw new FailedOperation("名前が入力されていません。"); } for (int rr = 0; rr < siSheet.RowCount; rr++) { if (rr != rowidx && valTitle == siSheetGetRow(rr).title) { throw new FailedOperation("名前が重複しています。"); } } // 変更を反映 si.title = valTitle; siSheetSetRow(rowidx, si); Utils.adjustColumnsWidth(siSheet); break; } catch (Exception ex) { FailedOperation.caught(ex); } } }
private void ファイルから読み込みRToolStripMenuItem_Click(object sender, EventArgs e) { this.mtEnabled = false; try { string initDir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); string initLFile = "きららプレイリスト.krrpl"; if (Gnd.i.lastPlayListFile != "") { initDir = Path.GetDirectoryName(Gnd.i.lastPlayListFile); initLFile = Path.GetFileName(Gnd.i.lastPlayListFile); } string plFile = SaveLoadDialogs.LoadFile("開くプレイリスト・ファイルを選択してください", "きららプレイリスト:krrpl", initDir, initLFile); if (plFile != null) { plFile = FileTools.toFullPath(plFile); Gnd.i.lastPlayListFile = plFile; List <MediaInfo> mis = new List <MediaInfo>(); foreach (string file in FileTools.readAllLines(plFile, Encoding.UTF8)) { if ( file != "" && file[0] != ';' ) { mis.Add(MediaInfo.create(file)); } } int startPos = plSheet.RowCount; plSheet.RowCount += mis.Count; for (int index = 0; index < mis.Count; index++) { plSheetSetRow(startPos + index, mis[index]); } } } catch (Exception ex) { FailedOperation.caught(ex); } finally { this.mtEnabled = true; } }
private void doResizeScreen(int w, int h) { this.mtEnabled = false; try { Gnd.i.client.doResizeScreen(w, h); } catch (Exception e) { FailedOperation.caught(e); } this.mtEnabled = true; }
/// <summary> /// ロードに失敗したら例外を投げる。 /// </summary> public FFmpeg() { try { tryInit(); } catch (Exception e) { FailedOperation.caught(e); chooseFFmpegDir(); tryInit(); } }
private void btnTestFieldsSerializer_Click(object sender, EventArgs e) { try { Ground.ServerInfo si = new Ground.ServerInfo(); string[] lines = FieldsSerializer.serialize(si); FieldsSerializer.deserialize(si, lines); } catch (Exception ex) { FailedOperation.caught(ex); } }
private void ファイルに保存AToolStripMenuItem_Click(object sender, EventArgs e) { this.mtEnabled = false; try { List <string> pl = new List <string>(); pl.Add("; きららプレイリスト"); pl.Add("; 空行と ; で始まる行は無視します。"); pl.Add("; エンコード = UTF-8"); for (int rowidx = 0; rowidx < plSheet.RowCount; rowidx++) { pl.Add(plSheetGetRow(rowidx).file); } string initDir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); string initLFile = "きららプレイリスト.krrpl"; if (Gnd.i.lastPlayListFile != "") { initDir = Path.GetDirectoryName(Gnd.i.lastPlayListFile); initLFile = Path.GetFileName(Gnd.i.lastPlayListFile); } string plFile = SaveLoadDialogs.SaveFile("プレイリストの保存先を選択してください", "きららプレイリスト:krrpl", initDir, initLFile); if (plFile != null) { plFile = FileTools.toFullPath(plFile); Gnd.i.lastPlayListFile = plFile; File.WriteAllLines(plFile, pl, Encoding.UTF8); MessageBox.Show( "プレイリストを保存しました。", "情報", MessageBoxButtons.OK, MessageBoxIcon.Information ); } } catch (Exception ex) { FailedOperation.caught(ex); } finally { this.mtEnabled = true; } }
private void btnImport_Click(object sender, EventArgs e) { try { string keyFile = SaveLoadDialogs.LoadFile( "鍵ファイルを選択してください", "鍵:unreal-remo-key", Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "default.unreal-remo-key" ); if (keyFile != null) { XNode root = XNode.load(keyFile); string ident = root.get("Ident").value; string key = root.get("Key").value; string hash = root.get("Hash").value; if (ident != JString.toJString(ident, false, false, false, false)) { throw new FailedOperation("鍵ファイルが壊れています。(Ident format)"); } if (ident.Length < 1 || 100 < ident.Length) // HACK: 上限適当 { throw new FailedOperation("鍵ファイルが壊れています。(Ident length)"); } if (StringTools.hex(key).Length != 64) { throw new FailedOperation("鍵ファイルが壊れています。(Key length)"); } if (hash != Ground.KeyData.getHash(key)) { throw new FailedOperation("鍵ファイルが壊れています。(Hash)"); } txtIdent.Text = ident; txtRaw.Text = key; txtHash.Text = hash; throw new Completed("鍵をインポートしました。"); } } catch (Exception ex) { FailedOperation.caught(ex); } }
private void connect(int rowidx) { try { Ground.ServerInfo si = siSheetGetRow(rowidx); Connection con = new Connection(si, 0); retCon = con; this.Close(); } catch (Exception ex) { FailedOperation.caught(ex); } }
private void 書き保存SToolStripMenuItem_Click(object sender, EventArgs e) { this.mtEnabled = false; try { confirmSaveFile(false, false, true); //saveFileOverwrite(); // 確認が無いのはマズいかなと.. } catch (Exception ex) { FailedOperation.caught(ex); } this.mtEnabled = true; }
private void btnConnect_Click(object sender, EventArgs e) { try { Ground.ServerInfo si = getServerInfo(true); Ground.i.lastConServerInfo = si; Connection con = new Connection(si, 0); retCon = con; this.Close(); } catch (Exception ex) { FailedOperation.caught(ex); } }
public void saveFile(string file) { try { BusyDlg.perform(delegate { doSave(file); }); _lastSavedFile = file; } catch (Exception e) { FailedOperation.caught(e); } }
private void btnOk_Click(object sender, EventArgs e) { try { if (txtIdent.Text == "") // ? 未入力 { throw new FailedOperation("鍵が生成されていません。"); } retKeyData = getKeyData(); this.Close(); } catch (Exception ex) { FailedOperation.caught(ex); } }
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 btnSave_Click(object sender, EventArgs e) { try { Ground.ServerInfo si = getServerInfo(); int rowidx = getRowIndexByTitle(si.title); if (rowidx == -1) { if (Ground.i.serverInfoCountMax <= siSheet.RowCount) { MessageBox.Show( "項目数の上限に達したため、これ以上追加できません。", "保存できません", MessageBoxButtons.OK, MessageBoxIcon.Warning ); return; } siSheet.RowCount++; siSheetSetRow(siSheet.RowCount - 1, si); } else { if (MessageBox.Show( "設定「" + si.title + "」を上書きします。\n宜しいですか?", "確認", MessageBoxButtons.YesNo, MessageBoxIcon.Warning ) != DialogResult.Yes ) { return; } siSheetSetRow(rowidx, si); } doSortSISheet(); Utils.adjustColumnsWidth(siSheet); } catch (Exception ex) { FailedOperation.caught(ex); } }
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 ファイルを開く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 static void main2(string[] args) { using (MutexObject mo = new MutexObject(APP_IDENT)) { if (mo.waitForMillis(0)) { try { main3(); } catch (Exception e) { FailedOperation.caught(e); } mo.release(); } } }
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; }
private void mainTimer_Tick(object sender, EventArgs e) { if (this.mtEnabled == false) { return; } this.mtEnabled = false; try { perform(); } catch (Exception ex) { FailedOperation.caught(ex); } this.Close(); }
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; }
private void モニタ選択MToolStripMenuItem_Click(object sender, EventArgs e) { if (Gnd.i.monitors.getCount() < 2) { this.mtEnabled = false; FailedOperation.caught(new FailedOperation("複数のモニタが必要です。")); this.mtEnabled = true; return; } Gnd.i.oc.add(delegate { Gnd.i.client.x = delegate { suspendWin(); using (SelectMonitorDlg f = new SelectMonitorDlg()) { f.ShowDialog(); if (f.okPressed) { Gnd.i.oc.add(delegate { if (this.WindowState != FormWindowState.Normal) { this.WindowState = FormWindowState.Normal; } this.Left = Gnd.i.retPlWin_l; this.Top = Gnd.i.retPlWin_t; this.Width = Gnd.i.retPlWin_w; this.Height = Gnd.i.retPlWin_h; }); } } resumeWin(); }; Gnd.i.client.sendLineEXP(); }); }
private void MainWin_Shown(object sender, EventArgs e) { new Thread((ThreadStart) delegate { Thread.Sleep(100); this.BeginInvoke((MethodInvoker) delegate { try { perform(); } catch (Exception ex) { FailedOperation.caught(ex); } postPerform(); this.Close(); }); }) .Start(); }
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 ここへ移動VToolStripMenuItem_Click(object sender, EventArgs e) { this.mtEnabled = false; try { int destRowidx = getFirstSelectedRowIndex(); if (destRowidx == -1) { throw new FailedOperation("移動先の項目を選択してね。"); } moveItems(destRowidx); } catch (Exception ex) { FailedOperation.caught(ex); } finally { this.mtEnabled = true; } }