void IExtensionService.Initialize() { Hyena.Log.Debug("Initializing LCD service"); action_service = ServiceManager.Get <InterfaceActionService> (); actions = new ActionGroup("LCD"); actions.Add(new ActionEntry [] { new ActionEntry("LCDAction", null, AddinManager.CurrentLocalizer.GetString("LCD"), null, null, null), new ActionEntry("LCDConfigureAction", Stock.Properties, AddinManager.CurrentLocalizer.GetString("_Configure..."), null, AddinManager.CurrentLocalizer.GetString("Configure the LCD plugin"), OnConfigure) }); action_service.UIManager.InsertActionGroup(actions, 0); ui_manager_id = action_service.UIManager.AddUiFromResource("LCDMenu.xml"); ScreensCreate(); lcdclient = new LCDClient(Host, Port); lcdclient.Connected += OnConnected; parser = new LCDParser(); ServiceManager.PlayerEngine.ConnectEvent(OnPlayerEvent, PlayerEvent.Iterate | PlayerEvent.StartOfStream | PlayerEvent.EndOfStream | PlayerEvent.TrackInfoUpdated | PlayerEvent.StateChange); }
private static void OnSend(IAsyncResult result) { LCDClient client = (LCDClient)result.AsyncState; client.socket.EndSend(result); //int bytecount = client.socket.EndSend(result); //Hyena.Log.Debug("Sent "+bytecount.ToString()+" bytes"); }
public void Dispose() { ServiceManager.PlayerEngine.DisconnectEvent(OnPlayerEvent); Hyena.Log.Debug("Disposing LCD service"); action_service.UIManager.RemoveUi(ui_manager_id); action_service.UIManager.RemoveActionGroup(actions); actions = null; lcdclient.Dispose(); lcdclient = null; ScreensDelete(); }
private void OnConfigure(object o, EventArgs args) { Hyena.Log.Debug("Configuring LCD service"); ConfigurationDialog dialog = new ConfigurationDialog(this); dialog.Run(); dialog.Destroy(); lcdclient.Dispose(); lcdclient = new LCDClient(Host, Port); Hyena.Log.Debug("Configured LCD service"); }
private static void OnConnect(IAsyncResult result) { LCDClient client = (LCDClient)result.AsyncState; if (!result.IsCompleted) { Hyena.Log.Debug("Not yet connected to " + client.host + ":" + client.port.ToString()); return; } if (!client.socket.Connected) { Hyena.Log.Warning("Could not connect to " + client.host + ":" + client.port.ToString()); client.connecting = false; return; } client.socket.EndConnect(result); Hyena.Log.Debug("Connected to " + client.host + ":" + client.port.ToString()); client.socket.BeginReceive(client.recvbuf, 0, bufsize, SocketFlags.None, new AsyncCallback(OnReceive), client); client.SendString("hello\n"); }
private static void OnReceive(IAsyncResult result) { LCDClient client = (LCDClient)result.AsyncState; int bytecount = client.socket.EndReceive(result); string s = Encoding.ASCII.GetString(client.recvbuf, 0, bytecount); client.recvbuf.Initialize(); //Hyena.Log.Debug("Received "+bytecount.ToString()+" bytes: "+s.Trim()); if (client.connecting) { string[] ssplit = s.Split(" \n".ToCharArray(), 20); client.lcd = new LCD(Int32.Parse(ssplit[7]), Int32.Parse(ssplit[9]), Int32.Parse(ssplit[11]), Int32.Parse(ssplit[13])); client.SendString("client_set -name Banshee\n"); client.connecting = false; client.Connected(); } client.socket.BeginReceive(client.recvbuf, 0, bufsize, SocketFlags.None, new AsyncCallback(OnReceive), client); }
public void Dispose() { ServiceManager.PlayerEngine.DisconnectEvent (OnPlayerEvent); Hyena.Log.Debug ("Disposing LCD service"); action_service.UIManager.RemoveUi (ui_manager_id); action_service.UIManager.RemoveActionGroup (actions); actions = null; lcdclient.Dispose(); lcdclient = null; ScreensDelete(); }
private void OnConfigure(object o, EventArgs args) { Hyena.Log.Debug ("Configuring LCD service"); ConfigurationDialog dialog = new ConfigurationDialog (this); dialog.Run (); dialog.Destroy (); lcdclient.Dispose(); lcdclient = new LCDClient(Host ,Port); Hyena.Log.Debug ("Configured LCD service"); }
void IExtensionService.Initialize() { Hyena.Log.Debug ("Initializing LCD service"); action_service = ServiceManager.Get<InterfaceActionService> (); actions = new ActionGroup ("LCD"); actions.Add (new ActionEntry [] { new ActionEntry ("LCDAction", null, AddinManager.CurrentLocalizer.GetString ("LCD"), null, null, null), new ActionEntry ("LCDConfigureAction", Stock.Properties, AddinManager.CurrentLocalizer.GetString ("_Configure..."), null, AddinManager.CurrentLocalizer.GetString ("Configure the LCD plugin"), OnConfigure) }); action_service.UIManager.InsertActionGroup (actions, 0); ui_manager_id = action_service.UIManager.AddUiFromResource ("LCDMenu.xml"); ScreensCreate(); lcdclient = new LCDClient(Host, Port); lcdclient.Connected += OnConnected; parser = new LCDParser(); ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent, PlayerEvent.Iterate | PlayerEvent.StartOfStream | PlayerEvent.EndOfStream | PlayerEvent.TrackInfoUpdated | PlayerEvent.StateChange); }
internal StateObject(int size, Socket socket, LCDClient lcdclient) { this.buf = new byte[size]; this.socket = socket; this.lcdclient = lcdclient; }