コード例 #1
0
        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,
                                                    "Музыка не распознана");
                }
            }
        }
コード例 #2
0
 public InputMusicInformation(long aTimeStampTicks, bool aIsSelected, IMusic aMusic, double aProgress)
 {
     timeStampTicks = aTimeStampTicks;
     isSelected     = aIsSelected;
     music          = aMusic;
     progress       = aProgress;
 }
コード例 #3
0
        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();
        }
コード例 #4
0
 public PlayMusicInformation(long aTimeStampTicks, bool aIsSelected, IMusic aMusic, LoopInformation aLoopPoint)
 {
     timeStampTicks = aTimeStampTicks;
     isSelected     = aIsSelected;
     music          = aMusic;
     loopPoint      = aLoopPoint;
 }
コード例 #5
0
 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" ));
 }
コード例 #6
0
        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);
        }
コード例 #7
0
        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);
                }
            });
        }
コード例 #8
0
        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);
        }
コード例 #9
0
        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)));
        }
コード例 #10
0
        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();
        }
コード例 #11
0
ファイル: Assets.cs プロジェクト: MahendrenGanesan/samples
 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();
 }
コード例 #12
0
ファイル: Assets.cs プロジェクト: yuva2achieve/dot42
 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();
 }
コード例 #13
0
ファイル: PlayerList.cs プロジェクト: naisev/WeMusic
 /// <summary>
 /// 在当前播放列表加入
 /// </summary>
 /// <param name="music"></param>
 public static void Add(IMusic music, bool play = true)
 {
     Musics.Add(music);
     if (play)
     {
         index = Musics.Count - 1;
     }
 }
コード例 #14
0
ファイル: PlayerList.cs プロジェクト: naisev/WeMusic
 /// <summary>
 /// 在当前播放歌曲后插入
 /// </summary>
 /// <param name="music"></param>
 public static void Insert(IMusic music, bool play = true)
 {
     Musics.Insert(index, music);
     if (play)
     {
         index++;
     }
 }
コード例 #15
0
 public static void PlayOverWorldTheme(){
     StopAllBackgroundThemes();
     if(HUDManager.RemainingTime() > SoundConstants.HURRYUPTIME)
         overworld = new MarioOverworldTheme();
     else
         overworld = new RushedOverworldTheme();
     overworld.PlayTheme();
 }
コード例 #16
0
ファイル: MusicViewer.cs プロジェクト: Sorcha/SD-Trabalho1
        public MusicViewer(IMusic music)
        {
            InitializeComponent();
            _music = music;

            artistsList.Items.AddRange(_music.GetArtists().ToArray());
            musicName.Text = _music.Name;
        }
コード例 #17
0
 public MusicViewModel(IMusic m)
 {
     music = m;
     if (m.Logo != null)
     {
         m.Logo = m.Logo.Replace("_1.jpg", ".jpg");
     }
 }
コード例 #18
0
 public static string Get(this IMusic m, params string[] props)
 {
     if (m == null)
     {
         return(null);
     }
     return(Get(m.JsonObject, props));
 }
コード例 #19
0
ファイル: MusicViewer.cs プロジェクト: Sorcha/SD-Trabalho1
        public MusicViewer(IMusic music)
        {
            InitializeComponent();
            _music = music;

            artistsList.Items.AddRange(_music.GetArtists().ToArray());
            musicName.Text = _music.Name;
        }
コード例 #20
0
    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;
    }
コード例 #21
0
        public void AddFile(string file)
        {
            IMusic temp = MusicFactory.GetMusic(new FileInfo(file), control);

            if (temp != null)
            {
                FileList.Add(temp);
            }
        }
コード例 #22
0
        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);
        }
コード例 #23
0
        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);
                }
            }
        }
コード例 #24
0
ファイル: PlayerList.cs プロジェクト: naisev/WeMusic
 /// <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;
         }
     }
 }
コード例 #25
0
 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();
 }
コード例 #26
0
 public static void PlayStarTheme()
 {
     GetPreviousTheme();
     StopAllBackgroundThemes();
     if (HUDManager.RemainingTime() > SoundConstants.HURRYUPTIME)
         starMan = new StarTheme();
     else
         starMan = new RushedStarTheme();
     starMan.PlayTheme();
 }
コード例 #27
0
ファイル: MusicInfoModel.cs プロジェクト: naisev/WeMusic
 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;
 }
コード例 #28
0
 /// <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();
     }
 }
コード例 #29
0
        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));
        }
