Esempio n. 1
0
        public TermInfoDriver(string term)
        {
#if DEBUG
            File.Delete("console.log");
            logger = new StreamWriter(File.OpenWrite("console.log"));
#endif
            this.term = term;

            if (term == "xterm")
            {
                reader  = new TermInfoReader(term, KnownTerminals.xterm);
                color16 = true;
            }
            else if (term == "linux")
            {
                reader  = new TermInfoReader(term, KnownTerminals.linux);
                color16 = true;
            }
            else
            {
                string filename = SearchTerminfo(term);
                if (filename != null)
                {
                    reader = new TermInfoReader(term, filename);
                }
            }

            if (reader == null)
            {
                reader = new TermInfoReader(term, KnownTerminals.ansi);
            }

            if (!(Console.stdout is CStreamWriter))
            {
                // Application set its own stdout, we need a reference to the real stdout
                stdout = new CStreamWriter(Console.OpenStandardOutput(0), Console.OutputEncoding);
                ((StreamWriter)stdout).AutoFlush = true;
            }
            else
            {
                stdout = (CStreamWriter)Console.stdout;
            }
        }
Esempio n. 2
0
		public TermInfoDriver (string term)
		{
#if DEBUG
			File.Delete ("console.log");
			logger = new StreamWriter (File.OpenWrite ("console.log"));
#endif
			this.term = term;

			string filename = SearchTerminfo (term);
			if (filename != null)
				reader = new TermInfoReader (term, filename);
			else {
				// fallbacks
				if (term == "xterm") {
					reader = new TermInfoReader (term, KnownTerminals.xterm);
				} else if (term == "linux") {
					reader = new TermInfoReader (term, KnownTerminals.linux);
				}
			}

			if (reader == null)
				reader = new TermInfoReader (term, KnownTerminals.ansi);

			if (!(Console.stdout is CStreamWriter)) {
				// Application set its own stdout, we need a reference to the real stdout
				stdout = new CStreamWriter (Console.OpenStandardOutput (0), Console.OutputEncoding, false);
				((StreamWriter) stdout).AutoFlush = true;
			} else {
				stdout = (CStreamWriter) Console.stdout;
			}
		}