123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- using System.Collections.Generic;
- using System.Drawing;
- using System.IO;
- using System.Windows.Forms;
- using NTERA.EmuEra.Game.EraEmu.Config;
- namespace NTERA.EmuEra
- {
- public static class Program
- {
- /*
- コードの開始地点。
- ここでMainWindowを作り、
- MainWindowがProcessを作り、
- ProcessがGameBase・ConstantData・Variableを作る。
-
-
- *.ERBの読み込み、実行、その他の処理をProcessが、
- 入出力をMainWindowが、
- 定数の保存をConstantDataが、
- 変数の管理をVariableが行う。
-
- と言う予定だったが改変するうちに境界が曖昧になってしまった。
-
- 後にEmueraConsoleを追加し、それに入出力を担当させることに。
-
- 1750 DebugConsole追加
- Debugを全て切り離すことはできないので一部EmueraConsoleにも担当させる
-
- TODO: 1819 MainWindow & Consoleの入力・表示組とProcess&Dataのデータ処理組だけでも分離したい
- */
- /// <summary>
- /// アプリケーションのメイン エントリ ポイントです。
- /// </summary>
- public static void CMain(string exeDir)
- {
- ExeDir = exeDir;// Directory.GetCurrentDirectory();
- #if DEBUG
- //debugMode = true;
- #endif
- CsvDir = ExeDir + "csv\\";
- ErbDir = ExeDir + "erb\\";
- DebugDir = ExeDir + "debug\\";
- DatDir = ExeDir + "dat\\";
- ContentDir = ExeDir + "resources\\";
- //エラー出力用
- //1815 .exeが東方板のNGワードに引っかかるそうなので除去
- ExeName = "NTERA";
- //Application.EnableVisualStyles();
- //Application.SetCompatibleTextRenderingDefault(false);
- ConfigData.Instance.LoadConfig();
- //二重起動の禁止かつ二重起動
- //if ((!Config.AllowMultipleInstances) && (Sys.PrevInstance()))
- //{
- // MessageBox.Show("多重起動を許可する場合、emuera.configを書き換えて下さい", "既に起動しています");
- // return;
- //}
- if (!Directory.Exists(CsvDir))
- {
- MessageBox.Show("csvフォルダが見つかりません", "フォルダなし");
- return;
- }
- if (!Directory.Exists(ErbDir))
- {
- MessageBox.Show("erbフォルダが見つかりません", "フォルダなし");
- return;
- }
- // int argsStart = 0;
- // if ((args.Length > 0)&&(args[0].Equals("-DEBUG", StringComparison.CurrentCultureIgnoreCase)))
- // {
- // argsStart = 1;//デバッグモードかつ解析モード時に最初の1っこ(-DEBUG)を飛ばす
- // debugMode = true;
- // }
- //if(debugMode)
- //{
- // ConfigData.Instance.LoadDebugConfig();
- // if (!Directory.Exists(DebugDir))
- // {
- // try
- // {
- // Directory.CreateDirectory(DebugDir);
- // }
- // catch
- // {
- // MessageBox.Show("debugフォルダの作成に失敗しました", "フォルダなし");
- // return;
- // }
- // }
- //}
- // if (args.Length > argsStart)
- // {
- // AnalysisFiles = new List<string>();
- // for (int i = argsStart; i < args.Length; i++)
- // {
- // if (!File.Exists(args[i]) && !Directory.Exists(args[i]))
- // {
- // MessageBox.Show("与えられたファイル・フォルダは存在しません");
- // return;
- // }
- // if ((File.GetAttributes(args[i]) & FileAttributes.Directory) == FileAttributes.Directory)
- // {
- // List<KeyValuePair<string, string>> fnames = Config.GetFiles(args[i] + "\\", "*.ERB");
- // for (int j = 0; j < fnames.Count; j++)
- // {
- // AnalysisFiles.Add(fnames[j].Value);
- // }
- // }
- // else
- // {
- // if (Path.GetExtension(args[i]).ToUpper() != ".ERB")
- // {
- // MessageBox.Show("ドロップ可能なファイルはERBファイルのみです");
- // return;
- // }
- // AnalysisFiles.Add(args[i]);
- // }
- // }
- // AnalysisMode = true;
- // }
- }
- /// <summary>
- /// 実行ファイルのディレクトリ。最後に\を付けたstring
- /// </summary>
- public static string ExeDir { get; private set; }
- public static string CsvDir { get; private set; }
- public static string ErbDir { get; private set; }
- public static string DebugDir { get; private set; }
- public static string DatDir { get; private set; }
- public static string ContentDir { get; private set; }
- public static string ExeName { get; private set; }
- public static bool Reboot;
- //public static int RebootClientX = 0;
- public static int RebootClientY;
- public static FormWindowState RebootWinState = FormWindowState.Normal;
- public static Point RebootLocation;
- public static bool AnalysisMode;
- public static List<string> AnalysisFiles;
- public static bool debugMode;
- public static bool DebugMode => debugMode;
- public static uint StartTime { get; private set; }
- }
- }
|