On Tue, 2004-08-31 at 16:45, Jonathan Stowe wrote: > On Mon, 2004-08-30 at 04:06, Ian MacLean wrote: > > > > > >Anyway how can I do this on linux, or better yet, platform independant. > > > > > > > > > > > I think you'll probably need to P/Invoke to ncurses to do this on *nix > > > > Portable.NET has a curses binding already, though I've not tried to use > this with mono, however it shouldn't be too difficult to use the same > approach as used in, say, the Perl module Term::Cap and just read the > appropriate terminal description and output the appropriate strings for > the different capabilities. If I get bored I'll have a look at this. >
I have the start of a terminal capabilities library implementation at: http://www.integration-house.com/files/Unix.Console.TermCap.tar.gz it is very unfinished but in the spirit of "release early, release often" here it is. It will read the /etc/termcap of a Unix-like machine and parse out the capabilities, currently it doesn't deal with capabilities that take positional parameters (like cursor movements) but it does deal nicely with stuff like 'cl' (Clear Screen), 'ho' (home cursor), 'so' (start standout mode) and so forth. There are properties for some of these capabilities. Typical usage to clear the screen for instance might be: using System; using Unix.Console; public class Foo { public static void Main() { TermCap tc = new TermCap(); Console.Write(tc.Clear); /* Or generically: Console.WriteLine(tc.Put("cl"); */ } } I think there probably will be some issues with character encodings and the like on some terminals and I would be happy to accept any suggestions how to overcome this. Flames, patches, suggestions and offers of help greatly accepted. Hope it is useful. /J\ _______________________________________________ Mono-list maillist - [EMAIL PROTECTED] http://lists.ximian.com/mailman/listinfo/mono-list
