public void GetData (X11Dnd dnd, IDataObject data, ref XEvent xevent) { string text = dnd.GetText (ref xevent, false); if (text == null) return; // TODO: Do this in a loop instead of just splitting ArrayList uri_list = new ArrayList (); string [] lines = text.Split (new char [] { '\r', '\n' }); foreach (string line in lines) { // # is a comment line (see RFC 2483) if (line.StartsWith ("#")) continue; try { Uri uri = new Uri (line); uri_list.Add (uri.LocalPath); } catch { } } string [] l = (string []) uri_list.ToArray (typeof (string)); if (l.Length < 1) return; data.SetData (DataFormats.FileDrop, l); data.SetData ("FileName", l [0]); data.SetData ("FileNameW", l [0]); }
public void GetData (X11Dnd dnd, IDataObject data, ref XEvent xevent) { string text = dnd.GetText (ref xevent, true); if (text == null) return; data.SetData (DataFormats.Text, text); data.SetData (DataFormats.UnicodeText, text); }