I need to Encrypt the content of file by GnuPG encryption. for that, I am fetching content from FILE and passing it Process via StandardInput. For small data it is working fine but when I try to Write StandardInput of more than 500KB data, program gets stuck.
process = new Process();
process.StartInfo.WorkingDirectory = _bindirectory;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.FileName = gpgExecutable;
process.StartInfo.Arguments = gpgOptions;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
process.Start();
/*****Here is the line where Compiler Process Stucks on large data****/
process.StandardInput.Write(inputText);
process.StandardInput.Flush();
process.StandardInput.Close();
process.OutputDataReceived += process_OutputDataReceived;
process.ErrorDataReceived += process_ErrorDataReceived;
process.BeginErrorReadLine();
process.BeginOutputReadLine();
process.WaitForExit();
Please suggest a solution? Should i send data of file in chunks???