I am developing wpf application. I am running the degrib.exe using the following code
public static void GenerateCsvFile(string fileName)
{
try
{
MessageBox.Show("Csv Error");
MessageBox.Show("File Name : " + fileName);
MessageBox.Show("WorkingDirectory" + new FileInfo(fileName).DirectoryName);
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = @"C:\ndfd\degrib\bin\degrib.exe";
startInfo.Arguments = @"" + fileName + "" + " -C -msg 1 -Csv";
startInfo.UseShellExecute = true;
startInfo.WorkingDirectory = new FileInfo(fileName).DirectoryName;
process.StartInfo = startInfo;
process.Start();
process.WaitForExit();
process.Close();
System.Diagnostics.Process process1 = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo1 = new System.Diagnostics.ProcessStartInfo();
startInfo1.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo1.FileName = @"C:\ndfd\degrib\bin\degrib.exe";
startInfo1.Arguments = @"" + fileName + "" + " -C -msg all -nMet -Csv";
startInfo1.UseShellExecute = true;
startInfo1.WorkingDirectory = new FileInfo(fileName).DirectoryName;
process1.StartInfo = startInfo1;
process1.Start();
process1.WaitForExit();
process1.Close();
}
catch (Exception ex)
{
MessageBox.Show("Degrib Error");
Utility.ShowErrorMessage(ex);
}
}
The degrib.exe produces the csv files from grib file. Here http://www.nws.noaa.gov/mdl/degrib/index.php
is the explanation of degrib. In the above function fileName
is the path of the grib file. The above function crates the csv file from grib file if the grib file is placed in any folder other than Program Files. The same function will not produce the csv file if I have placed the grib file in Program Files or any other folder in Program Files. The same function is also not working with AppData folder. Why this is happening ? Can you please provide me any solution for the above issue ?