public void OnClipboardDataReceived(object sender, NetworkSocket.ClipboardDataReceivedArgs args) { if (!ClipboardEnabled) { return; } try { ClipboardDataBase cbData = ClipboardDataBase.FromBytes(args.RawData); cbData.OperationId = args.OperationId; if (cbData is ClipboardVirtualFileData cbFiles) { cbFiles.RequestPartMethod = server.RequestReadStreamAsync; cbFiles.RequestTokenMethod = server.RequestFileTokenAsync; } CurrentOperation = new ClientDataOperation(cbData, args.OperationId); clipboardMan.SetClipboardData(cbData); } catch (Exception ex) { ISLogger.Write("Failed to set clipboard data: " + ex.Message); } }
private void OnLocalClipboardChange(object sender, ClipboardDataBase data) { if (!server.IsConnected || !ClipboardEnabled) { return; } Guid opId = Guid.NewGuid(); CurrentOperation = new ClientDataOperation(data, opId); server.SendClipboardData(CurrentOperation.Data.ToBytes(), opId); }
internal void Local_DataDropped(object sender, ClipboardDataBase cbData) { if (!server.IsConnected) { return; } if (server.IsConnected) { Guid opId = Guid.NewGuid(); CurrentOperation = new ClientDataOperation(cbData, opId); ISLogger.Write("LocalDragDropController: Started dragdrop operation " + opId); server.SendDragDropData(cbData.ToBytes(), opId); } }
private void BeginReceivedOperation(NetworkSocket.DragDropDataReceivedArgs args) { if (!DragDropEnabled) { server.NotifyDragDropSuccess(false); return; } //Check if the received operation has previously been received if (CurrentOperation?.OperationGuid == args.OperationId) { ddManager.DoDragDrop(CurrentOperation.Data); return; } ClipboardDataBase cbData = ClipboardDataBase.FromBytes(args.RawData); cbData.OperationId = args.OperationId; //We need to setup the virtual files if this is a file drop if (cbData is ClipboardVirtualFileData cbFiles) { cbFiles.RequestPartMethod = server.RequestReadStreamAsync; cbFiles.RequestTokenMethod = server.RequestFileTokenAsync; ISLogger.Write("Copied files"); foreach (var file in cbFiles.AllFiles) { ISLogger.Write(file.FullPath); } } CurrentOperation = new ClientDataOperation(cbData, args.OperationId); ddManager.DoDragDrop(cbData); }