Quantcast
Channel: Questions in topic: "pipe"
Viewing all articles
Browse latest Browse all 89

convert c# code for unity return errors

$
0
0
I try to run c# in unity but I got errors: - error CS0234: The type or namespace name `Pipes' does not exist in the namespace `System.IO'. Are you missing an assembly reference? - error CS0234: The type or namespace name `Unix' does not exist in the namespace `Mono'. Are you missing an assembly reference? How I can to convert the code to something that run on Unity? code: using System; using System.IO; using System.IO.Pipes; using System.Net; using System.Net.Sockets; using System.Xml; #if __MonoCS__ using Mono.Unix; #endif namespace Mumble { public class Mumble { protected NamedPipeClientStream pipe; protected StreamReader sr; protected StreamWriter sw; public Mumble() { #if __MonoCS__ Socket s = new Socket(AddressFamily.Unix, SocketType.Stream, 0); UnixEndPoint ue = new UnixEndPoint(Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + "/.MumbleSocket"); s.Connect(ue); NetworkStream pipe = new NetworkStream(s); #else pipe = new NamedPipeClientStream("Mumble"); pipe.Connect(); #endif sr = new StreamReader(pipe); sw = new StreamWriter(pipe); } private bool OutputStringReply() { String line; while ((line = sr.ReadLine()) != "") { Console.WriteLine(line); } return true; } private bool ReadReply() { bool reply; using (XmlReader xr = XmlReader.Create(sr)) { xr.MoveToContent(); xr.ReadToDescendant("succeeded"); reply = xr.ReadElementContentAsBoolean(); } return reply; } public bool Mute(bool state) { sw.WriteLine("", state); sw.Flush(); return ReadReply(); } public bool Deaf(bool state) { sw.WriteLine("", state); sw.Flush(); return ReadReply(); } public bool Focus() { sw.WriteLine(""); sw.Flush(); return ReadReply(); } public bool OpenUrl(String url) { Uri u; Uri.TryCreate(url, UriKind.Absolute, out u); sw.WriteLine("{0}", u); sw.Flush(); return ReadReply(); } public String QueryUrl() { sw.WriteLine(""); sw.Flush(); String reply; using (XmlReader xr = XmlReader.Create(sr)) { xr.MoveToContent(); xr.ReadToDescendant("href"); reply = xr.ReadString(); } return reply; } /* public static void Main(String[] args) { Mumble m = new Mumble(); m.Deaf(true); } */ } }

Viewing all articles
Browse latest Browse all 89

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>