I'm using SSH.NET to create my terminal application for UWP.
For now, I've been able to send/receive data with the library, but I would like to do something like the PuTTY application, that shows the text with different colors, or even being able to edit files with the Linux vi editor.
Is there a way to get color / position information with this library?
When implementing a terminal emulation, you primarily have to process ANSI escape codes sent by the server.
There's no support for that in SSH.NET or .NET Framework.
Implementing it on your own is a huge task. PuTTY implementation of the terminal emulation, terminal.c, has almost 8000 lines of code. And that's only a processing part, a drawing is separate.
Quick google search for "c# terminal emulation" results in:
https://github.com/munificent/malison-dotnet
(though I have no experience with this library)
The only part of this on SSH.NET side, is to request terminal emulation by using an overload of SshClient.CreateShell that takes terminalName argument (and its companions).
Related
I know the title sounds a little weird, but I'm wondering if there is a good way to pass a string value in python to a string value in c#?
I have a neural-network that I am using in python to detect objects in an image. For each object that is detected, it also gets an identifier of what the neural-network thinks it detected which is stored in a string. I also have a C# application that I am creating, that runs my Python script through a bat file. What I want to do is get the string identifier from my Python script so I can use it as a string in my C# application. I've though about using a txt file where I would output the string from my Python script and have my C# application read the txt back. Is there any better ways to achieve this out there?
You can pass your string as a command line argument to the .net program (e.g. myprog.exe)
Then read it out with Environment.GetCommandLineArguments
https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/main-and-command-args/
if you need to do communication back and forth the easiest way to achieve that is by using a TCP/UDP client/server. The are available in c# and python. There are other mechanisms like named pipes on windows but tcp is the easiest.
This actually has a good sample you could use, but google around;
Send Data from [Python Client] to [C# Server] using Socket
This is called inter process communication btw, which is a great google term.
Also see:
What is the simplest method of inter-process communication between 2 C# processes?
I'm using SSH.NET to create my terminal application for UWP.
For now, I've been able to send/receive data with the library, but I would like to do something like the PuTTY application, that shows the text with different colors, or even being able to edit files with the Linux vi editor.
Is there a way to get color / position information with this library?
When implementing a terminal emulation, you primarily have to process ANSI escape codes sent by the server.
There's no support for that in SSH.NET or .NET Framework.
Implementing it on your own is a huge task. PuTTY implementation of the terminal emulation, terminal.c, has almost 8000 lines of code. And that's only a processing part, a drawing is separate.
Quick google search for "c# terminal emulation" results in:
https://github.com/munificent/malison-dotnet
(though I have no experience with this library)
The only part of this on SSH.NET side, is to request terminal emulation by using an overload of SshClient.CreateShell that takes terminalName argument (and its companions).
I realize I asked a question similar to this before, but the planning on what I want to do has come some way, and the parameters have become a bit different.
Basically, I'm looking for the best option for decoding and outputting audio on both Mac and Windows. Ideally, there will be no differences in needed code between the two platforms. I just want to be able to pass it a file path or HTTP URL and have it play the audio with the ability to pause, seek, etc.
It must be able to decode MP3 and AAC out of the box with no dependencies on the OS (like Phonon for Qt which is entirely dependent on the OS). Any other codecs beyond that would be a very nice bonus.
I've looked at things like libavcodec, which supposedly can decode about anything, but haven't been able to figure out how to get it to work. So far it seems that libraries I've seen are also ready for Mac and Linux or Windows and Linux but not Mac and Windows.
It does not need to be open source, but if it is needs to be usable in commercial products. I'm OK with licensing something as long as it's not too expensive and easy to use.
Finally, while C/C++ would be preferred, if there's something that would work with C#/Mono, that's OK too.
Any suggestions on something that would work for this?
I've created a C++ audio library for Mac and Windows named "Crosstalk".
Crosstalk is a C++ audio engine that allows you to create and route audio systems in real-time. The engine takes care of all the audio routing and gives you a simple platform for creating system components (E.g. "Mp3 Decoder" component connected to a "Low-Pass Filter" connected to an "Audio Device" and "File Recorder").
It's very easy to use. Here's an example of how to play an mp3 file (These components are provided with the engine):
XtSystem system;
XtMp3Decoder mp3Decoder;
XtAudioDevice audioDevice;
long md = system.addComponent(&mp3Decoder);
long ad = system.addComponent(&audioDevice);
system.connOutToIn(md,0,ad,0);
system.connOutToIn(md,1,ad,1);
mp3Decoder.loadFile("../05 Tchaikovski-Swan Lake-Scene.mp3");
mp3Decoder.play();
Included with Crosstalk is example Xcode and Visual Studio projects.
You can download Crosstalk and check out the API documentation and licensing details here: http://www.adaptaudio.com/Crosstalk
EDIT (01-12-2012):
Crosstalk has been replaced by an open-source project called "DSPatch". DSPatch is essentially an upgraded version of the routing engine behind Crosstalk that is no longer limited to only audio processing. DSPatch allows you to create and route almost any type of process chain imaginable, and free for personal AND proprietary use :)
decode MP3 and AAC out of the box
I'm not aware of any audio library that does this so easilly. The problem is the license issue regarding MP3 decoding.
I discuss some options on this post, and they are good for Windows/Mac OS X, but I'm not sure if they have C# bindings.
If you are willing to write the bindings yourself, you might be interested at libaudiodecoder:
A C++ cross platform MP3/AAC/WMA/WAV decoder.
It comes with an example that shows how to play a song on Windows/Mac through PortAudio.
I wrote an application a while ago in C# NET that basically allows the .exe I created to start/stop when the java application (Minecraft) starts and stops.
I would like to extend some more functionality to my application by basically allowing users to type commands into my console app, and in turn send these commands to the .jar file that is running.
I read something a while ago on stackoverflow that said there were some APIs that would basically let you manage Java apps inside of a C# NET app but I can't find it now.
Does anyone know how I could go about doing this?
If you launch and manage the java app from C# using the Process class, you can send input from your C# app to the launched java app process via Process.StandardInput.
Minecraft accepts commands from system in and responds to system out.
When you start minecraft from your application you basicly creates a new process. This process has two streams, one for system out and one for system in. You need to get hold of those streams. If you send characters to the system in stream, then they will be interpreted as commands to minecraft. If you read from the system out stream then you will get minecrafts response.
Your next task would be to let your users send commands to minecraft. One way to do this would be to let your users type in commands on a web page that you store in a file. You could have a separate thread read from the file and write the commands to minecraft's system in stream.
I need to Read files form Linux , copy them into the another computer(Windows operation) and even delete file in Linux. but I want do this with .net program.!!!
these file have a specific location.
I need code sample or article for doing that.
As stated before, there are several ways to do this:
Set up a samba share on the linux box, that lets you access the files from your windows box with your .NET programm. Beware of not to expose private files to the net (like /etc or /var). Additionaly do not expose actively used files since it will cause unexpected behaviour if your deamon tries to access a file, that your programm works on. Just access exported, passive data files over the net.
Use libraries for SSH with your programm to access the files on the linux box programmatically.
Set up a cron job on the linux box, that copies the files regularly to a share on your windows box to be processed over there.
Set up a deamon in mono/.NET that runs on the linux box and passes the files over an API to your windows client .NET app.
Write the whole programm in mono/.NET and let it compute on the linux box.
Just some approaches to a solution, just pick one that suits you.
There are plenty of ways to do this, most of which have nothing to do with writing code. The most obvious is to share the Linux files with the Windows machine using Samba.
Use something that speaks a useful file transfer protocol.