コード例 #30
0
        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;
                }
            });
        }
コード例 #31
0
ファイル: MusicPlayer.cs プロジェクト: pzaps/CrossGFX
        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();
            }
        }
コード例 #32
0
        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));
        }
コード例 #33
0
ファイル: Default.aspx.cs プロジェクト: alexandercessac/Lib
        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)));
        }
コード例 #34
0
ファイル: Default.aspx.cs プロジェクト: alexandercessac/Lib
        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)));
        }
コード例 #35
0
        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));
        }
コード例 #36
0
        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);
                }
            }
        }
コード例 #37
0
ファイル: ID3.cs プロジェクト: scbj/musixx
        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);
            }
        }
コード例 #38
0
 public static void PlayBuckeyeOverworldTheme()
 {
     StopAllBackgroundThemes();
     buckeyeOverworld = new BuckeyeOverworldTheme();
     buckeyeOverworld.PlayTheme();
 }
コード例 #39
0
 public static void PlayFlagPoleVictoryTheme()
 {
     StopAllBackgroundThemes();
     flagPoleVictory = new FlagPoleVictoryTheme();
     flagPoleVictory.PlayTheme();
 }
コード例 #40
0
 public static void PlayIntroTheme()
 {
     StopAllBackgroundThemes();
     intro = new IntroTheme();
     intro.PlayTheme();
 }
コード例 #41
0
ファイル: Music.cs プロジェクト: hsmasud/markovmusic
 public bool IsTagMatches(IMusic music, IMusicTag tag)
 {
     return this[tag.Id] != string.Empty && music[tag.Id] != string.Empty && this[tag.Id] == music[tag.Id];
 }
コード例 #42
0
 public static void PlayPacManEndTheme()
 {
     StopAllBackgroundThemes();
     pacEndTheme = new PacMarioEndTheme();
     pacEndTheme.PlayTheme();
 }
コード例 #43
0
 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;
 }
コード例 #44
0
 public MusicViewModel(IMusic m)
 {
     music = m;
     if (m.Logo != null)
         m.Logo = m.Logo.Replace("_1.jpg", ".jpg");
 }
コード例 #45
0
 public static void PlayPacManLevelTheme()
 {
     StopAllBackgroundThemes();
     pacLevel = new PacManLevelTheme();
     pacLevel.PlayTheme();
 }
コード例 #46
0
 public static void PlayPacMarioDeathTheme()
 {
     StopAllBackgroundThemes();
     pacDeath = new PacMarioDeadTheme();
     pacDeath.PlayTheme();
 }
コード例 #47
0
ファイル: MusicPlayer.cs プロジェクト: pzaps/CrossGFX
 public void Crossfade(IMusic music, int length)
 {
     throw new NotImplementedException();
 }
コード例 #48
0
 public MusicInPlayList(IMusic music)
 {
     _music = music;
 }
コード例 #49
0
ファイル: MusicLibrary.cs プロジェクト: hsmasud/markovmusic
 public void Add(IMusic music)
 {
     _store.Add(music);
     AllMusicPlayList.Add(music.Id);
 }
コード例 #50
0
 public bool IsTagMatches(IMusic music, IMusicTag musicTag)
 {
     return _music.IsTagMatches(music, musicTag);
 }
コード例 #51
0
ファイル: MusicPlayer.cs プロジェクト: pzaps/CrossGFX
        public void Play(IMusic music)
        {
            currentSong = music as Music;

            currentSong.SFMusic.Play();
        }
コード例 #52
0
ファイル: MusicPlayer.cs プロジェクト: pzaps/CrossGFX
 public void Play(IMusic music)
 {
     throw new NotImplementedException();
 }
コード例 #53
0
 public static void PlayDeathTheme()
 {
     StopAllBackgroundThemes();
     death = new DeathTheme();
     death.PlayTheme();
 }
コード例 #54
0
ファイル: MusicStore.cs プロジェクト: hsmasud/markovmusic
 public void Add(IMusic music)
 {
     _adapter.OpenDatabase();
     _adapter.ExecuteNonQuery(string.Format(Constants.Sql.InsertMusic, music.Id, music.Priority));
     _adapter.Close();
 }
コード例 #55
0
 public static void PlayCarmenTheme()
 {
     StopAllBackgroundThemes();
     carmen = new CarmenTheme();
     carmen.PlayTheme();
 }
コード例 #56
0
 public MusicViewModel(IMusic m)
 {
     music = m;
 }