私はコーディングに不慣れです-だから私に耐えてください。私はたくさんの読書をしました、そしてこれを理解することができません。
したがって、新しいアプリを実行するときは、フォルダー名を入力します。アプリはそのフォルダーに移動し、この指定されたフォルダーにある2つの異なるログファイルをスキャンします。しかし、ここで私は困っています。ログが存在しない場合-探しているファイルを作成するかどうかを尋ねられます...私はそれをしたくありません。フォルダに移動したいのですが、ファイルが存在しない場合は何もせずに次のコード行に進みます。
これが私がこれまでに持っているコードです:
private void btnGo_Click(object sender, EventArgs e)
{
//get node id from user and build path to logs
string nodeID = txtNodeID.Text;
string serverPath = @"\\Jhexas02.phiext.com\rwdata\node\";
string fullPath = serverPath + nodeID;
string dbtoolPath = fullPath + "\\DBTool_2013.log";
string msgErrorPath = fullPath + "\\MsgError.log";
//check if logs exist
if (File.Exists(dbtoolPath) == true)
{
System.Diagnostics.Process.Start("notepad.exe", dbtoolPath);
}
{
MessageBox.Show("The 2013 DBTool log does not exist for this Node.");
}
アプリが表示されますThe 2013 DBTool log does not exist for this Node.
-次にメモ帳が開き、ファイルを作成するかどうかを尋ねられます。
Cannot find the \\Jhexas02.phiext.com\rwdata\node\R2379495\DBTool_2013.log file.
Do you want to create a new file?
新しいファイルを作成したくありません。これを回避するための良い方法はありますか?