private static void LoadConfigFiles(string dir, InitialAction act) { if (Win32.WaitForSingleObject(_globalMutex, 10000) != Win32.WAIT_OBJECT_0) { throw new Exception("Global mutex lock error"); } try { string optionfile = dir + "options.conf"; bool config_loaded = false; bool macro_loaded = false; TextReader reader = null; try { if (File.Exists(optionfile)) { reader = new StreamReader(File.Open(optionfile, FileMode.Open, FileAccess.Read), Encoding.Default); if (VerifyConfigHeader(reader)) { ConfigNode root = new ConfigNode("root", reader).FindChildConfigNode("poderosa"); if (root != null) { _options.Load(root); config_loaded = true; _history.Load(root); _macroManager.Load(root); macro_loaded = true; } } } } catch (Exception ex) { //_errorOccurredOnBoot = true; Debug.WriteLine(ex.StackTrace); GUtil.WriteDebugLog(ex.StackTrace); act.AddMessage("Failed to read the configuration file.\n" + ex.Message); } finally { if (!config_loaded) { _options.Init(); } if (!macro_loaded) { _macroManager.SetDefault(); } if (reader != null) { reader.Close(); } } GEnv.Options = _options; //これでDefaultRenderProfileが初期化される string kh = dir + "ssh_known_hosts"; if (File.Exists(kh)) { try { _sshKnownHosts.Load(kh); } catch (Exception ex) { _sshKnownHosts.Clear(); act.AddMessage("Failed to read the 'ssh_known_hosts' file.\n" + ex.Message); } } } finally { Win32.ReleaseMutex(_globalMutex); } }