示例#1
0
 /// <summary>
 /// Send a command to Winamp via SendMessage(), and receive a string result
 /// </summary>
 /// <param name="command">Command to send</param>
 /// <returns>Return value of command</returns>
 protected string SendIPCCommandString(IPCCommand command)
 {
     return(Marshal.PtrToStringAuto(Win32.SendMessage(_WinampWindow, WM_WA_IPC, 0, (Int32)command)));
 }
示例#2
0
        /// <summary>
        /// 从对应的browser 进程中消息过滤filter 处理
        /// </summary>
        /// <param name="browser"></param>
        /// <param name="sourceProcess"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        protected override bool OnProcessMessageReceived(CefBrowser browser, CefProcessId sourceProcess, CefProcessMessage message)
        {
            if (DumpProcessMessages)
            {
                Console.WriteLine("Render::OnProcessMessageReceived: SourceProcess={0}", sourceProcess);
                Console.WriteLine("Message Name={0} IsValid={1} IsReadOnly={2}", message.Name, message.IsValid, message.IsReadOnly);
                var arguments = message.Arguments;
                for (var i = 0; i < arguments.Count; i++)
                {
                    var    type = arguments.GetValueType(i);
                    object value;
                    switch (type)
                    {
                    case CefValueType.Null: value = null; break;

                    case CefValueType.String: value = arguments.GetString(i); break;

                    case CefValueType.Int: value = arguments.GetInt(i); break;

                    case CefValueType.Double: value = arguments.GetDouble(i); break;

                    case CefValueType.Bool: value = arguments.GetBool(i); break;

                    default: value = null; break;
                    }

                    Console.WriteLine("  [{0}] ({1}) = {2}", i, type, value);
                }
            }

            var handled = MessageRouter.OnProcessMessageReceived(browser, sourceProcess, message);

            if (handled)
            {
                return(true);
            }

            //if (message.Name == "myMessage2") return true;

            //var message2 = CefProcessMessage.Create("myMessage2");
            //var success = browser.SendProcessMessage(CefProcessId.Renderer, message2);
            //Console.WriteLine("Sending myMessage2 to renderer process = {0}", success);

            //var message3 = CefProcessMessage.Create("myMessage3");
            //var success2 = browser.SendProcessMessage(CefProcessId.Browser, message3);
            //Console.WriteLine("Sending myMessage3 to browser process = {0}", success);
            if (message.Name.Equals(IPCCommand.CommandType.GET_COOKIE_FROM_BROWSER_PROCESS.ToString()))
            {
                var    argumentsInMsg  = message.Arguments;
                string domainName      = argumentsInMsg.GetString(0);
                string message_cookies = argumentsInMsg.GetString(1);
                if (!string.IsNullOrEmpty(domainName))
                {
                    //todo call back
                    if (!string.IsNullOrEmpty(message_cookies))
                    {
                        var lstCookies = JsonConvert.DeserializeObject <List <CefCookie> >(message_cookies);
                        IPCCommand.OnGetCookieFromBrowserProcess(domainName, lstCookies);
                    }
                }
            }
            return(true);
        }
示例#3
0
 /// <summary>
 /// Send a command to Winamp via SendMessage()
 /// </summary>
 /// <param name="command">Command to send</param>
 /// <returns>Return value of command</returns>
 protected IntPtr SendIPCCommand(IPCCommand command)
 {
     //return SendMessage(_WinampWindow, WM_WA_IPC, (Int32) command, 0);
     return(Win32.SendMessage(_WinampWindow, WM_WA_IPC, 0, (Int32)command));
 }
示例#4
0
 /// <summary>
 /// Send an IPC command to Winamp via SendMessage(), and return an int result
 /// </summary>
 /// <param name="command">Command to send</param>
 /// <returns>Return value of command</returns>
 protected int SendIPCCommandInt(IPCCommand command)
 {
     return(Win32.SendMessage(_WinampWindow, WM_WA_IPC, 0, (Int32)command).ToInt32());
 }
示例#5
0
文件: Winamp.cs 项目: MrSm1th/lastfm
 /// <summary>
 /// Send an IPC command to Winamp via SendMessage(), and return an int result
 /// </summary>
 /// <param name="command">Command to send</param>
 /// <returns>Return value of command</returns>
 protected int SendIPCCommandInt(IPCCommand command)
 {
     return Win32.SendMessage(_WinampWindow, WM_WA_IPC, 0, (Int32)command).ToInt32();
 }
示例#6
0
文件: Winamp.cs 项目: MrSm1th/lastfm
 /// <summary>
 /// Send a command to Winamp via SendMessage(), and receive a string result
 /// </summary>
 /// <param name="command">Command to send</param>
 /// <returns>Return value of command</returns>
 protected string SendIPCCommandString(IPCCommand command)
 {
     return Marshal.PtrToStringAuto(Win32.SendMessage(_WinampWindow, WM_WA_IPC, 0, (Int32)command));
 }
示例#7
0
 /// <summary>
 /// Send a command to Winamp via SendMessage(), and receive a string result.
 /// </summary>
 /// <param name="command">Command to send</param>
 /// <returns>Return value of command</returns>
 protected string SendIPCCommandString(IPCCommand command)
 {
     return(Marshal.PtrToStringAuto(Win32.SendMessage(WinampHwnd, WM_WA_IPC, IntPtr.Zero, (Int32)command)));
 }
示例#8
0
文件: Winamp.cs 项目: MrSm1th/lastfm
 /// <summary>
 /// Send a command to Winamp via SendMessage()
 /// </summary>
 /// <param name="command">Command to send</param>
 /// <returns>Return value of command</returns>
 protected IntPtr SendIPCCommand(IPCCommand command)
 {
     //return SendMessage(_WinampWindow, WM_WA_IPC, (Int32) command, 0);
     return Win32.SendMessage(_WinampWindow, WM_WA_IPC, 0, (Int32)command);
 }
示例#9
0
 /// <summary>
 /// Send an IPC command to Winamp via SendMessage(), and return an int result.
 /// </summary>
 /// <param name="command">Command to send</param>
 /// <returns>Return value of command</returns>
 protected int SendIPCCommandInt(IPCCommand command)
 {
     return(Win32.SendMessage(WinampHwnd, WM_WA_IPC, 0, (int)command));
 }
示例#10
0
文件: PCSX2IPC.cs 项目: Lagahan/KAMI
 static extern void pcsx2ipc_write(IntPtr v, UInt32 address, UInt64 val, IPCCommand msg, bool batch);
示例#11
0
文件: PCSX2IPC.cs 项目: Lagahan/KAMI
 static extern UInt64 pcsx2ipc_read(IntPtr v, UInt32 address, IPCCommand msg, bool batch);
示例#12
0
文件: PCSX2IPC.cs 项目: Lagahan/KAMI
 public static void Write(IntPtr v, uint address, ulong val, IPCCommand msg, bool batch = false)
 {
     pcsx2ipc_write(v, address, val, msg, batch);
 }
示例#13
0
文件: PCSX2IPC.cs 项目: Lagahan/KAMI
 public static ulong Read(IntPtr v, uint address, IPCCommand msg, bool batch = false)
 {
     return(pcsx2ipc_read(v, address, msg, batch));
 }