Config.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.IO;
  5. using System.Text;
  6. using System.Windows.Forms;
  7. using NTERA.EmuEra.Game.EraEmu._Library;
  8. namespace NTERA.EmuEra.Game.EraEmu.Config
  9. {
  10. internal static class Config
  11. {
  12. #region config
  13. public static Encoding Encode = Encoding.GetEncoding("SHIFT-JIS");
  14. public static Encoding SaveEncode = Encoding.GetEncoding("SHIFT-JIS");
  15. private static Dictionary<ConfigCode, string> _nameDic;
  16. public static string GetConfigName(ConfigCode code)
  17. {
  18. return _nameDic[code];
  19. }
  20. public static void SetConfig(ConfigData instance)
  21. {
  22. _nameDic = instance.GetConfigNameDic();
  23. IgnoreCase = instance.GetConfigValue<bool>(ConfigCode.IgnoreCase);
  24. CompatiFunctionNoignoreCase = instance.GetConfigValue<bool>(ConfigCode.CompatiFunctionNoignoreCase);
  25. ICFunction = IgnoreCase && !CompatiFunctionNoignoreCase;
  26. ICVariable = IgnoreCase;
  27. if (IgnoreCase)
  28. {
  29. if (CompatiFunctionNoignoreCase)
  30. SCFunction = StringComparison.Ordinal;
  31. else
  32. SCFunction = StringComparison.OrdinalIgnoreCase;
  33. SCVariable = StringComparison.OrdinalIgnoreCase;
  34. }
  35. else
  36. {
  37. SCFunction = StringComparison.Ordinal;
  38. SCVariable = StringComparison.Ordinal;
  39. }
  40. UseRenameFile = instance.GetConfigValue<bool>(ConfigCode.UseRenameFile);
  41. UseReplaceFile = instance.GetConfigValue<bool>(ConfigCode.UseReplaceFile);
  42. UseMouse = instance.GetConfigValue<bool>(ConfigCode.UseMouse);
  43. UseMenu = instance.GetConfigValue<bool>(ConfigCode.UseMenu);
  44. UseDebugCommand = instance.GetConfigValue<bool>(ConfigCode.UseDebugCommand);
  45. AllowMultipleInstances = instance.GetConfigValue<bool>(ConfigCode.AllowMultipleInstances);
  46. AutoSave = instance.GetConfigValue<bool>(ConfigCode.AutoSave);
  47. UseKeyMacro = instance.GetConfigValue<bool>(ConfigCode.UseKeyMacro);
  48. SizableWindow = instance.GetConfigValue<bool>(ConfigCode.SizableWindow);
  49. //UseImageBuffer = instance.GetConfigValue<bool>(ConfigCode.UseImageBuffer);
  50. TextDrawingMode = instance.GetConfigValue<TextDrawingMode>(ConfigCode.TextDrawingMode);
  51. WindowX = instance.GetConfigValue<int>(ConfigCode.WindowX);
  52. WindowY = instance.GetConfigValue<int>(ConfigCode.WindowY);
  53. WindowPosX = instance.GetConfigValue<int>(ConfigCode.WindowPosX);
  54. WindowPosY = instance.GetConfigValue<int>(ConfigCode.WindowPosY);
  55. SetWindowPos = instance.GetConfigValue<bool>(ConfigCode.SetWindowPos);
  56. MaxLog = instance.GetConfigValue<int>(ConfigCode.MaxLog);
  57. PrintCPerLine = instance.GetConfigValue<int>(ConfigCode.PrintCPerLine);
  58. PrintCLength = instance.GetConfigValue<int>(ConfigCode.PrintCLength);
  59. ForeColor = instance.GetConfigValue<Color>(ConfigCode.ForeColor);
  60. BackColor = instance.GetConfigValue<Color>(ConfigCode.BackColor);
  61. FocusColor = instance.GetConfigValue<Color>(ConfigCode.FocusColor);
  62. LogColor = instance.GetConfigValue<Color>(ConfigCode.LogColor);
  63. FontSize = instance.GetConfigValue<int>(ConfigCode.FontSize);
  64. FontName = instance.GetConfigValue<string>(ConfigCode.FontName);
  65. LineHeight = instance.GetConfigValue<int>(ConfigCode.LineHeight);
  66. FPS = instance.GetConfigValue<int>(ConfigCode.FPS);
  67. //SkipFrame = instance.GetConfigValue<int>(ConfigCode.SkipFrame);
  68. ScrollHeight = instance.GetConfigValue<int>(ConfigCode.ScrollHeight);
  69. InfiniteLoopAlertTime = instance.GetConfigValue<int>(ConfigCode.InfiniteLoopAlertTime);
  70. SaveDataNos = instance.GetConfigValue<int>(ConfigCode.SaveDataNos);
  71. WarnBackCompatibility = instance.GetConfigValue<bool>(ConfigCode.WarnBackCompatibility);
  72. WindowMaximixed = instance.GetConfigValue<bool>(ConfigCode.WindowMaximixed);
  73. WarnNormalFunctionOverloading = instance.GetConfigValue<bool>(ConfigCode.WarnNormalFunctionOverloading);
  74. SearchSubdirectory = instance.GetConfigValue<bool>(ConfigCode.SearchSubdirectory);
  75. SortWithFilename = instance.GetConfigValue<bool>(ConfigCode.SortWithFilename);
  76. AllowFunctionOverloading = instance.GetConfigValue<bool>(ConfigCode.AllowFunctionOverloading);
  77. if (!AllowFunctionOverloading)
  78. WarnFunctionOverloading = true;
  79. else
  80. WarnFunctionOverloading = instance.GetConfigValue<bool>(ConfigCode.WarnFunctionOverloading);
  81. DisplayWarningLevel = instance.GetConfigValue<int>(ConfigCode.DisplayWarningLevel);
  82. DisplayReport = instance.GetConfigValue<bool>(ConfigCode.DisplayReport);
  83. ReduceArgumentOnLoad = instance.GetConfigValue<ReduceArgumentOnLoadFlag>(ConfigCode.ReduceArgumentOnLoad);
  84. IgnoreUncalledFunction = instance.GetConfigValue<bool>(ConfigCode.IgnoreUncalledFunction);
  85. FunctionNotFoundWarning = instance.GetConfigValue<DisplayWarningFlag>(ConfigCode.FunctionNotFoundWarning);
  86. FunctionNotCalledWarning = instance.GetConfigValue<DisplayWarningFlag>(ConfigCode.FunctionNotCalledWarning);
  87. ChangeMasterNameIfDebug = instance.GetConfigValue<bool>(ConfigCode.ChangeMasterNameIfDebug);
  88. LastKey = instance.GetConfigValue<long>(ConfigCode.LastKey);
  89. ButtonWrap = instance.GetConfigValue<bool>(ConfigCode.ButtonWrap);
  90. TextEditor = instance.GetConfigValue<string>(ConfigCode.TextEditor);
  91. EditorType = instance.GetConfigValue<TextEditorType>(ConfigCode.EditorType);
  92. EditorArg = instance.GetConfigValue<string>(ConfigCode.EditorArgument);
  93. CompatiErrorLine = instance.GetConfigValue<bool>(ConfigCode.CompatiErrorLine);
  94. CompatiCALLNAME = instance.GetConfigValue<bool>(ConfigCode.CompatiCALLNAME);
  95. UseSaveFolder = instance.GetConfigValue<bool>(ConfigCode.UseSaveFolder);
  96. CompatiRAND = instance.GetConfigValue<bool>(ConfigCode.CompatiRAND);
  97. //CompatiDRAWLINE = instance.GetConfigValue<bool>(ConfigCode.CompatiDRAWLINE);
  98. CompatiLinefeedAs1739 = instance.GetConfigValue<bool>(ConfigCode.CompatiLinefeedAs1739);
  99. SystemAllowFullSpace = instance.GetConfigValue<bool>(ConfigCode.SystemAllowFullSpace);
  100. SystemSaveInUTF8 = instance.GetConfigValue<bool>(ConfigCode.SystemSaveInUTF8);
  101. if (SystemSaveInUTF8)
  102. SaveEncode = Encoding.GetEncoding("UTF-8");
  103. SystemSaveInBinary = instance.GetConfigValue<bool>(ConfigCode.SystemSaveInBinary);
  104. SystemIgnoreTripleSymbol = instance.GetConfigValue<bool>(ConfigCode.SystemIgnoreTripleSymbol);
  105. CompatiFuncArgAutoConvert = instance.GetConfigValue<bool>(ConfigCode.CompatiFuncArgAutoConvert);
  106. CompatiFuncArgOptional = instance.GetConfigValue<bool>(ConfigCode.CompatiFuncArgOptional);
  107. CompatiCallEvent = instance.GetConfigValue<bool>(ConfigCode.CompatiCallEvent);
  108. CompatiSPChara = instance.GetConfigValue<bool>(ConfigCode.CompatiSPChara);
  109. AllowLongInputByMouse = instance.GetConfigValue<bool>(ConfigCode.AllowLongInputByMouse);
  110. TimesNotRigorousCalculation = instance.GetConfigValue<bool>(ConfigCode.TimesNotRigorousCalculation);
  111. //一文字変数の禁止オプションを考えた名残
  112. //ForbidOneCodeVariable = instance.GetConfigValue<bool>(ConfigCode.ForbidOneCodeVariable);
  113. SystemNoTarget = instance.GetConfigValue<bool>(ConfigCode.SystemNoTarget);
  114. CBUseClipboard = instance.GetConfigValue<bool>(ConfigCode.CBUseClipboard);
  115. CBIgnoreTags = instance.GetConfigValue<bool>(ConfigCode.CBIgnoreTags);
  116. CBReplaceTags = instance.GetConfigValue<string>(ConfigCode.CBReplaceTags);
  117. CBNewLinesOnly = instance.GetConfigValue<bool>(ConfigCode.CBNewLinesOnly);
  118. CBClearBuffer = instance.GetConfigValue<bool>(ConfigCode.CBClearBuffer);
  119. CBTriggerLeftClick = instance.GetConfigValue<bool>(ConfigCode.CBTriggerLeftClick);
  120. CBTriggerMiddleClick = instance.GetConfigValue<bool>(ConfigCode.CBTriggerMiddleClick);
  121. CBTriggerDoubleLeftClick = instance.GetConfigValue<bool>(ConfigCode.CBTriggerDoubleLeftClick);
  122. CBTriggerAnyKeyWait = instance.GetConfigValue<bool>(ConfigCode.CBTriggerAnyKeyWait);
  123. CBTriggerInputWait = instance.GetConfigValue<bool>(ConfigCode.CBTriggerInputWait);
  124. CBMaxCB = instance.GetConfigValue<int>(ConfigCode.CBMaxCB);
  125. CBBufferSize = instance.GetConfigValue<int>(ConfigCode.CBBufferSize);
  126. CBScrollCount = instance.GetConfigValue<int>(ConfigCode.CBScrollCount);
  127. CBMinTimer = instance.GetConfigValue<int>(ConfigCode.CBMinTimer);
  128. UseLanguage lang = instance.GetConfigValue<UseLanguage>(ConfigCode.useLanguage);
  129. switch (lang)
  130. {
  131. case UseLanguage.JAPANESE:
  132. Language = 0x0411; LangManager.setEncode(932); break;
  133. case UseLanguage.KOREAN:
  134. Language = 0x0412; LangManager.setEncode(949); break;
  135. case UseLanguage.CHINESE_HANS:
  136. Language = 0x0804; LangManager.setEncode(936); break;
  137. case UseLanguage.CHINESE_HANT:
  138. Language = 0x0404; LangManager.setEncode(950); break;
  139. }
  140. if (FontSize < 8)
  141. {
  142. MessageBox.Show("フォントサイズが小さすぎます(8が下限)", "設定のエラー");
  143. FontSize = 8;
  144. }
  145. if (LineHeight < FontSize)
  146. {
  147. MessageBox.Show("行の高さがフォントサイズより小さいため、フォントサイズと同じ高さと解釈されます", "設定のエラー");
  148. LineHeight = FontSize;
  149. }
  150. if (SaveDataNos < 20)
  151. {
  152. MessageBox.Show("表示するセーブデータ数が少なすぎます(20が下限)", "設定のエラー");
  153. SaveDataNos = 20;
  154. }
  155. if (SaveDataNos > 80)
  156. {
  157. MessageBox.Show("表示するセーブデータ数が多すぎます(80が上限)", "設定のエラー");
  158. SaveDataNos = 80;
  159. }
  160. if (MaxLog < 500)
  161. {
  162. MessageBox.Show("ログ表示行数が少なすぎます(500が下限)", "設定のエラー");
  163. MaxLog = 500;
  164. }
  165. DrawingParam_ShapePositionShift = 0;
  166. if (TextDrawingMode != TextDrawingMode.WINAPI)
  167. DrawingParam_ShapePositionShift = Math.Max(2, FontSize / 6);
  168. DrawableWidth = WindowX - DrawingParam_ShapePositionShift;
  169. if (UseSaveFolder)
  170. SavDir = Program.ExeDir + "sav\\";
  171. else
  172. SavDir = Program.ExeDir;
  173. if (UseSaveFolder && !Directory.Exists(SavDir))
  174. CreateSaveDirAndMoveFiles();
  175. }
  176. private static readonly Dictionary<string, Dictionary<FontStyle, Font>> FontDic = new Dictionary<string, Dictionary<FontStyle, Font>>();
  177. public static Font Font => GetFont(null, FontStyle.Regular);
  178. public static Font GetFont(string theFontname, FontStyle style)
  179. {
  180. string fn = theFontname;
  181. if (string.IsNullOrEmpty(theFontname))
  182. fn = FontName;
  183. if (!FontDic.ContainsKey(fn))
  184. FontDic.Add(fn, new Dictionary<FontStyle, Font>());
  185. var fontStyleDic = FontDic[fn];
  186. if (fontStyleDic.ContainsKey(style)) return fontStyleDic[style];
  187. var fontsize = FontSize;
  188. Font styledFont = null;
  189. try
  190. {
  191. styledFont = new Font(fn, fontsize, style, GraphicsUnit.Pixel);
  192. }
  193. catch
  194. {
  195. return null;
  196. }
  197. fontStyleDic.Add(style, styledFont);
  198. return fontStyleDic[style];
  199. }
  200. public static void ClearFont()
  201. {
  202. foreach (var fontStyleDicPair in FontDic)
  203. {
  204. foreach (var pair in fontStyleDicPair.Value)
  205. {
  206. pair.Value.Dispose();
  207. }
  208. fontStyleDicPair.Value.Clear();
  209. }
  210. FontDic.Clear();
  211. }
  212. /// <summary>
  213. /// ディレクトリ作成失敗のExceptionは呼び出し元で処理すること
  214. /// </summary>
  215. public static void CreateSavDir()
  216. {
  217. if (UseSaveFolder && !Directory.Exists(SavDir))
  218. {
  219. Directory.CreateDirectory(SavDir);
  220. }
  221. }
  222. private static void CreateSaveDirAndMoveFiles()
  223. {
  224. try
  225. {
  226. Directory.CreateDirectory(SavDir);
  227. }
  228. catch
  229. {
  230. MessageBox.Show("savフォルダの作成に失敗しました", "フォルダ作成失敗");
  231. return;
  232. }
  233. bool existGlobal = File.Exists(Program.ExeDir + "global.sav");
  234. string[] savFiles = Directory.GetFiles(Program.ExeDir, "save*.sav", SearchOption.TopDirectoryOnly);
  235. if (!existGlobal && savFiles.Length == 0)
  236. return;
  237. DialogResult result = MessageBox.Show("savフォルダを作成しました\n現在のデータをsavフォルダ内に移動しますか?", "データ移動", MessageBoxButtons.YesNo);
  238. if (result != DialogResult.Yes)
  239. return;
  240. //ダイアログが開いている間にフォルダを消してしまうような邪悪なユーザーがいるかもしれない
  241. if (!Directory.Exists(SavDir))
  242. {
  243. MessageBox.Show("savフォルダの作成が見当たりません", "フォルダ作成失敗");
  244. return;
  245. }
  246. //ダイアログが開いている間にファイルを変更するような邪悪なユーザーがいるかもしれない
  247. try
  248. {
  249. if (File.Exists(Program.ExeDir + "global.sav"))
  250. File.Move(Program.ExeDir + "global.sav", SavDir + "global.sav");
  251. savFiles = Directory.GetFiles(Program.ExeDir, "save*.sav", SearchOption.TopDirectoryOnly);
  252. foreach (string oldpath in savFiles)
  253. File.Move(oldpath, SavDir + Path.GetFileName(oldpath));
  254. }
  255. catch
  256. {
  257. MessageBox.Show("savファイルの移動に失敗しました", "移動失敗");
  258. }
  259. }
  260. //先にSetConfigを呼ぶこと
  261. //戻り値はセーブが必要かどうか
  262. public static bool CheckUpdate()
  263. {
  264. if (ReduceArgumentOnLoad != ReduceArgumentOnLoadFlag.ONCE)
  265. {
  266. switch (ReduceArgumentOnLoad)
  267. {
  268. case ReduceArgumentOnLoadFlag.YES:
  269. NeedReduceArgumentOnLoad = true;
  270. break;
  271. case ReduceArgumentOnLoadFlag.NO:
  272. NeedReduceArgumentOnLoad = false;
  273. break;
  274. case ReduceArgumentOnLoadFlag.ONCE:
  275. return false;
  276. default:
  277. throw new ArgumentOutOfRangeException();
  278. }
  279. return false;
  280. }
  281. var key = GetUpdateKey();
  282. var updated = LastKey != key;
  283. LastKey = key;
  284. return updated;
  285. }
  286. private static long GetUpdateKey()
  287. {
  288. var option = SearchOption.TopDirectoryOnly;
  289. if (SearchSubdirectory)
  290. option = SearchOption.AllDirectories;
  291. string[] erbFiles = Directory.GetFiles(Program.ErbDir, "*.ERB", option);
  292. string[] csvFiles = Directory.GetFiles(Program.CsvDir, "*.CSV", option);
  293. var writetimes = new long[erbFiles.Length + csvFiles.Length];
  294. for (int i = 0; i < erbFiles.Length; i++)
  295. if (Path.GetExtension(erbFiles[i]).Equals(".ERB", StringComparison.OrdinalIgnoreCase))
  296. writetimes[i] = File.GetLastWriteTime(erbFiles[i]).ToBinary();
  297. for (int i = 0; i < csvFiles.Length; i++)
  298. if (Path.GetExtension(csvFiles[i]).Equals(".CSV", StringComparison.OrdinalIgnoreCase))
  299. writetimes[i + erbFiles.Length] = File.GetLastWriteTime(csvFiles[i]).ToBinary();
  300. long key = 0;
  301. for (int i = 0; i < writetimes.Length; i++)
  302. {
  303. unchecked
  304. {
  305. key ^= writetimes[i] * 1103515245 + 12345;
  306. }
  307. }
  308. return key;
  309. }
  310. public static List<KeyValuePair<string, string>> GetFiles(string rootdir, string pattern)
  311. {
  312. return getFiles(rootdir, rootdir, pattern, !SearchSubdirectory, SortWithFilename);
  313. }
  314. private sealed class StrIgnoreCaseComparer : IComparer<string>
  315. {
  316. public int Compare(string x, string y)
  317. {
  318. return string.Compare(x, y, StringComparison.OrdinalIgnoreCase);
  319. }
  320. }
  321. private static readonly StrIgnoreCaseComparer IgnoreCaseComparer = new StrIgnoreCaseComparer();
  322. //KeyValuePair<相対パス, 完全パス>のリストを返す。
  323. private static List<KeyValuePair<string, string>> getFiles(string dir, string rootdir, string pattern, bool toponly, bool sort)
  324. {
  325. const StringComparison strComp = StringComparison.OrdinalIgnoreCase;
  326. List<KeyValuePair<string, string>> retList = new List<KeyValuePair<string, string>>();
  327. if (!toponly)
  328. {//サブフォルダ内の検索
  329. string[] dirList = Directory.GetDirectories(dir, "*", SearchOption.TopDirectoryOnly);
  330. if (dirList.Length > 0)
  331. {
  332. if (sort)
  333. Array.Sort(dirList, IgnoreCaseComparer);
  334. for (int i = 0; i < dirList.Length; i++)
  335. retList.AddRange(getFiles(dirList[i], rootdir, pattern, toponly, sort));
  336. }
  337. }
  338. string RelativePath;//相対ディレクトリ名
  339. if (string.Equals(dir, rootdir, strComp))//現在のパスが検索ルートパスに等しい
  340. RelativePath = "";
  341. else
  342. {
  343. if (!dir.StartsWith(rootdir, strComp))
  344. RelativePath = dir;
  345. else
  346. RelativePath = dir.Substring(rootdir.Length);//前方が検索ルートパスと一致するならその部分を切り取る
  347. if (!RelativePath.EndsWith("\\") && !RelativePath.EndsWith("/"))
  348. RelativePath += "\\";//末尾が\又は/で終わるように。後でFile名を直接加算できるようにしておく
  349. }
  350. //filepathsは完全パスである
  351. string[] filepaths = Directory.GetFiles(dir, pattern, SearchOption.TopDirectoryOnly);
  352. if (sort)
  353. {
  354. Array.Sort(filepaths, IgnoreCaseComparer);
  355. }
  356. for (int i = 0; i < filepaths.Length; i++)
  357. {
  358. if (Path.GetExtension(filepaths[i]).Length <= 4)//".erb"や".csv"であること。放置すると".erb*"等を拾う。
  359. {
  360. retList.Add(new KeyValuePair<string, string>(RelativePath + Path.GetFileName(filepaths[i]), filepaths[i]));
  361. }
  362. }
  363. return retList;
  364. }
  365. /// <summary>
  366. /// IgnoreCaseはprivateに。代わりにICFunctionかICVariableを使う。
  367. /// </summary>
  368. private static bool IgnoreCase { get; set; }
  369. private static bool CompatiFunctionNoignoreCase { get; set; }
  370. /// <summary>
  371. /// 関数名・属性名的な名前のIgnoreCaseフラグ
  372. /// 関数・属性・BEGINのキーワード
  373. /// どうせeramaker用の互換処理なのでEmuera専用構文については適当に。
  374. /// </summary>
  375. public static bool ICFunction { get; private set; }
  376. /// <summary>
  377. /// 変数名、命令名的な名前のIgnoreCaseフラグ
  378. /// 変数・命令・$ラベル名、GOTOの引数
  379. /// </summary>
  380. public static bool ICVariable { get; private set; }
  381. /// <summary>
  382. /// 関数名・属性名的な名前の比較フラグ
  383. /// </summary>
  384. public static StringComparison SCFunction { get; private set; }
  385. /// <summary>
  386. /// 変数名、命令名的な名前の比較フラグ
  387. /// </summary>
  388. public static StringComparison SCVariable { get; private set; }
  389. /// <summary>
  390. /// ファイル名的な名前の比較フラグ
  391. /// </summary>
  392. public const StringComparison SCIgnoreCase = StringComparison.OrdinalIgnoreCase;
  393. /// <summary>
  394. /// 式中での文字列比較フラグ
  395. /// </summary>
  396. public const StringComparison SCExpression = StringComparison.Ordinal;
  397. /// <summary>
  398. /// GDI+利用時に発生する文字列と図形・画像間の位置ずれ補正
  399. /// </summary>
  400. public static int DrawingParam_ShapePositionShift { get; private set; }
  401. public static bool UseRenameFile { get; private set; }
  402. public static bool UseReplaceFile { get; private set; }
  403. public static bool UseMouse { get; private set; }
  404. public static bool UseMenu { get; private set; }
  405. public static bool UseDebugCommand { get; private set; }
  406. public static bool AllowMultipleInstances { get; private set; }
  407. public static bool AutoSave { get; private set; }
  408. public static bool UseKeyMacro { get; private set; }
  409. public static bool SizableWindow { get; private set; }
  410. //public static bool UseImageBuffer { get; private set; }
  411. public static TextDrawingMode TextDrawingMode { get; private set; }
  412. public static int WindowX { get; private set; }
  413. /// <summary>
  414. /// 実際に描画可能な横幅
  415. /// </summary>
  416. public static int DrawableWidth { get; private set; }
  417. public static int WindowY { get; private set; }
  418. public static int WindowPosX { get; private set; }
  419. public static int WindowPosY { get; private set; }
  420. public static bool SetWindowPos { get; private set; }
  421. public static int MaxLog { get; private set; }
  422. public static int PrintCPerLine { get; private set; }
  423. public static int PrintCLength { get; private set; }
  424. public static Color ForeColor { get; private set; }
  425. public static Color BackColor { get; private set; }
  426. public static Color FocusColor { get; private set; }
  427. public static Color LogColor { get; private set; }
  428. public static int FontSize { get; private set; }
  429. public static string FontName { get; private set; }
  430. public static int LineHeight { get; private set; }
  431. public static int FPS { get; private set; }
  432. //public static int SkipFrame { get; private set; }
  433. public static int ScrollHeight { get; private set; }
  434. public static int InfiniteLoopAlertTime { get; private set; }
  435. public static int SaveDataNos { get; private set; }
  436. public static bool WarnBackCompatibility { get; private set; }
  437. public static bool WindowMaximixed { get; private set; }
  438. public static bool WarnNormalFunctionOverloading { get; private set; }
  439. public static bool SearchSubdirectory { get; private set; }
  440. public static bool SortWithFilename { get; private set; }
  441. public static bool AllowFunctionOverloading { get; private set; }
  442. public static bool WarnFunctionOverloading { get; private set; }
  443. public static int DisplayWarningLevel { get; private set; }
  444. public static bool DisplayReport { get; private set; }
  445. public static ReduceArgumentOnLoadFlag ReduceArgumentOnLoad { get; private set; }
  446. public static bool IgnoreUncalledFunction { get; private set; }
  447. public static DisplayWarningFlag FunctionNotFoundWarning { get; private set; }
  448. public static DisplayWarningFlag FunctionNotCalledWarning { get; private set; }
  449. public static bool ChangeMasterNameIfDebug { get; private set; }
  450. public static long LastKey { get; private set; }
  451. public static bool ButtonWrap { get; private set; }
  452. public static string TextEditor { get; private set; }
  453. public static TextEditorType EditorType { get; private set; }
  454. public static string EditorArg { get; private set; }
  455. public static bool CompatiErrorLine { get; private set; }
  456. public static bool CompatiCALLNAME { get; private set; }
  457. public static bool UseSaveFolder { get; private set; }
  458. public static bool CompatiRAND { get; private set; }
  459. //public static bool CompatiDRAWLINE { get; private set; }
  460. public static bool CompatiLinefeedAs1739 { get; private set; }
  461. public static bool SystemAllowFullSpace { get; private set; }
  462. public static bool SystemSaveInUTF8 { get; private set; }
  463. public static bool SystemSaveInBinary { get; private set; }
  464. public static bool CompatiFuncArgAutoConvert { get; private set; }
  465. public static bool CompatiFuncArgOptional { get; private set; }
  466. public static bool CompatiCallEvent { get; private set; }
  467. public static bool CompatiSPChara { get; private set; }
  468. public static bool SystemIgnoreTripleSymbol { get; private set; }
  469. public static bool SystemNoTarget { get; private set; }
  470. public static bool CBUseClipboard { get; private set; }
  471. public static bool CBIgnoreTags { get; private set; }
  472. public static string CBReplaceTags { get; private set; }
  473. public static bool CBNewLinesOnly { get; private set; }
  474. public static bool CBClearBuffer { get; private set; }
  475. public static bool CBTriggerLeftClick { get; private set; }
  476. public static bool CBTriggerMiddleClick { get; private set; }
  477. public static bool CBTriggerDoubleLeftClick { get; private set; }
  478. public static bool CBTriggerAnyKeyWait { get; private set; }
  479. public static bool CBTriggerInputWait { get; private set; }
  480. public static int CBMaxCB { get; private set; }
  481. public static int CBBufferSize { get; private set; }
  482. public static int CBScrollCount { get; private set; }
  483. public static int CBMinTimer { get; private set; }
  484. public static int Language { get; private set; }
  485. public static string SavDir { get; private set; }
  486. public static bool NeedReduceArgumentOnLoad { get; private set; }
  487. public static bool AllowLongInputByMouse { get; private set; }
  488. public static bool TimesNotRigorousCalculation { get; private set; }
  489. //一文字変数の禁止オプションを考えた名残
  490. //public static bool ForbidOneCodeVariable { get; private set; }
  491. #endregion
  492. #region debug
  493. public static void SetDebugConfig(ConfigData instance)
  494. {
  495. DebugShowWindow = instance.GetConfigValue<bool>(ConfigCode.DebugShowWindow);
  496. DebugWindowTopMost = instance.GetConfigValue<bool>(ConfigCode.DebugWindowTopMost);
  497. DebugWindowWidth = instance.GetConfigValue<int>(ConfigCode.DebugWindowWidth);
  498. DebugWindowHeight = instance.GetConfigValue<int>(ConfigCode.DebugWindowHeight);
  499. DebugSetWindowPos = instance.GetConfigValue<bool>(ConfigCode.DebugSetWindowPos);
  500. DebugWindowPosX = instance.GetConfigValue<int>(ConfigCode.DebugWindowPosX);
  501. DebugWindowPosY = instance.GetConfigValue<int>(ConfigCode.DebugWindowPosY);
  502. }
  503. public static bool DebugShowWindow { get; private set; }
  504. public static bool DebugWindowTopMost { get; private set; }
  505. public static int DebugWindowWidth { get; private set; }
  506. public static int DebugWindowHeight { get; private set; }
  507. public static bool DebugSetWindowPos { get; private set; }
  508. public static int DebugWindowPosX { get; private set; }
  509. public static int DebugWindowPosY { get; private set; }
  510. #endregion
  511. #region replace
  512. public static void SetReplace(ConfigData instance)
  513. {
  514. MoneyLabel = instance.GetConfigValue<string>(ConfigCode.MoneyLabel);
  515. MoneyFirst = instance.GetConfigValue<bool>(ConfigCode.MoneyFirst);
  516. LoadLabel = instance.GetConfigValue<string>(ConfigCode.LoadLabel);
  517. MaxShopItem = instance.GetConfigValue<int>(ConfigCode.MaxShopItem);
  518. DrawLineString = instance.GetConfigValue<string>(ConfigCode.DrawLineString);
  519. if (string.IsNullOrEmpty(DrawLineString))
  520. DrawLineString = "-";
  521. BarChar1 = instance.GetConfigValue<char>(ConfigCode.BarChar1);
  522. BarChar2 = instance.GetConfigValue<char>(ConfigCode.BarChar2);
  523. TitleMenuString0 = instance.GetConfigValue<string>(ConfigCode.TitleMenuString0);
  524. TitleMenuString1 = instance.GetConfigValue<string>(ConfigCode.TitleMenuString1);
  525. ComAbleDefault = instance.GetConfigValue<int>(ConfigCode.ComAbleDefault);
  526. StainDefault = instance.GetConfigValue<List<Int64>>(ConfigCode.StainDefault);
  527. TimeupLabel = instance.GetConfigValue<string>(ConfigCode.TimeupLabel);
  528. ExpLvDef = instance.GetConfigValue<List<Int64>>(ConfigCode.ExpLvDef);
  529. PalamLvDef = instance.GetConfigValue<List<Int64>>(ConfigCode.PalamLvDef);
  530. PbandDef = instance.GetConfigValue<Int64>(ConfigCode.pbandDef);
  531. RelationDef = instance.GetConfigValue<Int64>(ConfigCode.RelationDef);
  532. }
  533. public static string MoneyLabel { get; private set; }
  534. public static bool MoneyFirst { get; private set; }
  535. public static string LoadLabel { get; private set; }
  536. public static int MaxShopItem { get; private set; }
  537. public static string DrawLineString { get; private set; }
  538. public static char BarChar1 { get; private set; }
  539. public static char BarChar2 { get; private set; }
  540. public static string TitleMenuString0 { get; private set; }
  541. public static string TitleMenuString1 { get; private set; }
  542. public static int ComAbleDefault { get; private set; }
  543. public static List<Int64> StainDefault { get; private set; }
  544. public static string TimeupLabel { get; private set; }
  545. public static List<Int64> ExpLvDef { get; private set; }
  546. public static List<Int64> PalamLvDef { get; private set; }
  547. public static Int64 PbandDef { get; private set; }
  548. public static Int64 RelationDef { get; private set; }
  549. #endregion
  550. }
  551. }