public static AddressEntry Parse(string s) { AddressEntry entry = new AddressEntry(); string[] parts = s.Split(':'); if (parts.Length < 2) { throw new BadAddressException("No colon found"); } if (parts.Length > 2) { throw new BadAddressException("Too many colons found"); } entry.Method = parts[0]; foreach (string propStr in parts[1].Split(',')) { parts = propStr.Split('='); if (parts.Length < 2) { throw new BadAddressException("No equals sign found"); } if (parts.Length > 2) { throw new BadAddressException("Too many equals signs found"); } entry.Properties[parts[0]] = Unescape(parts[1]); } return(entry); }
public static AddressEntry Parse (string s) { AddressEntry entry = new AddressEntry (); string[] parts = s.Split (':'); if (parts.Length < 2) throw new BadAddressException ("No colon found"); if (parts.Length > 2) throw new BadAddressException ("Too many colons found"); entry.Method = parts[0]; foreach (string propStr in parts[1].Split (',')) { parts = propStr.Split ('='); if (parts.Length < 2) throw new BadAddressException ("No equals sign found"); if (parts.Length > 2) throw new BadAddressException ("Too many equals signs found"); entry.Properties[parts[0]] = Unescape (parts[1]); } return entry; }
public TcpServer(string address) { AddressEntry[] entries = NDesk.DBus.Address.Parse(address); AddressEntry entry = entries[0]; if (entry.Method != "tcp") { throw new Exception(); } string val; if (entry.Properties.TryGetValue("port", out val)) { port = UInt32.Parse(val); } if (entry.GUID == UUID.Zero) { entry.GUID = UUID.Generate(); } Id = entry.GUID; /* * Id = entry.GUID; * if (Id == UUID.Zero) * Id = UUID.Generate (); */ this.address = entry.ToString(); //Console.WriteLine ("Server address: " + Address); }
//(unix:(path|abstract)=.*,guid=.*|tcp:host=.*(,port=.*)?);? ... public static AddressEntry[] Parse(string addresses) { if (addresses == null) { throw new ArgumentNullException(addresses); } List <AddressEntry> entries = new List <AddressEntry> (); foreach (string entryStr in addresses.Split(';')) { entries.Add(AddressEntry.Parse(entryStr)); } return(entries.ToArray()); }
public static AddressEntry Parse(string s) { AddressEntry entry = new AddressEntry(); string[] parts = s.Split(':'); if (parts.Length < 2) { throw new InvalidAddressException("No colon found"); } if (parts.Length > 2) { throw new InvalidAddressException("Too many colons found"); } entry.Method = parts[0]; foreach (string propStr in parts[1].Split(',')) { parts = propStr.Split('='); if (parts.Length < 2) { throw new InvalidAddressException("No equals sign found"); } if (parts.Length > 2) { throw new InvalidAddressException("Too many equals signs found"); } if (parts[0] == "guid") { try { entry.GUID = UUID.Parse(parts[1]); } catch { throw new InvalidAddressException("Invalid guid specified"); } continue; } entry.Properties[parts[0]] = Unescape(parts[1]); } return(entry); }
public UnixServer(string address) { AddressEntry[] entries = NDesk.DBus.Address.Parse(address); AddressEntry entry = entries[0]; if (entry.Method != "unix") { throw new Exception(); } string val; if (entry.Properties.TryGetValue("path", out val)) { unixPath = val; isAbstract = false; } else if (entry.Properties.TryGetValue("abstract", out val)) { unixPath = val; isAbstract = true; } if (String.IsNullOrEmpty(unixPath)) { throw new Exception("Address path is invalid"); } if (entry.GUID == UUID.Zero) { entry.GUID = UUID.Generate(); } Id = entry.GUID; /* * Id = entry.GUID; * if (Id == UUID.Zero) * Id = UUID.Generate (); */ this.address = entry.ToString(); //Console.WriteLine ("Server address: " + Address); }
internal void OpenPrivate(string address) { if (address == null) { throw new ArgumentNullException("address"); } AddressEntry[] entries = Address.Parse(address); if (entries.Length == 0) { throw new Exception("No addresses were found"); } //TODO: try alternative addresses if needed AddressEntry entry = entries[0]; Id = entry.GUID; Transport = Transport.Create(entry); isConnected = true; }
internal void OpenPrivate(string address) { if (address == null) { throw new ArgumentNullException("address"); } AddressEntry[] entries = Address.Parse(address); if (entries.Length == 0) { throw new Exception("No addresses were found"); } //TODO: try alternative addresses if needed AddressEntry entry = entries[0]; transport = Transport.Create(entry); //TODO: clean this bit up ns = transport.Stream; }
public WinServer(string address) { AddressEntry[] entries = NDesk.DBus.Address.Parse(address); AddressEntry entry = entries[0]; if (entry.Method != "win") { throw new Exception(); } string val; if (entry.Properties.TryGetValue("path", out val)) { pipePath = val; } if (String.IsNullOrEmpty(pipePath)) { throw new Exception("Address path is invalid"); } if (entry.GUID == UUID.Zero) { entry.GUID = UUID.Generate(); } Id = entry.GUID; /* * Id = entry.GUID; * if (Id == UUID.Zero) * Id = UUID.Generate (); */ this.address = entry.ToString(); Console.WriteLine("Server address: " + Address); }
public override void Open(NDesk.DBus.AddressEntry entry) { }