public DragDropPointerEffects HandleDataDropped(DragDropInfo dragDropInfo) { Microsoft.VisualStudio.Text.SnapshotPoint position = dragDropInfo.VirtualBufferPosition.Position; var doc = SpriteDocument.FromJSON(_view.TextBuffer.CurrentSnapshot.GetText(), _documentFileName); string ident = SpriteHelpers.GetIdentifier(_draggedFileName); string file = SpriteHelpers.MakeRelative(_documentFileName, _draggedFileName); if (doc.Images.ContainsKey(ident)) { ident += "_" + Guid.NewGuid().ToString().Replace("-", string.Empty); } doc.Images.Add(new KeyValuePair <string, string>(ident, file)); using (Microsoft.VisualStudio.Text.ITextEdit edit = _view.TextBuffer.CreateEdit()) { edit.Replace(0, _view.TextBuffer.CurrentSnapshot.Length, doc.ToJsonString()); edit.Apply(); } return(DragDropPointerEffects.Copy); }