private static String tempFolderRoot = System.IO.Path.GetTempPath() + "remoteControl/";//TODO improve according http://stackoverflow.com/questions/944483/how-to-get-temporary-folder-for-current-user public static SocketMessages.Message getCurrentClipboardMessage() { SocketMessages.Message m = new SocketMessages.Message(SocketMessages.Message.TypeMessage.ClipboardAttached); try { IDictionary <String, Byte[]> mappa = getCurrentClipboard(); m.data = mappa; } catch (Exception e) { throw new Exception("Error during clipboard send"); } return(m); }
public static void setCurrentClipboard(SocketMessages.Message m) { if (m.typeMessage != SocketMessages.Message.TypeMessage.ClipboardAttached) { throw new Exception("Error during clipboard receiving"); } try { IDictionary <String, Object> mappa = m.Content <IDictionary <String, Object> >(); setCurrentClipboard(mappa); } catch (Exception e) { throw e; } }
public static void setCurrentClipboard(SocketMessages.Message m) { if (m.typeMessage != SocketMessages.Message.TypeMessage.ClipboardAttached) { throw new Exception("Error during clipboard receiving"); } try { IDictionary <String, Object> mappa = (IDictionary <String, Object>)CommonClasses.SocketMessages.SerializationMethods.DeserializeFromByteArray((byte[])m.data); setCurrentClipboard(mappa); } catch (Exception e) { throw e; } }
private void button4_Click(object sender, EventArgs e) { CommonClasses.SocketMessages.Message m; /* byte[] bytes = MD5PasswordHashing.GetMd5HashBytes(SlaveGlobalVars.Password); * * TcpClient cl = new TcpClient("127.0.0.1", CommonClasses.DefaultSettings.listeningPort); * * * // MessageBox.Show("master connecting"); * m=new CommonClasses.SocketMessages.Message(CommonClasses.SocketMessages.Message.Status.Authenticate,bytes); * ns = cl.GetStream(); * m.WriteToSocket(ns); * ns.Flush(); * System.Threading.Thread.Sleep(500); * m = CommonClasses.SocketMessages.Message.ReadFromSocket(ns);*/ INPUT input = new INPUT(); input.type = 1; input.mkhi.ki = new KEYBDINPUT(); input.mkhi.ki.Vk = (ushort)0x41; input.mkhi.ki.Scan = 0; input.mkhi.ki.Flags = 0; input.mkhi.ki.Time = 0; input.mkhi.ki.ExtraInfo = IntPtr.Zero; /* KEYBDINPUT keydb = new KEYBDINPUT(); * * keydb.Vk = (ushort)0x41;// keyCode; * keydb.Scan = 0; * keydb.Flags = 0; * keydb.Time = 0; * keydb.ExtraInfo = IntPtr.Zero; * * * * INPUT input=new INPUT(); * input.mkhi.ki = keydb;*/ m = new CommonClasses.SocketMessages.Message(CommonClasses.SocketMessages.Message.TypeMessage.Input); m.data = input; m.WriteToSocket(Socket.MasterSocket.getSlave(idSlaveFocus).ns); Socket.MasterSocket.getSlave(idSlaveFocus).ns.Flush(); }
private static readonly String TempFolderRoot = System.IO.Path.GetTempPath() + "remoteControl/";//TODO improve according http://stackoverflow.com/questions/944483/how-to-get-temporary-folder-for-current-user public static SocketMessages.Message getCurrentClipboardMessage() { SocketMessages.Message m = new SocketMessages.Message(SocketMessages.Message.TypeMessage.ClipboardAttached); try { IDictionary <String, Object> mappa; mappa = getCurrentClipboard(); byte[] bytes = CommonClasses.SocketMessages.SerializationMethods.SerializeToByteArray(mappa); m.set_bytes(bytes); } catch (Exception e) { throw new Exception("Error during clipboard send"); } return(m); }