GitCommands.GitCommands.GetFileStream C# (CSharp) Method

GetFileStream() public static method

public static GetFileStream ( string id ) : Stream
id string
return Stream
        public static Stream GetFileStream(string id)
        {
            try
            {
                var newStream = new MemoryStream();

                SetEnvironmentVariable();

                Settings.GitLog.Log(Settings.GitCommand + " " + "cat-file blob \"" + id + "\"");
                //process used to execute external commands

                var process =
                    new Process
                        {
                            StartInfo =
                                {
                                    UseShellExecute = false,
                                    ErrorDialog = false,
                                    RedirectStandardOutput = true,
                                    RedirectStandardInput = false,
                                    RedirectStandardError = false,
                                    CreateNoWindow = true,
                                    FileName = "\"" + Settings.GitCommand + "\"",
                                    Arguments = "cat-file blob \"" + id + "\"",
                                    WorkingDirectory = Settings.WorkingDir,
                                    WindowStyle = ProcessWindowStyle.Normal,
                                    LoadUserProfile = true
                                }
                        };

                process.Start();

                StreamCopy(process.StandardOutput.BaseStream, newStream);
                newStream.Position = 0;

                process.WaitForExit();

                return newStream;
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
            }

            return null;
        }
GitCommands