예제 #1
0
        private void SetupStreams()
        {
            closeAllStreams();

            mStdioConsole = mIhost.GetStandardConsole("stdin/stdout/stderr");

            ARMPluginInterfaces.Preferences.IGeneralPreferences prefs = mIhost.ARMPreferences.IGeneralPreferences;
            IARMSimArguments args = mIhost.ARMSimArguments;

            ARMSimStream armSimStream = CreateInputStream(args.StdinFileName);

            if (armSimStream == null)
            {
                armSimStream = CreateInputStream(prefs.StdinFileName);
            }
            if (armSimStream == null)
            {
                armSimStream = new ARMSimConsoleStream(mStdioConsole, mIhost);
            }

            mFiles.Add(armSimStream);  // index = 0

            bool   overwrite = true;
            string filename  = null;

            if (args.StdoutFileName != null)
            {
                overwrite = true;
                filename  = args.StdoutFileName;
            }
            else if (args.StdoutAppendMode != null)
            {
                overwrite = false;
                filename  = args.StdoutAppendMode;
            }
            armSimStream = CreateOutputStream(filename, overwrite);
            if (armSimStream == null)
            {
                armSimStream = CreateOutputStream(prefs.StdoutFileName, prefs.StdoutOverwrite);
            }
            if (armSimStream == null)
            {
                armSimStream = new ARMSimConsoleStream(mStdioConsole, mIhost);
            }

            mFiles.Add(armSimStream);  // index = 1

            if (args.StderrFileName != null)
            {
                overwrite = true;
                filename  = args.StderrFileName;
            }
            else if (args.StderrAppendMode != null)
            {
                overwrite = false;
                filename  = args.StderrAppendMode;
            }
            armSimStream = CreateOutputStream(filename, overwrite);
            if (armSimStream == null)
            {
                armSimStream = CreateOutputStream(prefs.StderrFileName, prefs.StderrOverwrite);
            }
            if (armSimStream == null)
            {
                armSimStream = new ARMSimConsoleStream(mStdioConsole, mIhost);
            }

            mFiles.Add(armSimStream);  // index = 2
            mNextFileHandle = 3;
        }//SetupStreams