private void onUpdateCsvRules(object sender, EventArgs e) { CsvRulesUpdater updater = new CsvRulesUpdater(); if (updater.CheckUpdate(true)) { mRules.LoadAllRules(); updateList(); } }
// コマンドライン処理 private void onLoad(object sender, EventArgs e) { string[] argv = System.Environment.GetCommandLineArgs(); if (argv.Length == 2) { string filepath = argv[1]; if (filepath.EndsWith(".agr") || filepath.EndsWith(".AGR")) { processAgrFile(filepath); } } else { // 通常起動時 : アップデート処理 new VersionUpdateChecker().CheckUpdate(); CsvRulesUpdater updater = new CsvRulesUpdater(); updater.CheckUpdate(); } }
/// <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); }
/// <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; }