コード例 #1
0
        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);
            }
        }
コード例 #2
0
        public void OnClientClipboardDataReceived(object sender, NetworkSocket.ClipboardDataReceivedArgs args)
        {
            ISServerSocket    client = sender as ISServerSocket;
            ClipboardDataBase cbData = ClipboardDataBase.FromBytes(args.rawData);

            SetGlobalClipboard(cbData, client, args.OperationId);
        }
コード例 #3
0
        public void OnClientClipboardChange(object sender, NetworkSocket.ClipboardDataReceivedArgs args)
        {
            if (!GlobalClipboardEnabled)
            {
                return;
            }

            ISServerSocket    client = sender as ISServerSocket;
            ClipboardDataBase cbData = ClipboardDataBase.FromBytes(args.RawData);

            //Create the operation with the GUID that the client sent. We can use this GUID to request an access
            //token if the data contains files
            SetOperation(new ServerDataOperation(cbData, client, args.OperationId));
        }
コード例 #4
0
        private async void BeginReceivedOperation(NetworkSocket.DragDropDataReceivedArgs args)
        {
            //Check if the received operation has previously been received
            if (CurrentOperation?.OperationId == args.OperationId)
            {
                ddManager.DoDragDrop(CurrentOperation.Data, args.OperationId);
                return;
            }

            if (CurrentOperation != null && !previousOperations.ContainsKey(CurrentOperation.OperationId))
            {
                previousOperations.Add(CurrentOperation.OperationId, CurrentOperation);
            }


            ClipboardDataBase cbData = ClipboardDataBase.FromBytes(args.RawData);


            //We need to setup the virtual files if this is a file drop
            if (cbData is ClipboardVirtualFileData cbFiles)
            {
                //Get an access token for the files from the server
                Guid token;
                try
                {
                    token = await Server.RequestFileTokenAsync(args.OperationId);
                }
                catch (Exception ex)
                {
                    ISLogger.Write("LocalDragDropController: Failed to get access token for dragdrop operation: " + ex.Message);
                    return;
                }


                for (int i = 0; i < cbFiles.AllFiles.Count; i++)
                {
                    cbFiles.AllFiles[i].RemoteAccessToken = token;
                    cbFiles.AllFiles[i].ReadComplete     += VirtualFile_ReadComplete;
                    cbFiles.AllFiles[i].ReadDelegate      = VirtualFile_RequestDataAsync;
                    cbFiles.AllFiles[i].FileOperationId   = args.OperationId;
                }
            }

            CurrentOperation = new DragDropOperation(args.OperationId, cbData);
            ddManager.DoDragDrop(cbData, args.OperationId);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        public void Client_DataDropped(object sender, NetworkSocket.DragDropDataReceivedArgs args)
        {
            ISServerSocket client = sender as ISServerSocket;

            BeginOperation(client, ClipboardDataBase.FromBytes(args.RawData), args.OperationId);
        }
コード例 #7
0
 public AnonIpcClipboardDataMessage(byte[] data) : base(data)
 {
     byte[] cbData = new byte[data.Length - 17];
     Buffer.BlockCopy(data, 17, cbData, 0, cbData.Length);
     Data = ClipboardDataBase.FromBytes(cbData);
 }
コード例 #8
0
 public AnonIpcDoDragDropMessage(byte[] data) : base(data)
 {
     byte[] raw = new byte[data.Length - 17];
     Buffer.BlockCopy(data, 17, raw, 0, raw.Length);
     DropData = ClipboardDataBase.FromBytes(raw);
 }