Esempio n. 1
0
        private static bool SetConfigDirectoryPath()
        {
            string configDir;

            if (StartupOptions.TryGetValue("configDir", out configDir) && !string.IsNullOrEmpty(configDir))
            {
                // 起動オプション /configDir で設定ファイルの参照先を変更できます
                if (!Directory.Exists(configDir))
                {
                    var text = string.Format(Properties.Resources.ConfigDirectoryNotExist, configDir);
                    MessageBox.Show(text, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }

                MyCommon.settingPath = Path.GetFullPath(configDir);
            }
            else
            {
                if (File.Exists(Path.Combine(Application.StartupPath, "roaming")))
                {
                    MyCommon.settingPath = MySpecialPath.UserAppDataPath();
                }
                else
                {
                    MyCommon.settingPath = Application.StartupPath;
                }
            }

            return(true);
        }
Esempio n. 2
0
 private static void CheckSettingFilePath()
 {
     if (File.Exists(Path.Combine(Application.StartupPath, "roaming")))
     {
         MyCommon.settingPath = MySpecialPath.UserAppDataPath();
     }
     else
     {
         MyCommon.settingPath = Application.StartupPath;
     }
 }