private static void ProcessUri(string uri, Message message) { if (Clients.Keys.Any(_ => uri.Contains(_))) { try { IClient client = Clients.First(_ => uri.Contains(_.Key)).Value; if (client != null) { IMusic parsedMusic = client.ParseUri(uri); Bot.Client.SendTextMessageAsync(message.Chat.Id, parsedMusic.ToString( )); string reply = client.SearchMusic(parsedMusic) ?? Messages.MusicNotFound.GetLocalized(message.From.LanguageCode); Bot.Client.SendTextMessageAsync(message.Chat.Id, reply); } } catch (InvalidOperationException) { Log.Error("Uri received, but parser not found"); Bot.Client.SendTextMessageAsync(message.Chat.Id, "Либо это не ссылка на музыку, либо я не умею работать с этим сервисом"); } catch (NullReferenceException) { Log.Error("Parser failed"); Bot.Client.SendTextMessageAsync(message.Chat.Id, "Музыка не распознана"); } } }
public InputMusicInformation(long aTimeStampTicks, bool aIsSelected, IMusic aMusic, double aProgress) { timeStampTicks = aTimeStampTicks; isSelected = aIsSelected; music = aMusic; progress = aProgress; }
public GameOptions() { gameVersion = GameVersion.Version109; gameMode = GameMode.Commercial; missionPack = MissionPack.Doom2; players = new Player[Player.MaxPlayerCount]; for (var i = 0; i < Player.MaxPlayerCount; i++) { players[i] = new Player(i); } players[0].InGame = true; consolePlayer = 0; episode = 1; map = 1; skill = GameSkill.Medium; demoPlayback = false; netGame = false; deathmatch = 0; fastMonsters = false; respawnMonsters = false; noMonsters = false; intermissionInfo = new IntermissionInfo(); random = new DoomRandom(); video = NullVideo.GetInstance(); sound = NullSound.GetInstance(); music = NullMusic.GetInstance(); userInput = NullUserInput.GetInstance(); }
public PlayMusicInformation(long aTimeStampTicks, bool aIsSelected, IMusic aMusic, LoopInformation aLoopPoint) { timeStampTicks = aTimeStampTicks; isSelected = aIsSelected; music = aMusic; loopPoint = aLoopPoint; }
public static void LoadMusicInfoFromJson(IMusic m, dynamic obj) { var type = m.Type.ToString(); m.Name = Get(obj, type + "_name", "name" ); m.Id = Get(obj, type + "_id", "id" ); m.Logo = StringHelper.EscapeUrl(Get(obj, type + "_logo", "logo","album_logo" )); }
private MusicViewModel createViewModel(IMusic music, bool toFront) { MusicViewModel s = null; switch (music.Type) { case EnumMusicType.album: s = new AlbumViewModel(music as Album); break; case EnumMusicType.artist: s = new ArtistViewModel(music as Artist); break; case EnumMusicType.collect: s = new CollectViewModel(music as Collection); break; default: s = SongViewModel.Get(music as Song); break; } return(s); }
void addItem(IMusic music, bool toFront) { MusicViewModel s = createViewModel(music, toFront); if (s == null) { return; } UIHelper.WaitOnUI(() => { if (s is SongViewModel) { var dup = this.IndexOf(s); if (dup != -1) { Move(dup, toFront ? 0 : this.Count - 1); return; } } if (toFront) { Insert(0, s); } else { Add(s); } }); }
public static IMusic CreateFromJson(dynamic obj, EnumMusicType type) { IMusic res = null; switch (type) { case EnumMusicType.album: res = new Album(); break; case EnumMusicType.artist: res = new Artist(); break; case EnumMusicType.collect: res = new Collection(); break; case EnumMusicType.song: res = new Song(); break; default: break; } if (res != null) { res.CreateFromJson(obj); } return(res); }
public async Task <int> UpdateAsync(IMusic entity) { DbContext.Musics.Remove(await DbContext.Musics.FindAsync(entity.MusicPartId)); await DbContext.SaveChangesAsync(); return(await _repository.UpdateAsync(AutoMapper.Mapper.Map <Music>(entity))); }
public GameOptions() { this.players = new Player[Player.MaxPlayerCount]; for (var i = 0; i < Player.MaxPlayerCount; i++) { this.players[i] = new Player(i); } this.players[0].InGame = true; this.consolePlayer = 0; this.episode = 1; this.map = 1; this.skill = GameSkill.Medium; this.netGame = false; this.deathmatch = 0; this.fastMonsters = false; this.respawnMonsters = false; this.noMonsters = false; this.intermissionInfo = new IntermissionInfo(); this.renderer = null; this.sound = NullSound.GetInstance(); this.music = NullMusic.GetInstance(); this.userInput = NullUserInput.GetInstance(); }
public static void load(SampleGame sampleGame) { // TODO Auto-generated method stub theme = sampleGame.getAudio().createMusic(Prefix + "menutheme.mp3"); theme.setLooping(true); theme.setVolume(0.85f); theme.play(); }
/// <summary> /// 在当前播放列表加入 /// </summary> /// <param name="music"></param> public static void Add(IMusic music, bool play = true) { Musics.Add(music); if (play) { index = Musics.Count - 1; } }
/// <summary> /// 在当前播放歌曲后插入 /// </summary> /// <param name="music"></param> public static void Insert(IMusic music, bool play = true) { Musics.Insert(index, music); if (play) { index++; } }
public static void PlayOverWorldTheme(){ StopAllBackgroundThemes(); if(HUDManager.RemainingTime() > SoundConstants.HURRYUPTIME) overworld = new MarioOverworldTheme(); else overworld = new RushedOverworldTheme(); overworld.PlayTheme(); }
public MusicViewer(IMusic music) { InitializeComponent(); _music = music; artistsList.Items.AddRange(_music.GetArtists().ToArray()); musicName.Text = _music.Name; }
public MusicViewModel(IMusic m) { music = m; if (m.Logo != null) { m.Logo = m.Logo.Replace("_1.jpg", ".jpg"); } }
public static string Get(this IMusic m, params string[] props) { if (m == null) { return(null); } return(Get(m.JsonObject, props)); }
public static void LoadMusicInfoFromJson(IMusic m, dynamic obj) { var type = m.Type.ToString(); m.Name = Get(obj, type + "_name", "name", "title"); m.Id = Get(obj, type + "_id", "id", "obj_id"); m.Logo = StringHelper.EscapeUrl(Get(obj, type + "_logo", "logo", "album_logo")); m.JsonObject = obj; }
public void AddFile(string file) { IMusic temp = MusicFactory.GetMusic(new FileInfo(file), control); if (temp != null) { FileList.Add(temp); } }
private void ListView_DoubleClick(object sender, MouseButtonEventArgs e) { var music = Library.LoadMusic(listview.SelectedItem.ToString()); IMusic selectedMusic = listview.SelectedItem as IMusic; MessageBox.Show(selectedMusic.Title); Player.Play(selectedMusic); }
private void UpdateFileList(object sender, FileSystemEventArgs e) { string[] lFilePathArray = PoolFilePath.Get(directoryInfo); List <string> lFilePathNewList = new List <string>(); // Check New File. for (int i = 0; i < lFilePathArray.Length; i++) { string lFilePath = lFilePathArray[i]; long lTimeStampTicks = File.GetLastWriteTime(lFilePath).Ticks; if (timeStampTicksDictionary.ContainsKey(lFilePath) == false) { timeStampTicksDictionary.Add(lFilePath, lTimeStampTicks); lFilePathNewList.Add(lFilePath); } else if (lTimeStampTicks != timeStampTicksDictionary[lFilePath]) { timeStampTicksDictionary[lFilePath] = lTimeStampTicks; lFilePathNewList.Add(lFilePath); } } for (int i = 0; i < lFilePathNewList.Count; i++) { string lFilePath = lFilePathNewList[i]; //Logger.BreakDebug( "Input:" + lFilePath ); if (Path.GetExtension(lFilePath) == ".meta") { continue; } try { IMusic lMusic = ConstructorCollection.ConstructMusic(lFilePath); if (lMusic != null) { if (musicInformationDictionary.ContainsKey(lFilePath) == false) { filePathList.Add(lFilePath); musicInformationDictionary.Add(lFilePath, new InputMusicInformation(timeStampTicksDictionary[lFilePath], false, lMusic, 0.0d)); } else { musicInformationDictionary[lFilePath] = new InputMusicInformation(timeStampTicksDictionary[lFilePath], false, lMusic, 0.0d); } } } catch (Exception aExpection) { Logger.BreakError("LoopPlaylist Exception:" + aExpection.ToString() + ":" + lFilePath); } } }
/// <summary> /// 设置当前播放音乐 /// </summary> /// <param name="music"></param> public static void SetCurrentMusic(IMusic music) { for (int i = 0; i < Musics.Count; i++) { if (Musics[i] == music) { index = i; } } }
public static void Main(string[] args) { // custom dependency injection & sql data connection // performing migrations on startup Data = new IData(new IDataSqlite()); Data.MigrateDatabase(); Music = new IMusic(new IMusicFileDirectory()); Task.Run(() => { Music.GenerateMusicData(); }); CreateHostBuilder(args).Build().Run(); }
public static void PlayStarTheme() { GetPreviousTheme(); StopAllBackgroundThemes(); if (HUDManager.RemainingTime() > SoundConstants.HURRYUPTIME) starMan = new StarTheme(); else starMan = new RushedStarTheme(); starMan.PlayTheme(); }
public MusicInfoModel(IMusic music) { Id = music.Id; Artists = music.Artists; Name = music.Name; Album = music.Album; SourceName = music.SourceName; Origin = music.Origin; CoverId = music.CoverId; }
/// <summary> /// Retourne l'indice de la première Music matchant celle passée en paramètre /// </summary> /// <param name="currentlyPlaying"> Music à rechercher </param> /// <returns> L'indice de la première occurence matchant celle passée en paramètre </returns> public int Index(IMusic currentlyPlaying) { try { return(PlaylistProperty.IndexOf(PlaylistProperty.First(x => x.Equals(currentlyPlaying)))); } catch { throw new NullReferenceException(); } }
public bool Equals(IMusic other) { if (!(other is Artist)) { return(false); } Artist otherArtist = ( Artist )other; return(string.Equals(_name, otherArtist.Name, StringComparison.OrdinalIgnoreCase) && _sampleAlbum.Equals(otherArtist.SampleAlbum)); }
public void AddItems(List <IMusic> inlist, bool toFront = false) { int count = inlist.Count(); if (count == 0) { return; } count = Math.Min(slowCount, count); int s = 1000 / count; Task.Run(() => { try { foreach (var item in inlist) { queue.Enqueue(item); } for (int i = 0; i < count; i++) { IMusic item = null; if (!queue.TryDequeue(out item)) { break; } addItem(item, toFront); Thread.Sleep(s); } int buffer = 0; while (true) { IMusic item = null; if (!queue.TryDequeue(out item)) { break; } addItem(item, toFront); buffer++; if (buffer == 10000) { Thread.Sleep(100); buffer = 0; } } } catch (System.Exception e) { var x = e.StackTrace; } }); }
public void Crossfade(IMusic music, int length) { if (currentSong == null) { // TODO: Fade in music Play(music); } else { crossfadeTargetSong = music as Music; crossfadeStepSize = length / 100; crossfadeTargetSong.SFMusic.Volume = 0f; crossfadeTargetSong.SFMusic.Play(); } }
public bool Equals(IMusic other) { if (!(other is Album)) { return(false); } Album otherAlbum = ( Album )other; return((_title.Contains(otherAlbum.Title, StringComparison.OrdinalIgnoreCase) || otherAlbum.Title.Contains(_title, StringComparison.OrdinalIgnoreCase)) && string.Equals(_artist, otherAlbum.Artist, StringComparison.OrdinalIgnoreCase)); }
private void PrepareDownload() { //Instantiate IFileWritter to handle writting downloaded data to file system var myWriter = Music.GetFileWriter(myWriterType, DownloadDir); //Instantiate new Music object to handle downloads _music = new Music(myWriter); //Add each song selected by the user to _music.Songs GetSelectedSongs() .ForEach(selectedSong => _music.Songs.Add(Music.GetSong(mySongType, RapGeniusUrl, selectedSong))); }
public bool Equals(IMusic other) { if (!(other is Track)) { return(false); } Track otherTrack = ( Track )other; return((_title.Contains(otherTrack.Title, StringComparison.OrdinalIgnoreCase) || otherTrack.Title.Contains(_title, StringComparison.OrdinalIgnoreCase)) && (_album.Contains(otherTrack.Album, StringComparison.OrdinalIgnoreCase) || otherTrack.Album.Contains(_album, StringComparison.OrdinalIgnoreCase)) && string.Equals(_artist, otherTrack.Artist, StringComparison.OrdinalIgnoreCase)); }
public void AddDirectory(string directory) { FileList = new List <IMusic>(); DirectoryInfo directoryInfo = new DirectoryInfo(directory); FileInfo[] Files = directoryInfo.GetFiles(); foreach (var file in Files) { IMusic temp = MusicFactory.GetMusic(file, control); if (temp != null) { FileList.Add(temp); } } }
public static async void ExtractTagsFromBuffer(IBuffer buffer, IMusic music) { using (var stream = new MemoryStream(buffer.ToArray())) { TagLib.File file = TagLib.File.Create(new StreamFileAbstraction(music.File.Name, stream, stream)); Tag tag = file.GetTag(TagTypes.Id3v2); if (!String.IsNullOrWhiteSpace(tag.Title)) { music.Title = tag.Title; } if (!String.IsNullOrWhiteSpace(tag.FirstPerformer)) { music.Artist = tag.FirstPerformer; } if (!String.IsNullOrWhiteSpace(tag.Album)) { music.Album = tag.Album; } if (tag.Pictures.Length > 0) { StorageFolder localFolder = ApplicationData.Current.LocalFolder; var item = await localFolder.TryGetItemAsync(music.File.Id + ".jpg"); if (item != null) { music.CoverUri = new Uri(item.Path); } else { StorageFile storageFile = await localFolder.CreateFileAsync(music.File.Id + ".jpg"); await FileIO.WriteBytesAsync(storageFile, tag.Pictures[0].Data.Data); music.CoverUri = new Uri(storageFile.Path); } Debug.WriteLine(music.CoverUri); } int bitrate = file.Properties.AudioBitrate * 125; music.Duration = TimeSpan.FromSeconds(music.File.Size / bitrate); } }
public static void PlayBuckeyeOverworldTheme() { StopAllBackgroundThemes(); buckeyeOverworld = new BuckeyeOverworldTheme(); buckeyeOverworld.PlayTheme(); }
public static void PlayFlagPoleVictoryTheme() { StopAllBackgroundThemes(); flagPoleVictory = new FlagPoleVictoryTheme(); flagPoleVictory.PlayTheme(); }
public static void PlayIntroTheme() { StopAllBackgroundThemes(); intro = new IntroTheme(); intro.PlayTheme(); }
public bool IsTagMatches(IMusic music, IMusicTag tag) { return this[tag.Id] != string.Empty && music[tag.Id] != string.Empty && this[tag.Id] == music[tag.Id]; }
public static void PlayPacManEndTheme() { StopAllBackgroundThemes(); pacEndTheme = new PacMarioEndTheme(); pacEndTheme.PlayTheme(); }
private static void GetPreviousTheme() { if (overworld.IsPlaying()) prePowerUpTheme = overworld; else if (flagPoleVictory.IsPlaying()) prePowerUpTheme = flagPoleVictory; else if (buckeyeOverworld.IsPlaying()) prePowerUpTheme = buckeyeOverworld; else if (pacLevel.IsPlaying()) prePowerUpTheme = pacLevel; }
public MusicViewModel(IMusic m) { music = m; if (m.Logo != null) m.Logo = m.Logo.Replace("_1.jpg", ".jpg"); }
public static void PlayPacManLevelTheme() { StopAllBackgroundThemes(); pacLevel = new PacManLevelTheme(); pacLevel.PlayTheme(); }
public static void PlayPacMarioDeathTheme() { StopAllBackgroundThemes(); pacDeath = new PacMarioDeadTheme(); pacDeath.PlayTheme(); }
public void Crossfade(IMusic music, int length) { throw new NotImplementedException(); }
public MusicInPlayList(IMusic music) { _music = music; }
public void Add(IMusic music) { _store.Add(music); AllMusicPlayList.Add(music.Id); }
public bool IsTagMatches(IMusic music, IMusicTag musicTag) { return _music.IsTagMatches(music, musicTag); }
public void Play(IMusic music) { currentSong = music as Music; currentSong.SFMusic.Play(); }
public void Play(IMusic music) { throw new NotImplementedException(); }
public static void PlayDeathTheme() { StopAllBackgroundThemes(); death = new DeathTheme(); death.PlayTheme(); }
public void Add(IMusic music) { _adapter.OpenDatabase(); _adapter.ExecuteNonQuery(string.Format(Constants.Sql.InsertMusic, music.Id, music.Priority)); _adapter.Close(); }
public static void PlayCarmenTheme() { StopAllBackgroundThemes(); carmen = new CarmenTheme(); carmen.PlayTheme(); }
public MusicViewModel(IMusic m) { music = m; }