ConfirmDownloadRule() public method

定義ファイルダウンロードを確認する
public ConfirmDownloadRule ( ) : bool
return bool
Example #1
0
        /// <summary>
        /// 全 CSV 変換ルールを読み出す
        /// </summary>
        /// <returns></returns>
        public bool LoadAllRules()
        {
            mRules.Clear();

            // ユーザ設定フォルダのほうから読み出す
            String path = getRulesPath();

            //String path = Path.GetDirectoryName(Application.ExecutablePath);

            string[] xmlFiles = Directory.GetFiles(path, "*.xml");
            if (xmlFiles.Length == 0)
            {
                // 定義ファイルがなければダウンロードさせる
                CsvRulesUpdater updater = new CsvRulesUpdater();
                if (!updater.ConfirmDownloadRule())
                {
                    // ダウンロード失敗 or ユーザキャンセル
                    return(false);
                }

                xmlFiles = Directory.GetFiles(path, "*.xml");
            }

            foreach (string xmlFile in xmlFiles)
            {
                try
                {
                    String version = LoadFromFile(xmlFile);
                    if (Path.GetFileName(xmlFile) == CSV_MASTER_RULE_FILENAME)
                    {
                        mMasterVersion = version;
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show(Properties.Resources.CsvRuleError + " in " + xmlFile, Properties.Resources.Error);
                }
            }
            return(true);
        }
Example #2
0
        /// <summary>
        /// 全 CSV 変換ルールを読み出す
        /// </summary>
        /// <returns></returns>
        public bool LoadAllRules()
        {
            mRules.Clear();

            // ユーザ設定フォルダのほうから読み出す
            String path = getRulesPath();
            //String path = Path.GetDirectoryName(Application.ExecutablePath);

            string[] xmlFiles = Directory.GetFiles(path, "*.xml");
            if (xmlFiles.Length == 0)
            {
                // 定義ファイルがなければダウンロードさせる
                CsvRulesUpdater updater = new CsvRulesUpdater();
                if (!updater.ConfirmDownloadRule())
                {
                    // ダウンロード失敗 or ユーザキャンセル
                    return false;
                }

                xmlFiles = Directory.GetFiles(path, "*.xml");
            }

            foreach (string xmlFile in xmlFiles)
            {
                try
                {
                    String version = LoadFromFile(xmlFile);
                    if (Path.GetFileName(xmlFile) == CSV_MASTER_RULE_FILENAME)
                    {
                        mMasterVersion = version;
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show(Properties.Resources.CsvRuleError + " in " + xmlFile, Properties.Resources.Error);
                }
            }
            return true;
        }