public string Post([FromBody] AuthPair auth) { if (auth == null) { throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.BadRequest)); } return(Lib_Primavera.PharmaCRM.isCorrectPassword(auth.Email, auth.Password)); }
public NowPlayingHandler(AuthPair auth, string channelName) : base(auth) { _channel = channelName; On["/" + channelName + "/nowplaying"] = _ => { if (string.IsNullOrEmpty(_.Message) || _.Message == "remove") { if (_waveOut != null) { _waveOut.Stop(); } return; } Task.Run(() => { NowPlaying song = JsonConvert.DeserializeObject <NowPlaying>(_.Message); if (!ASongHasPlayed) { // This is the first song to play in this channel (probably a partial) ASongHasPlayed = true; } else if (ServerLag == null) { // This is the second song - capture the lag offset ServerLag = Time.Timestamp() - song.votetime; LogTo.Error("Server lag set to {0}ms", ServerLag.Value); } else { // This is the third song or later, adjust the time offset song.votetime += ServerLag.Value; } song.votetime += PrefetchTime; if (string.IsNullOrWhiteSpace(song.songID)) { playingTrack = null; LogTo.Warn("Server asked to play empty song on channel {0}", _channel); return; } PlaySong(song.songID, UnixTimeBase.AddMilliseconds(song.votetime)); }); }; Run(); }
public SovndClient(AuthPair auth, IChannelHandlerFactory chf, ChannelDirectory channels) : base(auth) { _chf = chf; Username = auth.Settings.GetSettings().SOVNDUsername; Logging.SetupLogging(Username); // TODO Track channel list // TODO Track playlist for channel // On /channel/info -> track channel list // On /selectedchannel/ nowplaying,playlist,stats,chat -> track playlist, subscribed channel details // TODO: Need to move all of this to somewhere channel specific // TODO: We don't need to be subbed to this all the time, just when browsing for channels On["/{channel}/info"] = _ => { Channel channel = JsonConvert.DeserializeObject <Channel>(_.Message); channels.AddChannel(channel); }; }
public WmiQueryProvider(string ipOrName, string namespaceToQuery, AuthPair authPair) : this(ipOrName, namespaceToQuery) { _authPair = authPair; }
void SetCommands() { setCustomBackground = new DelegateCommand((obj) => { Navigate("/Pages/Settings/Backgrounds.xaml"); }); pinComposeToStart = new DelegateCommand((obj) => { SecondaryTiles.CreateComposeTile(); pinComposeToStart.RaiseCanExecuteChanged(); }, (obj) => !SecondaryTiles.ComposeTileIsCreated()); addAccount = new DelegateCommand((obj) => Navigate(Uris.LoginPage)); editFilters = new DelegateCommand((obj) => { DataTransfer.cFilter = Config.GlobalFilter; DataTransfer.IsGlobalFilter = true; Navigate(Uris.Filters); }); saveCredentials = new DelegateCommand((obj) => { AuthPair PocketPair = null; AuthPair InstapaperPair = null; if (!string.IsNullOrWhiteSpace(PocketUser)) { BarText = "Verifying credentials..."; IsLoading = true; PocketPair = new AuthPair { User = PocketUser, Password = PocketPassword }; var service = new PocketService { UserName = PocketPair.User, Password = PocketPair.Password }; service.CheckCredentials((valid, response) => { if (valid) { MessageService.ShowLightNotification("Credentials saved."); Config.ReadLaterCredentials.Pocket = PocketPair; Config.ReadLaterCredentials = Config.ReadLaterCredentials; } else { IsLoading = false; MessageService.ShowError("Invalid Pocket credentials"); } }); } else { Config.ReadLaterCredentials.Pocket = null; Config.ReadLaterCredentials = Config.ReadLaterCredentials; } if (!string.IsNullOrWhiteSpace(InstapaperUser)) { BarText = "Verifying credentials..."; IsLoading = true; InstapaperPair = new AuthPair { User = InstapaperUser, Password = InstapaperPassword }; var service = new InstapaperService { UserName = InstapaperPair.User, Password = InstapaperPair.Password }; service.CheckCredentials((valid, response) => { if (valid) { MessageService.ShowLightNotification("Credentials saved."); Config.ReadLaterCredentials.Instapaper = InstapaperPair; Config.ReadLaterCredentials = Config.ReadLaterCredentials; } else { IsLoading = false; MessageService.ShowError("Invalid Instapaper credentials."); } }); } else { Config.ReadLaterCredentials.Pocket = null; Config.ReadLaterCredentials = Config.ReadLaterCredentials; } }); }