Config.cs 27 KB

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