if (param.needSelect)\r
{\r
batchFilePath = form.invokeShellDialog();\r
- batchArgs = new string[0];\r
+ batchArgs = new string[0];\r
}\r
else\r
{\r
batchFilePath = param.BatchFilePath;\r
- batchArgs = param.BatchArguments; \r
+ batchArgs = param.BatchArguments; \r
}\r
\r
if (string.IsNullOrEmpty(batchFilePath))\r
string strCmd="";\r
try\r
{\r
- using (StreamReader sr = new StreamReader(\r
- batchFilePath, Encoding.GetEncoding("Shift_JIS")))\r
+ if (File.Exists(batchFilePath))\r
{\r
-\r
- while ((strCmd = sr.ReadLine()) != null)\r
+ using (StreamReader sr = new StreamReader(\r
+ batchFilePath, Encoding.GetEncoding("Shift_JIS")))\r
{\r
- for (int i = 0; i < batchArgs.Length; i++)\r
- {\r
- strCmd = strCmd.Replace("%" + (i + 1), batchArgs[i]);\r
- }\r
- if (strCmd.Contains('%'))\r
+\r
+ while ((strCmd = sr.ReadLine()) != null)\r
{\r
- return false;\r
- }\r
+ for (int i = 0; i < batchArgs.Length; i++)\r
+ {\r
+ strCmd = strCmd.Replace("%" + (i + 1), batchArgs[i]);\r
+ }\r
+ if (strCmd.Contains('%'))\r
+ {\r
+ message = "パラメータが設定されていないため、処理できません。";\r
+ return false;\r
+ }\r
\r
- form.cmdForBatch(strCmd);\r
+ form.cmdForBatch(strCmd);\r
+ }\r
}\r
}\r
+ else\r
+ {\r
+ message = "対象バッチファイルがありません。処理を中断します";\r
+ return true;\r
+ }\r
}\r
catch (Exception e)\r
{\r
\r
protected override string turnErrorMessage()\r
{\r
- return base.DefaultErrorMessage;\r
+ if (string.IsNullOrEmpty(message))\r
+ {\r
+ return base.DefaultErrorMessage;\r
+ }\r
+ else\r
+ {\r
+ return message;\r
+ }\r
}\r
\r
protected override string turnSplitErrorMessage()\r