private void 秒間フレーム数を設定するToolStripMenuItem_Click(object sender, EventArgs e) { this.BeforeDialog(); try { using (InputFPSDlg f = new InputFPSDlg()) { f.Prm_FPS = this.MS_GetRow(this.GetSelectedRow().Index).FPS; // 初期値として&行を選択しているか確認 f.ShowDialog(); if (f.OkPressed) { this.MS_SetFPS(f.Ret_FPS); } } } catch (Exception ex) { ProcMain.WriteLog(ex); MessageBox.Show(ex.Message, "映像用の秒間フレーム数の設定に失敗しました", MessageBoxButtons.OK, MessageBoxIcon.Warning); } this.AfterDialog(); }
public string Serialize() { return(AttachString.I.Untokenize(new string[] { this.Scenario.Name, this.CurrPageIndex.ToString(), AttachString.I.Untokenize(this.Surfaces.Select(v => { try { return AttachString.I.Untokenize(new string[] { v.TypeName, v.InstanceName, v.Serialize(), }); } catch { ProcMain.WriteLog(v.TypeName); ProcMain.WriteLog(v.InstanceName); throw; } } )), })); }
private void 像用の画像を設定するToolStripMenuItem_Click(object sender, EventArgs e) { this.BeforeDialog(); try { this.GetSelectedRow(); // 行を選択しているか確認 string file = SaveLoadDialogs.LoadFile( "映像用の画像を選択して下さい。", "", Environment.GetFolderPath(Environment.SpecialFolder.Desktop), Consts.IMAGE_INITIAL_FILE, dlg => dlg.Filter = Consts.IMAGE_FILTER ); if (file != null) { this.MS_SetImageFiles(new string[] { file }); } } catch (Exception ex) { ProcMain.WriteLog(ex); MessageBox.Show(ex.Message, "映像用の画像の設定に失敗しました", MessageBoxButtons.OK, MessageBoxIcon.Warning); } this.AfterDialog(); }
public void Test01() { for (int c = -20; c <= 20; c++) { ProcMain.WriteLog(c + " -> " + (c % 8)); } }
static void Main(string[] args) { ProcMain.CUIMain(new Program().Main2, APP_IDENT, APP_TITLE); //Console.WriteLine("Press ENTER."); //Console.ReadLine(); }
public void Test02() { foreach (string file in DDResource.GetFiles()) { ProcMain.WriteLog("resource file ==> " + file); } }
private void MainTimer_Tick(object sender, EventArgs e) { if (this.MTBusy.HasVisitor()) { return; } this.MTBusy.Enter(); try { // -- 3001 if (this.MTCount == 150) // 15 sec { this.CloseWindow(); return; } } catch (Exception ex) { ProcMain.WriteLog(ex); } finally { this.MTBusy.Leave(); this.MTCount++; } }
private void MainTimer_Tick(object sender, EventArgs e) { if (this.MTBusy.HasVisitor()) { return; } this.MTBusy.Enter(); try { // -- 3001 if (this.XPressed) { this.XPressed = false; this.CloseWindow(); return; } if (this.MTCount % 600 == 0) // per minute { GC.Collect(); } } catch (Exception ex) { ProcMain.WriteLog(ex); } finally { this.MTBusy.Leave(); this.MTCount++; } }
public string Serialize() { return(SCommon.Serializer.I.Join(new string[] { this.Scenario.Name, this.CurrPageIndex.ToString(), SCommon.Serializer.I.Join(this.Surfaces.Select(v => { try { return SCommon.Serializer.I.Join(new string[] { v.TypeName, v.InstanceName, v.Serialize(), }); } catch { ProcMain.WriteLog(v.TypeName); ProcMain.WriteLog(v.InstanceName); throw; } }) .ToArray()), })); }
private void Test01_a2(D2Size size, D4Rect rect, string destName, D4Rect dest) { ProcMain.WriteLog(string.Format("({0}) -> ({1}) {2} -> {3}" , string.Join(", ", size.W, size.H) , string.Join(", ", rect.L, rect.T, rect.W, rect.H) , destName , string.Join(", ", dest.L, dest.T, dest.W, dest.H) )); }
private void BtnOk_Click(object sender, EventArgs e) { try { string dir = this.SelectedDir.Text; dir = FileTools.MakeFullPath(dir); if (this.Dir無かったら作成する) { if (Directory.Exists(dir) == false) { if (MessageBox.Show( "指定されたフォルダは存在しません。\n作成して宜しいですか?", "確認", MessageBoxButtons.OKCancel, MessageBoxIcon.Question ) != DialogResult.OK ) { return; } FileTools.CreateDir(dir); } } else if (this.Dirじゃなくて読み込みファイル) { string file = dir; if (File.Exists(file) == false) { throw new Exception("指定されたファイルは存在しません。"); } } else { if (Directory.Exists(dir) == false) { throw new Exception("指定されたフォルダは存在しません。"); } } this.Dir = dir; this.OkPressed = true; this.Close(); } catch (Exception ex) { ProcMain.WriteLog(ex); MessageBox.Show(ex.Message, "Oops!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public void Main2() { try { Main3(); } catch (Exception e) { ProcMain.WriteLog(e); } }
private static void Run(string command) { command += " 1> stdout.tmp 2> stderr.tmp"; ProcMain.WriteLog("command: " + command); ProcessTools.Batch(new string[] { command }); ProcMain.WriteLog("stdout.tmp ----> " + File.ReadAllText("stdout.tmp", StringTools.ENCODING_SJIS) + " <---- ここまで"); ProcMain.WriteLog("stderr.tmp ----> " + File.ReadAllText("stderr.tmp", StringTools.ENCODING_SJIS) + " <---- ここまで"); }
public Config() { try { this.LoadFromFile(); } catch (Exception e) { ProcMain.WriteLog(e); } }
private void Slim() { long currDateTime = DateTimeToSec.Now.GetDateTime(); long expireDateTime = DateTimeToSec.ToDateTime(DateTimeToSec.ToSec(currDateTime) - Consts.SESSION_TIMEOUT_SEC); ProcMain.WriteLog("SessionBundle.Slim()"); ProcMain.WriteLog("現在日時 ⇒ " + currDateTime); ProcMain.WriteLog("期限切れ ⇒ " + expireDateTime); this.Sessions.RemoveAll(v => v.LastAccessedDateTime < expireDateTime); }
static void Main(string[] args) { ProcMain.CUIMain(new Program().Main2, APP_IDENT, APP_TITLE); #if DEBUG //if (ProcMain.CUIError) { Console.WriteLine("Press ENTER."); Console.ReadLine(); } #endif }
private IEnumerable <bool> フェードアウト() { foreach (DDScene scene in DDSceneUtils.Create(90)) { this.A = 1.0 - scene.Rate; this.Draw(); ProcMain.WriteLog("Smpl0001_フェードアウト_A: " + this.A); // test yield return(true); } }
/// <summary> /// 周辺テーブルを作成する。 /// </summary> /// <param name="x">指定座標(X-座標_ドット単位)</param> /// <param name="y">指定座標(Y-座標_ドット単位)</param> /// <param name="size">周辺テーブルの幅・高さ</param> public Around(int x, int y, int size) { I2Point pt = new I2Point(x, y); this.Size = size; this.Table = new MapCell[size, size]; // 周辺テーブルの左上へ移動 x -= (size - 1) * GameConsts.TILE_W / 2; y -= (size - 1) * GameConsts.TILE_H / 2; const int TMP_SPAN = 1000; // マップ座標(ドット単位) -> マップテーブル座標 x += GameConsts.TILE_W * TMP_SPAN; y += GameConsts.TILE_W * TMP_SPAN; x /= GameConsts.TILE_W; y /= GameConsts.TILE_H; x -= TMP_SPAN; y -= TMP_SPAN; for (int xc = 0; xc < size; xc++) { for (int yc = 0; yc < size; yc++) { this.Table[xc, yc] = Game.I.Map.GetCell(x + xc, y + yc); } } // マップテーブル座標 -> マップ座標(ドット単位) x += TMP_SPAN; y += TMP_SPAN; x *= GameConsts.TILE_W; y *= GameConsts.TILE_H; x -= GameConsts.TILE_W * TMP_SPAN; y -= GameConsts.TILE_W * TMP_SPAN; // 周辺テーブルの中心へ移動 x += size * GameConsts.TILE_W / 2; y += size * GameConsts.TILE_H / 2; this.CenterPoint = new I2Point(x, y); this.RelativePoint = new I2Point(pt.X - x, pt.Y - y); if (!SCommon.IsRange(this.RelativePoint.X, -16, 15)) { ProcMain.WriteLog("RP_X: " + this.RelativePoint.X); // test } if (!SCommon.IsRange(this.RelativePoint.Y, -16, 15)) { ProcMain.WriteLog("RP_Y: " + this.RelativePoint.Y); // test } }
public void LoadFromFile() { try { if (File.Exists(this.SaveFile) == false) { return; } string[] lines = File.ReadAllLines(this.SaveFile, Encoding.UTF8); int c = 0; if (int.Parse(lines[c++]) != lines.Length) { throw new Exception("Bad item number"); } // ---- Items ---- this.FFmpegDir = lines[c++]; this.OutputDir = lines[c++]; this.DefaultImageFile = lines[c++]; this.MainWin_Maximized = lines[c++] == Consts.S_TRUE; this.MainWin_L = int.Parse(lines[c++]); this.MainWin_T = int.Parse(lines[c++]); this.MainWin_W = int.Parse(lines[c++]); this.MainWin_H = int.Parse(lines[c++]); this.MS_AudioFile_FullPath = lines[c++] == Consts.S_TRUE; this.MS_ImageFile_FullPath = lines[c++] == Consts.S_TRUE; this.MS_MovieFile_FullPath = lines[c++] == Consts.S_TRUE; this.DefaultFPS = int.Parse(lines[c++]); this.AllowOverwrite = lines[c++] == Consts.S_TRUE; this.じ音楽ファイルを追加させない = lines[c++] == Consts.S_TRUE; this.XPressAndStopConverter = lines[c++] == Consts.S_TRUE; this.IgnoreBeginDot = lines[c++] == Consts.S_TRUE; this.画像を二重に表示 = lines[c++] == Consts.S_TRUE; this.画像を二重に表示_MonitorW = int.Parse(lines[c++]); this.画像を二重に表示_MonitorH = int.Parse(lines[c++]); this.画像を二重に表示_ぼかし = int.Parse(lines[c++]); this.画像を二重に表示_明るさ = int.Parse(lines[c++]); this.MasteringFlag = lines[c++] == Consts.S_TRUE; this.UseSameNameImageFile = lines[c++] == Consts.S_TRUE; // ---- } catch (Exception e) { ProcMain.WriteLog(e); //MessageBox.Show(e.Message, "データファイル読み込みエラー", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void MainWin_Load(object sender, EventArgs e) { { string logFile = Path.Combine(ProcMain.SelfDir, Path.GetFileNameWithoutExtension(ProcMain.SelfFile)) + ".log"; string logFile0 = logFile + "0"; File.Delete(logFile); File.Delete(logFile0); ProcMain.WriteLog = message => { try { using (new MSection("{67bbcf7a-ebe2-42a9-aeb2-54ee4bb40c67}")) // 念の為ロック { if (File.Exists(logFile) && Consts.LOG_FILE_SIZE_MAX < new FileInfo(logFile).Length) { File.Delete(logFile0); File.Move(logFile, logFile0); } using (StreamWriter writer = new StreamWriter(logFile, true, Encoding.UTF8)) { writer.WriteLine("[" + DateTime.Now + "] " + message); } } } catch { } }; } ExtraTools.AntiWindowsDefenderSmartScreen(); Ground.I.LoadFromFile(); if (Ground.I.Config.SettingToLog) { ProcMain.WriteLog("Setting: " + JsonTools.Encode(DebugTools.ToListOrMap(Ground.I))); // デバッグ用 } if (Ground.I.MainWin_Maximized) { this.WindowState = FormWindowState.Maximized; } else if (Ground.I.MainWin_W != -1) { this.Left = Ground.I.MainWin_L; this.Top = Ground.I.MainWin_T; this.Width = Ground.I.MainWin_W; this.Height = Ground.I.MainWin_H; } }
public ImageExtensions() { string file = Path.Combine(ProcMain.SelfDir, "image_extensions.txt"); if (File.Exists(file) == false) { file = @"..\..\..\..\doc\image_extensions.txt"; } this.Extensions = File.ReadAllLines(file, Encoding.ASCII); this.Extensions = this.Extensions.Where(v => v != "").Select(v => "." + v).ToArray(); // "bmp" -> ".bmp" ProcMain.WriteLog("画像ファイルの拡張子 ⇒ " + string.Join("\n", this.Extensions)); }
private void BtnOk_Click(object sender, EventArgs e) { try { this.SaveSetting(); this.Close(); } catch (Exception ex) { ProcMain.WriteLog(ex); //MessageBox.Show(ex.Message, "保存に失敗しました", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public void BeforeDL() { string targetFile = File.ReadAllLines(BeforeDLIntervent.TARGET_FILE)[0]; try { string query = BeforeDLInterventUtils.RecvFileToQuery(); if (1000 < query.Length) { throw new Exception("クエリが長すぎる。" + query.Length); } Dictionary <string, string> q = BeforeDLInterventUtils.ParseQuery(query); string localDir = JString.ToJString(CommonUtils.DecodeURL(q["group"]), true, false, false, true); string localFile = JString.ToJString(CommonUtils.DecodeURL(q["file"]), true, false, false, true); bool downloadFlag = q.ContainsKey("download"); ProcMain.WriteLog("localDir: [" + localDir + "]"); ProcMain.WriteLog("localFile: [" + localFile + "]"); ProcMain.WriteLog("downloadFlag: " + downloadFlag); string dir = Directory.GetDirectories(Consts.GROUP_BUNDLE_DIR).First(v => StringTools.CompIgnoreCase(Path.GetFileName(v), localDir) == 0 ); dir = Path.Combine(dir, Consts.FILE_BUNDLE_LOCAL_DIR); string file = Directory.GetFiles(dir).First(v => StringTools.CompIgnoreCase(Path.GetFileName(v), localFile) == 0 ); File.WriteAllText(BeforeDLIntervent.TARGET_FILE, file, StringTools.ENCODING_SJIS); if (downloadFlag) { File.WriteAllText(BeforeDLIntervent.TARGET_CONTENT_TYPE_FILE, "application/octet-stream", Encoding.ASCII); } } catch (Exception e) { ProcMain.WriteLog(e); string file = Path.Combine(Path.GetDirectoryName(targetFile), "dl-error.html"); File.WriteAllText(BeforeDLIntervent.TARGET_FILE, file, StringTools.ENCODING_SJIS); File.WriteAllBytes(BeforeDLIntervent.TARGET_CONTENT_TYPE_FILE, BinTools.EMPTY); } }
public static string GetBinDir(string ffmpegDir) { ProcMain.WriteLog("ffmpegDir: " + ffmpegDir); ffmpegDir = FileTools.MakeFullPath(ffmpegDir); if (Directory.Exists(ffmpegDir) == false) { throw new Exception("ffmpegフォルダが見つかりません。"); } string ffmpegBinDir = Directory.GetDirectories(ffmpegDir, "*", SearchOption.AllDirectories).First(subDir => IsBinDir(subDir)); ProcMain.WriteLog("ffmpegBinDir: " + ffmpegBinDir); return(ffmpegBinDir); }
private object DeleteFile() { this.LoggedIn(); Group group = this.LiteGroup.GetGroup(); string dir = Path.Combine(group.Dir, Consts.FILE_BUNDLE_LOCAL_DIR); string localFile = DenebolaToolkit.GetFairLocalPath(this.TPrm.StringValue, dir); string file = Path.Combine(dir, localFile); ProcMain.WriteLog("ファイル削除 ⇒ " + file); FileTools.Delete(file); return("OK"); }
protected override void Invoke_02(string command, params string[] arguments) { int c = 0; if (command == "Image") { this.Act.AddOnce(() => this.ImageFile = arguments[c++]); } else if (command == "A") { this.Act.AddOnce(() => this.A = double.Parse(arguments[c++])); } else if (command == "Zoom") { this.Act.AddOnce(() => this.Zoom = double.Parse(arguments[c++])); } else if (command == "待ち") { this.Act.Add(SCommon.Supplier(this.待ち(int.Parse(arguments[c++])))); } else if (command == "フェードイン") { this.Act.Add(SCommon.Supplier(this.フェードイン())); } else if (command == "フェードアウト") { this.Act.Add(SCommon.Supplier(this.フェードアウト())); } else if (command == "モード変更") { this.Act.Add(SCommon.Supplier(this.モード変更(arguments[c++]))); } else if (command == "スライド") { double x = double.Parse(arguments[c++]); double y = double.Parse(arguments[c++]); this.Act.Add(SCommon.Supplier(this.スライド(x, y))); } else { ProcMain.WriteLog(command); throw new DDError(); } }
public void Invoke() { try { if (this.Tokens[1] == "=") { string instanceName = this.Tokens[0]; string typeName = this.Tokens[2]; Novel.I.Status.Surfaces.RemoveAll(v => v.InstanceName == instanceName); Surface surface = SurfaceCreator.Create(typeName, instanceName); Novel.I.Status.Surfaces.Add(surface); } else { string instanceName = this.Tokens[0]; string command = this.Tokens[1]; string[] arguments = this.Tokens.Skip(2).ToArray(); Surface surface = Novel.I.Status.GetSurface(instanceName); surface.Invoke(command, arguments); } } catch (Exception ex) { ProcMain.WriteLog("コマンドの実行中にエラーが発生しました。エラーになったトークン列は以下のとおりです。"); foreach (string token in this.Tokens) { ProcMain.WriteLog(token); } if (DDConfig.LOG_ENABLED) { throw; } ProcMain.WriteLog("ゲームを続行します。" + ex); } }
private void EndMain() { Exception e = this.Ex; if (e == null) { try { ProcMain.WriteLog("コンバータのログ ----> " + File.ReadAllText(this.LogFile, Encoding.UTF8) + " <---- ここまで"); if (File.Exists(this.ErrorMessageFile)) { throw new Exception(File.ReadAllText(this.ErrorMessageFile, Encoding.UTF8).Trim()); } } catch (Exception ex) { e = ex; } } try { FileTools.Delete(this.WorkDir); } catch { } try { FileTools.Delete(this.ErrorMessageFile); } catch { } try { FileTools.Delete(this.LogFile); } catch { } if (e == null) { this.Info.Status = AudioInfo.Status_e.SUCCESSFUL; } else { ProcMain.WriteLog(e); this.Info.Status = AudioInfo.Status_e.ERROR; this.Info.ErrorMessage = e.Message; } }
private object CreateFile() { this.LoggedIn(); TrySlimdown(10); Group group = this.LiteGroup.GetGroup(); string dir = Path.Combine(group.Dir, Consts.FILE_BUNDLE_LOCAL_DIR); string localFile = DenebolaToolkit.GetFairLocalPath(this.TPrm.StringValue, dir); string file = Path.Combine(dir, localFile); ProcMain.WriteLog("ファイル作成.1 ⇒ " + file); file = Utilities.ToCreatableFairFullPath(file); ProcMain.WriteLog("ファイル作成.2 ⇒ " + file); File.WriteAllBytes(file, BinTools.EMPTY); return(Path.GetFileName(file)); }
public bool Mastering(string audioExt) { if (StringTools.EqualsIgnoreCase(audioExt, ".wav")) { Run("Master.exe audio.wav audio_m.wav Master-Report.tmp"); if (File.Exists("Master-Report.tmp") == false) // ? レポート未出力 -> audio.wav の読み込みに失敗したと判断する。 { Run("bin\\ffmpeg.exe -i audio.wav -ac 2 audio_s.wav"); // ステレオに変換する。 if (File.Exists("audio_s.wav") == false) { throw new Exception("音楽ファイルの変換に失敗しました。(audio.wav -> audio_s.wav)"); } Run("Master.exe audio_s.wav audio_m.wav Master-Report.tmp"); if (File.Exists("Master-Report.tmp") == false) // ? レポート未出力 { throw new Exception("音楽ファイルの読み込みに失敗しました。(audio_s.wav)_1"); } } } else { Run("bin\\ffmpeg.exe -i audio" + audioExt + " -ac 2 audio_s.wav"); // ステレオ .wav ファイルに変換する。 Run("Master.exe audio_s.wav audio_m.wav Master-Report.tmp"); if (File.Exists("Master-Report.tmp") == false) // ? レポート未出力 { throw new Exception("音楽ファイルの読み込みに失敗しました。(audio_s.wav)_2"); } } ProcMain.WriteLog("Master-Report: " + File.ReadAllText("Master-Report.tmp", StringTools.ENCODING_SJIS)); return(File.Exists("audio_m.wav")); }