示例#1
0
 public void Interrupt(Songs p_song)
 {
     this.audio.Stop();
     this.audio = new Audio(Utility.FindMediaFile(@"\Music\" + p_song.ToString() + ".mp3"));
     this.audio.Volume = -500;
     this.interupted = true;
 }
示例#2
0
        public static string GetPropertyTypeLink(int vidID)
        {
            var sngs = new Songs();

            sngs.GetSongsForVideo(vidID);

            var sb = new StringBuilder();

            var sp = new SongProperty();

            foreach (Song sng in sngs)
            {
                sp = new SongProperty();

                sp.GetSongPropertySongIDTypeID(sng.SongID, SPropType.IT.ToString());

                if (string.IsNullOrEmpty(sp.PropertyContent)) continue;

                sb.AppendFormat(@"<a target=""_blank"" class=""info"" href=""{0}"">", sp.PropertyContent);
                sb.Append(sng.Name);
                sb.Append(@"</a>");
            }

            return HttpUtility.HtmlEncode(sb.ToString().Trim());
        }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            lblname.Text = Session["name"].ToString();

            loadedSongs = Main.getSongs();
            //Session["loadedSongs"] = loadedSongs;

            GvSongs.DataSource = loadedSongs;
            GvSongs.DataBind();
        }
示例#4
0
        private static Songs fillSongsFromSQLDataReader(SqlDataReader reader)
        {
            Songs allSongs = new Songs();
            Song oneSong = new Song();
            oneSong.TrackID = reader.GetString(0);
            oneSong.AlbumID = reader.GetString(1);
            oneSong.InterpretID = reader.GetString(2);
            oneSong.titel = reader.GetString(3);

            allSongs.Add(oneSong);
            return allSongs;
        }
示例#5
0
 private static void old()
 {
     var s1 = new Song { Name = "titla?dfe<>", ArtistName = "afe", AlbumName = "sfef3", AlbumId = "1231", Id = "122" };
     var s2 = new Song { Name = "feafd", ArtistName = "afe", AlbumName = "sfef3", AlbumId = "1231", Id = "122" };
     var songs = new Songs { s1, s2 };
     PersistHelper.Save(songs, "songs.xml");
     var a = PersistHelper.Load<Songs>("songs.xml");
     foreach(var song in a)
     {
         System.Console.WriteLine(song.Name);
     }
     System.Console.ReadKey();
 }
示例#6
0
        static void Main(string[] args)
        {
            Cd info = new Cd();

            //Songs
            // create an object from Persons 
            Cd album = new Cd(); // hypätään Persons luokan sisälle

            // create a few friends.. // Person luokka
            Cd song1 = new Cd { Artist = "Nightwish",Album = "Endless Forms Most Beautiful ", };
            Songs song2 = new Songs { };
         

            // add persons to collection
            info.Album.
            myFriends.AddPerson(person1);
            myFriends.AddPerson(person2);
            myFriends.AddPerson(person3);
        }
示例#7
0
 // Gets each video in the child folders
 private static void DirSearch(Shell32.Folder sDir)
 {
     // Goes through each folder
     foreach (Shell32.FolderItem2 item in sDir.Items())
     {
         // Finds each file in folder
         string type = (string)item.ExtendedProperty("Type");
         if (type.ToLower().Contains("folder"))
         {
             DirSearch(shell.NameSpace(sDir.GetDetailsOf(item, 180)));
         } else
         {
             if (type.ToLower().Contains("mp3"))
             {
                 Songs w = new Songs((string)item.ExtendedProperty("Name"), sDir.GetDetailsOf(item, 21));
                 windowsSongs.Add(w);
                 //Debug.WriteLine("Title: {0}\n Name: {1}\n Ext: {2}\n\n", sDir.GetDetailsOf(item, 21), (string)item.ExtendedProperty("Name"), (string)item.ExtendedProperty("Type"));
             }
         }
     }
 }
示例#8
0
 public virtual SongInAlbum GetSongByTrackNum(int discNum, int trackNum)
 {
     return(Songs.FirstOrDefault(s => s.DiscNumber == discNum && s.TrackNumber == trackNum));
 }
示例#9
0
        private void GetArtistProfile(Artist art, Videos vids)
        {
            // photo
            var aprop = new ArtistProperty();
            aprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.PH.ToString());

            if (!string.IsNullOrEmpty(aprop.PropertyContent))
            {
                ViewBag.ArtistPhoto = VirtualPathUtility.ToAbsolute(aprop.PropertyContent);
                ViewBag.ThumbIcon = VirtualPathUtility.ToAbsolute(aprop.PropertyContent);
            }

            // meta descriptione
            aprop = new ArtistProperty();
            aprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.MD.ToString());
            if (!string.IsNullOrEmpty(aprop.PropertyContent)) ViewBag.MetaDescription = aprop.PropertyContent;

            // description
            aprop = new ArtistProperty();
            aprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.LD.ToString());
            if (!string.IsNullOrEmpty(aprop.PropertyContent))
                ViewBag.ArtistDescription = ContentLinker.InsertBandLinks(aprop.PropertyContent, false);

            var sngss = new Songs();

            sngss.GetSongsForArtist(art.ArtistID);

            foreach (Song sn1 in sngss)
            {
                vids.GetVideosForSong(sn1.SongID);
            }
        }
示例#10
0
 public Ratings GetYourRating(Songs s, ISession session)
 {
     return((Ratings)session.QueryOver <Ratings>().Where(x => x.Songs_Id == s && x.Users_Id == loggedUser).List <Ratings>().FirstOrDefault());
 }
示例#11
0
 /// <summary>
 /// There are no comments for Songs in the schema.
 /// </summary>
 public void AddToSongs(Songs songs)
 {
     base.AddObject("Songs", songs);
 }
示例#12
0
 void LoadAlbumSongs(Album album)
 {
     Songs.AddRange(album.AlbumSongs);
 }
示例#13
0
 public void AddSong(Song inSong)
 {
     Songs.Add(inSong);
 }
示例#14
0
        /// <summary>
        /// Gets the songs callback.
        /// </summary>
        /// <param name="requestState">State of the request.</param>
        private void GetSongsCallback(XRequestState requestState)
        {
            var songs = new Songs();

            var query = JObject.Parse(requestState.ResponseData);

            if (XHelpers.CheckResponseForError(query, out mError))
            {
                //error handling needed here
            }
            else
            {
                var result = (JObject)query["result"];

                songs.LoadFromJsonObject(result);

                if (requestState.UserCallback != null)
                    requestState.UserCallback(songs);
            }
        }
示例#15
0
        public ActionResult ProfileDetail(string userName)
        {
            ViewBag.VideoHeight = (Request.Browser.IsMobileDevice) ? 100 : 277;
            ViewBag.VideoWidth = (Request.Browser.IsMobileDevice) ? 225 : 400;

            ua = new UserAccount(userName);

            UserAccountDetail uad = new UserAccountDetail();
            uad.GetUserAccountDeailForUser(ua.UserAccountID);

            uad.BandsSeen = ContentLinker.InsertBandLinks(uad.BandsSeen, false);
            uad.BandsToSee = ContentLinker.InsertBandLinks(uad.BandsToSee, false);

            MembershipUser mu = Membership.GetUser();

            ProfileModel model = new ProfileModel();

            if (ua.UserAccountID > 0)
            {
                model.UserAccountID = ua.UserAccountID;
                model.PhotoCount = PhotoItems.GetPhotoItemCountForUser(ua.UserAccountID);
                model.CreateDate = ua.CreateDate;
            }

            if (mu != null)
            {
                ViewBag.IsBlocked = BlockedUser.IsBlockedUser(ua.UserAccountID, Convert.ToInt32(mu.ProviderUserKey));
                ViewBag.IsBlocking = BlockedUser.IsBlockedUser(Convert.ToInt32(mu.ProviderUserKey), ua.UserAccountID);

                if (ua.UserAccountID == Convert.ToInt32(mu.ProviderUserKey))
                {
                    model.IsViewingSelf = true;
                }
                else
                {
                    UserConnection ucon = new UserConnection();

                    ucon.GetUserToUserConnection(Convert.ToInt32(mu.ProviderUserKey), ua.UserAccountID);

                    model.UserConnectionID = ucon.UserConnectionID;

                    if (BlockedUser.IsBlockedUser(Convert.ToInt32(mu.ProviderUserKey), ua.UserAccountID))
                    {
                        return RedirectToAction("index", "home");
                    }

                }
            }
            else
            {

                if (uad.MembersOnlyProfile)
                {
                    return RedirectToAction("Account", "LogOn");
                }

            }

            //
            model.UserName = ua.UserName;
            model.CreateDate = ua.CreateDate;
            model.LastActivityDate = ua.LastActivityDate;
            //
            model.DisplayAge = uad.DisplayAge;
            model.Age = uad.YearsOld;
            model.BandsSeen = uad.BandsSeen;
            model.BandsToSee = uad.BandsToSee;
            model.HardwareAndSoftwareSkills = uad.HardwareSoftware;
            model.MessageToTheWorld = uad.AboutDescription;

            model.YouAreFull = uad.Sex;
            model.InterestedInFull = uad.InterestedFull;
            model.RelationshipStatusFull = uad.RelationshipStatusFull ;
            model.RelationshipStatus = uad.RelationshipStatus;
            model.InterestedIn = uad.InterestedIn;
            model.YouAre = uad.YouAre;

            model.Website = uad.ExternalURL;
            model.CountryCode = uad.Country;
            model.CountryName = uad.CountryName;
            model.IsBirthday = uad.IsBirthdayToday;
            model.ProfilePhotoMain = uad.FullProfilePicURL;
            model.ProfilePhotoMainThumb = uad.FullProfilePicThumbURL;
            model.DefaultLanguage = uad.DefaultLanguage;

            model.EnableProfileLogging = uad.EnableProfileLogging;
            model.Handed = uad.HandedFull;
            model.RoleIcon = uad.SiteBages;

            //
            StatusUpdate su = new StatusUpdate();
            su.GetMostRecentUserStatus(ua.UserAccountID);

            if (su.StatusUpdateID > 0)
            {
                model.LastStatusUpdate = su.CreateDate;
                model.MostRecentStatusUpdate = su.Message;
            }

            model.ProfileVisitorCount = ProfileLog.GetUniqueProfileVisitorCount(ua.UserAccountID);

            PhotoItems ptiems = new PhotoItems();
            ptiems.GetUserPhotos(ua.UserAccountID);

            if (ptiems.Count > 0)
            {
                ptiems.Sort((PhotoItem x, PhotoItem y) => (y.CreateDate.CompareTo(x.CreateDate)));

                PhotoItems ptiemsDisplay = new PhotoItems();

                int maxPhotos = 8;

                foreach (PhotoItem pitm1 in ptiems)
                {
                    pitm1.UseThumb = true;
                    if (ptiemsDisplay.Count < maxPhotos)
                    {
                        ptiemsDisplay.Add(pitm1);
                    }
                    else break;
                }

                ptiemsDisplay.UseThumb = true;
                ptiemsDisplay.ShowTitle = false;

                model.HasMoreThanMaxPhotos = (ptiems.Count > maxPhotos);
                ptiemsDisplay.IsUserPhoto = true;
                model.PhotoItems = ptiemsDisplay.ToUnorderdList;
            }

            Contents conts = new Contents();

            conts.GetContentForUser(ua.UserAccountID);

            model.NewsCount = conts.Count;

            if (conts.Count > 0)
            {
                conts.Sort((Content x, Content y) => (y.ReleaseDate.CompareTo(x.ReleaseDate)));

                Contents displayContents = new Contents();
                int maxCont = 1;
                int currentCount = 0;
                foreach (Content ccn1 in conts)
                {
                    currentCount++;
                    if (maxCont >= currentCount)
                    {
                        displayContents.Add(ccn1);
                    }
                    else break;
                }

                displayContents.IncludeStartAndEndTags = false;

                model.NewsArticles = displayContents.ToUnorderdList;

            }

            model.MetaDescription = ua.UserName + " " + BootBaronLib.Resources.Messages.Profile + " " + FromDate.DateToYYYY_MM_DD(ua.LastActivityDate);

            // playlist
            BootBaronLib.AppSpec.DasKlub.BOL.Playlist plyst = new Playlist();

            plyst.GetUserPlaylist(ua.UserAccountID);

            if (plyst.PlaylistID > 0 && PlaylistVideos.GetCountOfVideosInPlaylist(plyst.PlaylistID) > 0)
            {
                ViewBag.AutoPlay = plyst.AutoPlay;
                ViewBag.AutoPlayNumber = (plyst.AutoPlay) ? 1 : 0;
                ViewBag.UserPlaylistID = plyst.PlaylistID;
            }

            if (uad.UserAccountID > 0)
            {
                model.Birthday = uad.BirthDate;

                if (uad.ShowOnMapLegal)
                {

                    byte[] myarray2 = Encoding.Unicode.GetBytes(string.Empty);

                    // because of the foreign cultures, numbers need to stay in the English version unless a javascript encoding could be added
                    string currentLang = Utilities.GetCurrentLanguageCode();

                    Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(SiteEnums.SiteLanguages.EN.ToString());
                    Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(SiteEnums.SiteLanguages.EN.ToString());

                    Encoding iso = Encoding.GetEncoding("ISO-8859-1");
                    Encoding utf8 = Encoding.UTF8;

                    model.DisplayOnMap = uad.ShowOnMapLegal;

                    Random rnd = new Random();
                    int offset = rnd.Next(10, 100);

                    SiteStructs.LatLong latlong = GeoData.GetLatLongForCountryPostal(uad.Country, uad.PostalCode);

                    if (latlong.latitude != 0 && latlong.longitude != 0)
                    {
                        model.Latitude = Convert.ToDecimal(latlong.latitude + Convert.ToDouble("0.00" + offset)).ToString();
                        model.Longitude = Convert.ToDecimal(latlong.longitude + Convert.ToDouble("0.00" + offset)).ToString();
                    }
                    else
                    {
                        model.DisplayOnMap = false;
                    }

                    Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(currentLang);
                    Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(currentLang);
                }

                ViewBag.ThumbIcon = uad.FullProfilePicThumbURL;

                LoadCurrentImagesViewBag(uad.UserAccountID);
            }

            ViewBag.UserAccountDetail = uad;
            ViewBag.UserAccount = ua;

            UserConnections ucons = new UserConnections();
            ucons.GetUserConnections(ua.UserAccountID);
            ucons.Shuffle();

            UserAccounts irlContacts = new UserAccounts();
            UserAccounts CyberAssociates = new UserAccounts();
            UserAccount userCon = null;

            foreach (UserConnection uc1 in ucons)
            {
                if (!uc1.IsConfirmed) continue;

                switch (uc1.StatusType)
                {
                    case 'C':
                        if (CyberAssociates.Count >= maxcountusers) continue;

                        if (uc1.ToUserAccountID != ua.UserAccountID)
                        {
                            userCon = new UserAccount(uc1.ToUserAccountID);
                        }
                        else
                        {
                            userCon = new UserAccount(uc1.FromUserAccountID);
                        }
                        CyberAssociates.Add(userCon);
                        break;
                    case 'R':
                        if (irlContacts.Count >= maxcountusers) continue;

                        if (uc1.ToUserAccountID != ua.UserAccountID)
                        {
                            userCon = new UserAccount(uc1.ToUserAccountID);
                        }
                        else
                        {
                            userCon = new UserAccount(uc1.FromUserAccountID);
                        }
                        irlContacts.Add(userCon);
                        break;
                    default:
                        break;
                }
            }

            if (irlContacts.Count > 0)
            {
                model.IRLFriendCount = irlContacts.Count;
            }

            if (CyberAssociates.Count > 0)
            {
                // ViewBag.CyberAssociatesCount = Convert.ToString( CyberAssociates.Count );
                model.CyberFriendCount = CyberAssociates.Count;
            }

            mu = Membership.GetUser();
            UserAccountDetail uadLooker = null;

            if (mu != null)
            {
                uadLooker = new UserAccountDetail();
                uadLooker.GetUserAccountDeailForUser(Convert.ToInt32(mu.ProviderUserKey));
            }

            if (mu != null && ua.UserAccountID > 0 &&
                uadLooker.EnableProfileLogging && uad.EnableProfileLogging)
            {
                ProfileLog pl = new ProfileLog();

                pl.LookedAtUserAccountID = ua.UserAccountID;
                pl.LookingUserAccountID = Convert.ToInt32(mu.ProviderUserKey);

                if (pl.LookingUserAccountID != pl.LookedAtUserAccountID) pl.Create();

                ArrayList al = ProfileLog.GetRecentProfileViews(ua.UserAccountID);

                if (al != null && al.Count > 0)
                {
                    UserAccounts uas = new UserAccounts();

                    UserAccount viewwer = null;

                    foreach (int ID in al)
                    {
                        viewwer = new UserAccount(ID);
                        if (!viewwer.IsLockedOut && viewwer.IsApproved)
                        {
                            if (uas.Count >= maxcountusers) break;

                            uas.Add(viewwer);
                        }
                    }

                   // model.ViewingUsers = uas.ToUnorderdList;
                }
            }

            UserAccountVideos uavs = null;

            if (ua.UserAccountID > 0)
            {
                uavs = new UserAccountVideos();

                uavs.GetRecentUserAccountVideos(ua.UserAccountID, 'F');

                if (uavs.Count > 0)
                {
                    Videos favvids = new Videos();
                    Video f1 = new Video();

                    foreach (UserAccountVideo uav1 in uavs)
                    {
                        f1 = new Video(uav1.VideoID);
                        if (f1.IsEnabled) favvids.Add(f1);
                    }

                    SongRecord sng1 = null;
                    SongRecords sngrcds2 = new SongRecords();

                    foreach (Video v1 in favvids)
                    {
                        sng1 = new SongRecord(v1);
                        sngrcds2.Add(sng1);
                    }

                    sngrcds2.IsUserSelected = true;

                    ViewBag.UserFavorites = sngrcds2.VideosList();//.ListOfVideos();
                }
            }

            // this is either a youtube user or this is a band
            Artist art = new Artist(  );
            art.GetArtistByAltname(userName);

            if (art.ArtistID > 0)
            {
                // try this way for dashers
                model.UserName = art.Name;
            }

            Videos vids = new Videos();
            SongRecords sngrs = new SongRecords();

            if (art.ArtistID == 0)
            {
                vids.GetAllVideosByUser(userName);

                uavs = new UserAccountVideos();
                uavs.GetRecentUserAccountVideos(ua.UserAccountID, 'U');

                Video f2 = null;

                foreach (UserAccountVideo uav1 in uavs)
                {
                    f2 = new Video(uav1.VideoID);

                    if (!vids.Contains(f2)) vids.Add(f2);
                }

                vids.Sort((Video x, Video y) => (y.PublishDate.CompareTo(x.PublishDate)));

                model.UserName = userName;

            }
            else
            {
                // photo
                ArtistProperty aprop = new ArtistProperty();
                aprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.PH.ToString());

                if (!string.IsNullOrEmpty(aprop.PropertyContent))
                {
                    ViewBag.ArtistPhoto = System.Web.VirtualPathUtility.ToAbsolute(aprop.PropertyContent);
                    ViewBag.ThumbIcon = System.Web.VirtualPathUtility.ToAbsolute(aprop.PropertyContent);
                }

                // meta descriptione
                aprop = new ArtistProperty();
                aprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.MD.ToString());
                if (!string.IsNullOrEmpty(aprop.PropertyContent)) ViewBag.MetaDescription = aprop.PropertyContent;

                // description
                aprop = new ArtistProperty();
                aprop.GetArtistPropertyForTypeArtist(art.ArtistID, SiteEnums.ArtistPropertyType.LD.ToString());
                if (!string.IsNullOrEmpty(aprop.PropertyContent)) ViewBag.ArtistDescription = ContentLinker.InsertBandLinks(aprop.PropertyContent, false);

                #region rss
                ///// rss
                //RssResources rssrs = new RssResources();

                //rssrs.GetArtistRssResource(art.ArtistID);

                //if (rssrs.Count > 0)
                //{
                //    RssItems ritems = new RssItems();
                //    RssItems ritemsOUT = new RssItems();

                //    foreach (RssResource rssre in rssrs)
                //    {
                //        ritems.GetTopRssItemsForResource(rssre.RssResourceID);
                //        //ritm = new RssItem(rssre..ArtistID);
                //    }

                //    ritems.Sort((RssItem x, RssItem y) => (y.PubDate.CompareTo(x.PubDate)));

                //    foreach (RssItem ritm in ritems)
                //    {
                //        if (ritemsOUT.Count < 10)
                //        {
                //            ritemsOUT.Add(ritm);
                //        }
                //    }

                //    ViewBag.ArtistNews = ritemsOUT.ToUnorderdList;
                //}
                //else
                //{
                //    ViewBag.ArtistNews = null;
                //}

                //ViewBag.DisplayName = art.DisplayName;
                #endregion

                Songs sngss = new Songs();

                sngss.GetSongsForArtist(art.ArtistID);

                SongRecord snrcd = new SongRecord();

                foreach (Song sn1 in sngss)
                {
                    vids.GetVideosForSong(sn1.SongID);
                }
            }

            vids.Sort(delegate(Video p1, Video p2)
            {
                return p2.PublishDate.CompareTo(p1.PublishDate);
            });

            foreach (BootBaronLib.AppSpec.DasKlub.BOL.Video v1 in vids)
            {
                sngrs.Add(new SongRecord(v1));
            }

            if (mu != null && ua.UserAccountID != Convert.ToInt32(mu.ProviderUserKey))
            {
                UserConnection uc1 = new UserConnection();

                uc1.GetUserToUserConnection(ua.UserAccountID, Convert.ToInt32(mu.ProviderUserKey));

                if (uc1.UserConnectionID > 0)
                {

                    switch (uc1.StatusType)
                    {
                        case 'C':
                            if (uc1.IsConfirmed)
                            {
                                model.IsCyberFriend = true;
                            }
                            else
                            {
                                model.IsWatingToBeCyberFriend = true;
                            }
                            break;
                        case 'R':
                            if (uc1.IsConfirmed)
                            {
                                model.IsRealFriend = true;
                            }
                            else
                            {
                                model.IsWatingToBeRealFriend = true;
                            }
                            break;
                        default:
                            model.IsDeniedCyberFriend = true;
                            model.IsDeniedRealFriend = true;
                            break;
                    }
                }
            }

            if (sngrs == null || sngrs.Count == 0 && art.ArtistID == 0 && ua.UserAccountID == 0)
            {
                // no longer exists
                Response.RedirectPermanent("/");
                return new EmptyResult();
            }

            //sngrs.Sort((SongRecord x, SongRecord y) => (y.cre.CompareTo(x.CreateDate)));

            SongRecords sngDisplay = new SongRecords();

            Video vidToShow = null;

            foreach (SongRecord sr1 in sngrs)
            {
                vidToShow = new Video(sr1.VideoID);

                if (vidToShow.IsEnabled)
                {
                    sngDisplay.Add(sr1);
                }
            }

            model.SongRecords = sngDisplay.VideosList();

            return View(model);
        }
示例#16
0
        private List<Songs> PopulateSongDetails(string html)
        {
            List<Songs> crawledSongList = new List<Songs>();
            HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument();
            htmlDoc.OptionFixNestedTags = true;
            htmlDoc.LoadHtml(html);
            if (htmlDoc.DocumentNode != null)
            {
                HtmlAgilityPack.HtmlNode bodyNode = htmlDoc.DocumentNode.SelectSingleNode("//body");
                if (bodyNode == null)
                {
                    Console.WriteLine("body node is null");
                }
                else
                {
                    var songNodeList = GetSongNodeList(bodyNode);

                    var songs = songNodeList.ChildNodes;

                    foreach (HtmlAgilityPack.HtmlNode song in songs)
                    {
                        var songItem = song.ChildNodes["strong"];//.ch.ch.GetElementWithAttribute(song, "li", "class", "song-wrap");
                        if (songItem != null && !string.IsNullOrEmpty(songItem.InnerText.Trim()))
                        {
                            Songs songObj = new Songs();
                            songObj.Composed = string.Empty;
                            songObj.Courtsey = string.Empty;
                            songObj.Lyrics = string.Empty;
                            songObj.Performer = string.Empty;
                            songObj.Recite = string.Empty;
                            songObj.SongTitle = songItem.InnerText;
                            crawledSongList.Add(songObj);
                        }
                    }
                }
            }

            return crawledSongList;
        }
示例#17
0
        public async Task OnGetAsync()
        {
            Artist = await _context.Artists.FindAsync(ArtistId);

            Songs = await _context.Songs.Where(s => s.ArtistId == ArtistId).ToListAsync();

            CurrentSong = Songs.Any(s => s.Id == SongId) ? Songs.Find(s => s.Id == SongId) : Songs.FirstOrDefault();
        }
        public async Task <Song> LoadSong(int id)
        {
            var song = await Songs.FindAsync(id);

            return(song);
        }
示例#19
0
 public List <Ratings> GetSongRatings(Songs s, ISession session)
 {
     return((List <Ratings>)session.QueryOver <Ratings>().Where(x => x.Songs_Id == s).List <Ratings>());
 }
示例#20
0
        public SongDetails(int song_id)
        {
            InitializeComponent();

            using (var session = NHibernateHelper.OpenSession())
            {
                Binding b = new Binding();
                b.Source = CommentTextBox;
                b.Path   = new PropertyPath("Text.Length");
                b.Mode   = BindingMode.OneWay;
                CharacterCount.SetBinding(TextBlock.TextProperty, b);
                song = db.GetSong(song_id, session);
                SongTitle.Content = song.Title;
                AlbumName.Content = song.Albums_Id?.Title;
                string s = "by ";
                foreach (Artists g in song.artists)
                {
                    s += g.Name + ", ";
                }
                ArtistName.Content = s.Substring(0, s.Length - 2);
                if (song.genres.Count != 0)
                {
                    s = "";
                    foreach (Genres g in song.genres)
                    {
                        s += g.Name + ", ";
                    }

                    Genre.Content = s.Substring(0, s.Length - 2);
                }
                List <Ratings> r = db.GetSongRatings(song, session);
                NumberOfRatings.Text = "(" + r.Count.ToString() + ")";
                if (r.Count != 0)
                {
                    decimal score = 0;

                    foreach (Ratings rating in r)
                    {
                        score += rating.Value;
                    }
                    score            /= r.Count;
                    AverageScore.Text = score.ToString("#.##");
                }
                List <Comments> comments = db.GetSongComments(song, session);
                if (comments.Count != 0)
                {
                    NoCommentsBlock.Visibility = Visibility.Collapsed;
                    foreach (Comments c in comments)
                    {
                        s = c.Users_Id.Username + " " + c.Post_date.ToString().Substring(0, 10) + "\n" + c.Content;
                        CommentsList.Items.Add(s);
                    }
                }

                ratingFromDb = db.GetYourRating(song, session);
                if (ratingFromDb != null)
                {
                    switch (ratingFromDb.Value)
                    {
                    case (1):
                        Rating.CheckBox1.IsChecked = true;
                        break;

                    case (2):
                        Rating.CheckBox1.IsChecked = true;
                        Rating.CheckBox2.IsChecked = true;
                        break;

                    case (3):
                        Rating.CheckBox1.IsChecked = true;
                        Rating.CheckBox2.IsChecked = true;
                        Rating.CheckBox3.IsChecked = true;
                        break;

                    case (4):
                        Rating.CheckBox1.IsChecked = true;
                        Rating.CheckBox2.IsChecked = true;
                        Rating.CheckBox3.IsChecked = true;
                        Rating.CheckBox4.IsChecked = true;
                        break;

                    case (5):
                        Rating.CheckBox1.IsChecked = true;
                        Rating.CheckBox2.IsChecked = true;
                        Rating.CheckBox3.IsChecked = true;
                        Rating.CheckBox4.IsChecked = true;
                        Rating.CheckBox5.IsChecked = true;
                        break;
                    }
                }
            }
        }
示例#21
0
        private void LoadVideo(string videoKey)
        {
            ClearInput();

            try
            {
                vid = new Video("YT", videoKey);

                litVideo.Text =
                    string.Format(
                        @"<iframe width=""425"" height=""349"" src=""http://www.youtube.com/embed/{0}"" frameborder=""0"" allowfullscreen></iframe>",
                        vid.ProviderKey);

                txtSecondsIn.Text = vid.Intro.ToString();
                txtElasedEnd.Text = vid.LengthFromStart.ToString();
                ddlVideoProvider.SelectedValue = vid.ProviderCode;
                chkEnabled.Checked = vid.IsEnabled;
                ddlVolumeLevel.SelectedValue = vid.VolumeLevel.ToString();
                lblVideoID.Text = vid.VideoID.ToString();

                if (vid.VolumeLevel == 0)
                {
                    ddlVolumeLevel.SelectedValue = "5";
                    chkEnabled.Checked = true;
                }

                var video = new Google.YouTube.Video();

                try
                {
                    var yousettings = new YouTubeRequestSettings("Das Klub", devkey);

                    var yourequest = new YouTubeRequest(yousettings);
                    var url = new Uri("http://gdata.youtube.com/feeds/api/videos/" + videoKey);

                    video = yourequest.Retrieve<Google.YouTube.Video>(url);
                    txtDuration.Text = video.YouTubeEntry.Duration.Seconds;
                }
                catch (GDataRequestException)
                {
                    vid.IsEnabled = false;
                    vid.Update();
                    litVideo.Text = string.Empty;
                    return;
                }

                if (vid.LengthFromStart == 0)
                {
                    txtElasedEnd.Text = video.YouTubeEntry.Duration.Seconds;
                }

                if (vid.LengthFromStart == 0)
                {
                    txtDuration.Text = video.YouTubeEntry.Duration.Seconds;
                }

                txtUserName.Text = video.Uploader;
                lblVideoID.Text = vid.VideoID.ToString();
                txtVideoKey.Text = video.VideoId;

                // vid type
                propTyp = new PropertyType(SiteEnums.PropertyTypeCode.VIDTP);
                mp = new MultiProperty(vid.VideoID, propTyp.PropertyTypeID, SiteEnums.MultiPropertyType.VIDEO);
                mps = new MultiProperties(propTyp.PropertyTypeID);
                mps.Sort(delegate(MultiProperty p1, MultiProperty p2) { return p1.Name.CompareTo(p2.Name); });
                ddlVideoType.DataSource = mps;
                ddlVideoType.DataTextField = "name";
                ddlVideoType.DataValueField = "multiPropertyID";
                ddlVideoType.DataBind();
                ddlVideoType.Items.Insert(0, new ListItem(selectText));
                if (mp.MultiPropertyID != 0)
                    ddlVideoType.SelectedValue = mp.MultiPropertyID.ToString();

                // human
                propTyp = new PropertyType(SiteEnums.PropertyTypeCode.HUMAN);
                mp = new MultiProperty(vid.VideoID, propTyp.PropertyTypeID, SiteEnums.MultiPropertyType.VIDEO);
                mps = new MultiProperties(propTyp.PropertyTypeID);
                mps.Sort(delegate(MultiProperty p1, MultiProperty p2) { return p1.Name.CompareTo(p2.Name); });
                ddlHumanType.DataSource = mps;
                ddlHumanType.DataTextField = "name";
                ddlHumanType.DataValueField = "multiPropertyID";
                ddlHumanType.DataBind();
                ddlHumanType.Items.Insert(0, new ListItem(selectText));
                if (mp.MultiPropertyID != 0)
                    ddlHumanType.SelectedValue = mp.MultiPropertyID.ToString();

                // footage
                propTyp = new PropertyType(SiteEnums.PropertyTypeCode.FOOTG);
                mp = new MultiProperty(vid.VideoID, propTyp.PropertyTypeID, SiteEnums.MultiPropertyType.VIDEO);
                mps = new MultiProperties(propTyp.PropertyTypeID);
                mps.Sort(delegate(MultiProperty p1, MultiProperty p2) { return p1.Name.CompareTo(p2.Name); });
                ddlFootageType.DataSource = mps;
                ddlFootageType.DataTextField = "name";
                ddlFootageType.DataValueField = "multiPropertyID";
                ddlFootageType.DataBind();
                ddlFootageType.Items.Insert(0, new ListItem(selectText));
                if (mp.MultiPropertyID != 0)
                    ddlFootageType.SelectedValue = mp.MultiPropertyID.ToString();

                // contest

                var vidInContest = new ContestVideo();

                vidInContest.GetContestVideo(vid.VideoID);

                if (vidInContest.ContestVideoID != 0)
                {
                    ddlContest.SelectedValue = vidInContest.ContestID.ToString();
                }
                else
                    ddlContest.SelectedValue = unknownValue;

                var sngs = new Songs();
                artsngs = new Songs();
                sngs.GetSongsForVideo(vid.VideoID);
                Artist art = null;

                var arts = new Artists();
                arts.GetAll();

                // artists 1
                ddlArtist1.DataSource = arts;
                ddlArtist1.DataTextField = "name";
                ddlArtist1.DataValueField = "name";
                ddlArtist1.DataBind();
                Utilities.General.SortDropDownList(ddlArtist1);
                ddlArtist1.Items.Insert(0, new ListItem(unknownValue));

                // artists 2
                ddlArtist2.DataSource = arts;
                ddlArtist2.DataTextField = "name";
                ddlArtist2.DataValueField = "name";
                ddlArtist2.DataBind();
                Utilities.General.SortDropDownList(ddlArtist2);
                ddlArtist2.Items.Insert(0, new ListItem(unknownValue));

                // artists 3
                ddlArtist3.DataSource = arts;
                ddlArtist3.DataTextField = "name";
                ddlArtist3.DataValueField = "name";
                ddlArtist3.DataBind();
                Utilities.General.SortDropDownList(ddlArtist3);
                ddlArtist3.Items.Insert(0, new ListItem(unknownValue));

                // artists 4
                ddlArtist4.DataSource = arts;
                ddlArtist4.DataTextField = "name";
                ddlArtist4.DataValueField = "name";
                ddlArtist4.DataBind();
                Utilities.General.SortDropDownList(ddlArtist4);
                ddlArtist4.Items.Insert(0, new ListItem(unknownValue));

                // artists 5
                ddlArtist5.DataSource = arts;
                ddlArtist5.DataTextField = "name";
                ddlArtist5.DataValueField = "name";
                ddlArtist5.DataBind();
                Utilities.General.SortDropDownList(ddlArtist5);
                ddlArtist5.Items.Insert(0, new ListItem(unknownValue));

                // artists 6
                ddlArtist6.DataSource = arts;
                ddlArtist6.DataTextField = "name";
                ddlArtist6.DataValueField = "name";
                ddlArtist6.DataBind();
                Utilities.General.SortDropDownList(ddlArtist6);
                ddlArtist6.Items.Insert(0, new ListItem(unknownValue));

                foreach (Song sng in sngs)
                {
                    if (sng.Name == unknownValue || string.IsNullOrEmpty(sng.Name)) continue;

                    // sngrcd.SongDisplay += art.Name + " - " + sng.Name + " " ;

                    if (sng.RankOrder == 0 || sng.RankOrder == 1)
                    {
                        // song 1
                        art = new Artist(sng.ArtistID);
                        ddlArtist1.SelectedValue = art.Name;

                        artsngs = new Songs();
                        artsngs.GetSongsForArtist(art.ArtistID);
                        ddlArtistSongs1.DataSource = artsngs;
                        ddlArtistSongs1.DataTextField = "name";
                        ddlArtistSongs1.DataValueField = "name";
                        ddlArtistSongs1.DataBind();
                        ddlArtistSongs1.Items.Insert(0, new ListItem(unknownValue));
                        Utilities.General.SortDropDownList(ddlArtistSongs1);

                        ddlArtistSongs1.SelectedValue = sng.Name;
                    }
                    else if (sng.RankOrder == 2)
                    {
                        // song 2
                        art = new Artist(sng.ArtistID);
                        ddlArtist2.SelectedValue = art.Name;

                        artsngs = new Songs();
                        artsngs.GetSongsForArtist(art.ArtistID);
                        ddlArtistSongs2.DataSource = artsngs;
                        ddlArtistSongs2.DataTextField = "name";
                        ddlArtistSongs2.DataValueField = "name";
                        ddlArtistSongs2.DataBind();
                        ddlArtistSongs2.Items.Insert(0, new ListItem(unknownValue));
                        Utilities.General.SortDropDownList(ddlArtistSongs2);

                        ddlArtistSongs2.SelectedValue = sng.Name;
                    }
                    else if (sng.RankOrder == 3)
                    {
                        // song 3
                        art = new Artist(sng.ArtistID);
                        ddlArtist3.SelectedValue = art.Name;

                        artsngs = new Songs();
                        artsngs.GetSongsForArtist(art.ArtistID);
                        ddlArtistSongs3.DataSource = artsngs;
                        ddlArtistSongs3.DataTextField = "name";
                        ddlArtistSongs3.DataValueField = "name";
                        ddlArtistSongs3.DataBind();
                        ddlArtistSongs3.Items.Insert(0, new ListItem(unknownValue));
                        Utilities.General.SortDropDownList(ddlArtistSongs3);

                        ddlArtistSongs3.SelectedValue = sng.Name;
                    }
                    else if (sng.RankOrder == 4)
                    {
                        // song 4
                        art = new Artist(sng.ArtistID);
                        ddlArtist4.SelectedValue = art.Name;

                        artsngs = new Songs();
                        artsngs.GetSongsForArtist(art.ArtistID);
                        ddlArtistSongs4.DataSource = artsngs;
                        ddlArtistSongs4.DataTextField = "name";
                        ddlArtistSongs4.DataValueField = "name";
                        ddlArtistSongs4.DataBind();
                        ddlArtistSongs4.Items.Insert(0, new ListItem(unknownValue));
                        Utilities.General.SortDropDownList(ddlArtistSongs4);

                        ddlArtistSongs4.SelectedValue = sng.Name;
                    }
                    else if (sng.RankOrder == 5)
                    {
                        // song 5
                        art = new Artist(sng.ArtistID);
                        ddlArtist5.SelectedValue = art.Name;

                        artsngs = new Songs();
                        artsngs.GetSongsForArtist(art.ArtistID);
                        ddlArtistSongs5.DataSource = artsngs;
                        ddlArtistSongs5.DataTextField = "name";
                        ddlArtistSongs5.DataValueField = "name";
                        ddlArtistSongs5.DataBind();
                        ddlArtistSongs5.Items.Insert(0, new ListItem(unknownValue));
                        Utilities.General.SortDropDownList(ddlArtistSongs5);

                        ddlArtistSongs5.SelectedValue = sng.Name;
                    }
                    else if (sng.RankOrder == 6)
                    {
                        // song 6
                        art = new Artist(sng.ArtistID);
                        ddlArtist6.SelectedValue = art.Name;

                        artsngs = new Songs();
                        artsngs.GetSongsForArtist(art.ArtistID);
                        ddlArtistSongs6.DataSource = artsngs;
                        ddlArtistSongs6.DataTextField = "name";
                        ddlArtistSongs6.DataValueField = "name";
                        ddlArtistSongs6.DataBind();
                        ddlArtistSongs6.Items.Insert(0, new ListItem(unknownValue));
                        Utilities.General.SortDropDownList(ddlArtistSongs6);

                        ddlArtistSongs6.SelectedValue = sng.Name;
                    }
                }

                lblStatus.Text = "OK";
            }
            catch (Exception ex)
            {
                lblStatus.Text = ex.Message;
            }
        }
示例#22
0
 public Album()
 {
     this.Songs = new HashSet <Song>();
     this.Price = Songs.Sum(x => x.Price);
 }
示例#23
0
 public void PlayMusic(Songs song, bool loop)
 {
     if (this.enableMusic)
     {
         if (this.currentSong != null)
         {
             if (song == this.currentSong.Song)
             {
                 return;
             }
             this.currentSong.Stop();
             this.currentSong.Dispose();
         }
         if (song == Songs.None)
         {
             this.currentSong = null;
         }
         else if (loop)
         {
             double num = 0.0;
             double num2 = 0.0;
             string[] strArray = ReadTextFileLine("Info.musicinfo.txt", song.ToString(), true).Split(new char[] { ',' });
             NumberFormatInfo provider = new NumberFormatInfo {
                 NumberDecimalSeparator = "."
             };
             num = double.Parse(strArray[1], provider);
             num2 = double.Parse(strArray[0], provider);
             this.currentSong = new Music(song, num2, num);
         }
         else
         {
             this.currentSong = new Music(song, 0.0, 0.0);
         }
     }
 }
示例#24
0
 /// <summary>
 /// Sorts Titles by Name
 /// </summary>
 private void TitleSort()
 {
     Songs = new ObservableCollection <AudioTrack>(Songs.OrderBy(s => s.Title));
 }
示例#25
0
 private void Init(Songs p_song, double p_end, double p_loop)
 {
     this.song = p_song;
     this.musicFile = Utility.FindMediaFile(@"\Music\" + this.song.ToString() + ".mp3");
     this.audio = new Audio(this.musicFile);
     this.audio.Volume = -500;
     this.loopPosition = p_loop;
     this.endPosition = p_end;
     if (this.endPosition == 0.0)
     {
         this.endPosition = this.audio.Duration;
     }
 }
示例#26
0
 /// <summary>
 /// Sorts Titles by Artist
 /// </summary>
 private void ArtistSort()
 {
     Songs = new ObservableCollection <AudioTrack>(Songs.OrderBy(s => s.Artist));
 }
示例#27
0
        public bool LoadMap(string filename, bool loadTiles, bool loadObjects)
        {
            this.mapFilename = filename.Substring(filename.LastIndexOf('\\') + 1);
            if (GameEngine.Framework.UsingExternalMaps)
            {
                filename = GameEngine.Framework.GetMapFolder() + this.mapFilename;
            }
            else
            {
                filename = "Maps." + filename.ToLower();
            }
            string tileSet = "";
            this.yOffset = 0;
            this.alternatePalette = false;
            int fromIndex = 0;
            string[] lines = GameEngine.ReadTextFile(filename, !GameEngine.Framework.UsingExternalMaps, !GameEngine.Framework.UsingExternalMaps);
            if (lines == null)
            {
                return false;
            }
            if (loadObjects)
            {
                this.objects.Clear();
                this.gameObjects.Clear();
                this.doors.Clear();
                this.objects.Add(this.player);
                this.gameObjects.Add(this.player);
            }
            GameEngine.Game.BaseDifficulty = 1;
            string[] strArray2 = GameEngine.GetSaveFileSegment(lines, "LEVELDATA", 0);
            foreach (string str2 in strArray2)
            {
                string[] strArray3 = str2.Split(new char[] { '=' });
                switch (strArray3[0])
                {
                    case "alternatePalette":
                        this.alternatePalette = bool.Parse(strArray3[1]);
                        goto Label_0357;

                    case "tileset":
                        tileSet = strArray3[1];
                        if (!this.alternatePalette)
                        {
                            goto Label_024E;
                        }
                        if (this.mapFilename.IndexOf("SKYDUNGEON") != 0)
                        {
                            break;
                        }
                        this.tileTexture = new GameTexture(tileSet + ".bmp", TileSize, ColorSwaps.SkyNormal, ColorSwaps.SkyAlternate, TextureDisposePolicy.DisposeOnTileChange);
                        goto Label_0357;

                    case "music":
                        this.song = Utility.ParseSongString(strArray3[1]);
                        GameEngine.Framework.PlayMusic(this.song);
                        goto Label_0357;

                    case "skycolor":
                    {
                        string[] strArray4 = strArray3[1].Split(new char[] { ',' });
                        base.BackColor = Color.FromArgb(0xff, int.Parse(strArray4[0]), int.Parse(strArray4[1]), int.Parse(strArray4[2]));
                        this.skyColor = base.BackColor;
                        goto Label_0357;
                    }
                    case "liquid":
                        if (!strArray3[1].Equals(SurfaceType.LavaSurface.ToString()))
                        {
                            goto Label_0306;
                        }
                        this.liquidSurface = SurfaceType.LavaSurface;
                        goto Label_0357;

                    case "tremor":
                        this.castleTremor = bool.Parse(strArray3[1]);
                        if (this.castleTremor)
                        {
                            this.flashColor = Color.Red;
                        }
                        goto Label_0357;

                    case "mapdifficulty":
                        GameEngine.Game.BaseDifficulty = int.Parse(strArray3[1]);
                        goto Label_0357;

                    case "yoffset":
                        this.yOffset = int.Parse(strArray3[1]);
                        goto Label_0357;

                    default:
                        goto Label_0357;
                }
                this.tileTexture = new GameTexture(tileSet + ".bmp", TileSize, ColorSwaps.CaveNormal, ColorSwaps.CaveAlternate, TextureDisposePolicy.DisposeOnTileChange);
                goto Label_0357;
            Label_024E:
                this.tileTexture = new GameTexture(tileSet + ".bmp", TileSize, TextureDisposePolicy.DisposeOnTileChange);
                goto Label_0357;
            Label_0306:
                this.liquidSurface = SurfaceType.WaterSurface;
            Label_0357:;
            }
            if (loadTiles)
            {
                fromIndex += strArray2.Length;
                string[] strArray5 = GameEngine.GetSaveFileSegment(lines, "MAP", fromIndex);
                fromIndex += strArray5.Length;
                string[] strArray6 = GameEngine.GetSaveFileSegment(lines, "MAP", fromIndex);
                fromIndex += strArray6.Length;
                string[] foredata = GameEngine.GetSaveFileSegment(lines, "MAP", fromIndex);
                this.tileMap = new TileMap(this.tileTexture, strArray5, strArray6, foredata);
            }
            if (loadObjects)
            {
                string[] strArray9 = GameEngine.GetSaveFileSegment(lines, "OBJECTS", 0)[1].Split(new char[] { ';' });
                for (int i = 0; i < strArray9.Length; i++)
                {
                    string[] strArray10 = strArray9[i].Split(new char[] { ' ' });
                    if (strArray10.Length > 1)
                    {
                        if (strArray10[0].Equals("Door"))
                        {
                            Door item = new Door(int.Parse(strArray10[2]), Utility.ParseDoorTypeString(strArray10[5]), this.mapFilename);
                            Point point = Utility.ParsePointString(strArray10[1]);
                            item.Location = new PointF((float) point.X, (float) point.Y);
                            item.DestinationDoor = int.Parse(strArray10[3]);
                            item.DestinationMap = strArray10[4];
                            item.ObjClass = ObjectClass.Door;
                            if (strArray10.Length > 6)
                            {
                                item.IsWaterTransition = bool.Parse(strArray10[6]);
                            }
                            if (strArray10.Length > 7)
                            {
                                item.Flipped = bool.Parse(strArray10[7]);
                            }
                            this.objects.Insert(0, item);
                            this.doors.Add(item);
                        }
                        else if (strArray10[0].Equals("PrizeBlock"))
                        {
                            string str3 = "";
                            if (strArray10.Length > 2)
                            {
                                str3 = strArray10[2];
                            }
                            DragonTrap.PrizeBlock block = new DragonTrap.PrizeBlock(str3, this.mapFilename);
                            Point point2 = Utility.ParsePointString(strArray10[1]);
                            block.Location = new PointF((float) point2.X, (float) point2.Y);
                            this.objects.Add(block);
                        }
                        else if (strArray10[0].Equals("FallingBlock"))
                        {
                            FallingBlockTrigger playerOn = FallingBlockTrigger.PlayerOn;
                            if (strArray10[3].Equals("PlayerNear"))
                            {
                                playerOn = FallingBlockTrigger.PlayerNear;
                            }
                            if (strArray10[3].Equals("PlayerHit"))
                            {
                                playerOn = FallingBlockTrigger.PlayerHit;
                            }
                            if (strArray10[3].Equals("PlayerOn"))
                            {
                                playerOn = FallingBlockTrigger.PlayerOn;
                            }
                            FallingBlock block2 = new FallingBlock(this.mapFilename, playerOn, int.Parse(strArray10[2]));
                            Point point3 = Utility.ParsePointString(strArray10[1]);
                            block2.Location = new PointF((float) (point3.X * 0x10), (float) (point3.Y * 0x10));
                            this.objects.Add(block2);
                        }
                        else if (strArray10[0].Equals("Treasure"))
                        {
                            Point point4 = Utility.ParsePointString(strArray10[1]);
                            PointF tf = new PointF((float) point4.X, (float) point4.Y);
                            Direction left = Direction.Left;
                            if (strArray10.Length > 4)
                            {
                                left = Utility.ParseDirectionString(strArray10[4]);
                            }
                            TreasureChest chest = new TreasureChest(int.Parse(strArray10[2]), strArray10[3].Split(new char[] { ':' }), this.mapFilename, left) {
                                Location = tf
                            };
                            this.objects.Add(chest);
                        }
                        else if (strArray10[0].Equals("Generator"))
                        {
                            Point point5 = Utility.ParsePointString(strArray10[1]);
                            PointF tf2 = new PointF((float) point5.X, (float) point5.Y);
                            EnemyGenerator generator = new EnemyGenerator(Utility.ParseObjectTypeString(strArray10[2]), Utility.ParseColorSwapString(strArray10[3]), int.Parse(strArray10[4])) {
                                Location = tf2
                            };
                            this.objects.Add(generator);
                        }
                        else if (strArray10[0].Equals("ExplosionGenerator"))
                        {
                            Point point6 = Utility.ParsePointString(strArray10[1]);
                            PointF tf3 = new PointF((float) point6.X, (float) point6.Y);
                            ExplosionPoint point7 = new ExplosionPoint(100, 10) {
                                Location = tf3
                            };
                            this.objects.Add(point7);
                        }
                        else
                        {
                            ObjectType t = Utility.ParseObjectTypeString(strArray10[0]);
                            ColorSwaps normal = ColorSwaps.Normal;
                            int delay = 0;
                            if (strArray10.Length > 2)
                            {
                                normal = Utility.ParseColorSwapString(strArray10[2]);
                            }
                            if (strArray10.Length > 5)
                            {
                                delay = int.Parse(strArray10[5]);
                            }
                            GameObject obj2 = ObjectFactory.CreateObjectOfType(t, normal, Utility.ParseDirectionString(strArray10[3]), strArray10[4], delay);
                            Point point8 = Utility.ParsePointString(strArray10[1]);
                            obj2.Location = new PointF((float) point8.X, (float) point8.Y);
                            this.objects.Add(obj2);
                            this.gameObjects.Add(obj2);
                        }
                    }
                }
            }
            this.InitSpecialTiles(tileSet);
            if (!this.castleTremor)
            {
                if (this.mapFilename.ToUpper().Equals("SKYFALL.TXT"))
                {
                    this.tileMap.ScrollBackground = true;
                    this.castleTremor = true;
                    this.flashColor = Color.Black;
                    this.skyColor = Color.Black;
                }
                else
                {
                    this.castleTremor = false;
                    this.tileMap.ScrollBackground = false;
                }
            }
            return true;
        }
示例#28
0
 /// <summary>
 /// Sorts Titles by BPM
 /// </summary>
 private void BPMSort()
 {
     Songs = new ObservableCollection <AudioTrack>(Songs.OrderBy(s => s.BPM));
 }
示例#29
0
 /// <summary>
 /// Gets the next free track number for a particular disc on this album.
 /// </summary>
 /// <param name="discNum">Disc number, starting from 1.</param>
 /// <returns>Next free track number on the specified disc, starting from 1.</returns>
 public virtual int GetNextTrackNumber(int discNum)
 {
     return(Songs.Any(s => s.DiscNumber == discNum)
                         ? Songs.Where(s => s.DiscNumber == discNum).Max(s => s.TrackNumber) + 1 : 1);
 }
示例#30
0
 public Audio(int t)
 {
     songs = new Songs();
     sounds = new Sounds();
 }
示例#31
0
        public virtual bool HasSong(Song song)
        {
            ParamIs.NotNull(() => song);

            return(Songs.Any(a => song.Equals(a.Song)));
        }
示例#32
0
 /// <summary>
 /// add song to db
 /// </summary>
 /// <param name="song">Song object</param>
 public void add(Songs song)
 {
     dBContext.songs.Add(song);
     dBContext.SaveChanges();
 }
示例#33
0
        public static async Task <bool> Execute()
        {
            Group.UpdateAllies();

            if (Core.Me.IsCasting)
            {
                return(true);
            }

            if (await Casting.TrackSpellCast())
            {
                return(true);
            }

            await Casting.CheckForSuccessfulCast();

            Globals.InParty       = PartyManager.IsInParty;
            Globals.PartyInCombat = Globals.InParty && Utilities.Combat.Enemies.Any(r => r.TaggerType == 2);
            Utilities.Routines.Bard.RefreshVars();

            if (!Core.Me.HasTarget || !Core.Me.CurrentTarget.ThoroughCanAttack())
            {
                return(false);
            }

            if (await CustomOpenerLogic.Opener())
            {
                return(true);
            }

            if (BotManager.Current.IsAutonomous)
            {
                if (Core.Me.HasTarget)
                {
                    Movement.NavigateToUnitLos(Core.Me.CurrentTarget, 20);
                }
            }

            if (await PhysicalDps.SecondWind(BardSettings.Instance))
            {
                return(true);
            }
            if (await Buff.NaturesMinne())
            {
                return(true);
            }
            if (await Dispel.Execute())
            {
                return(true);
            }

            if (await Dot.IronJaws())
            {
                return(true);
            }
            if (await Buff.BattleVoice())
            {
                return(true);
            }
            if (await Buff.RagingStrikes())
            {
                return(true);
            }
            if (await SingleTarget.RefulgentBarrage())
            {
                return(true);
            }
            if (await SingleTarget.StraightShot())
            {
                return(true);
            }
            if (await SingleTarget.EmpyrealArrow())
            {
                return(true);
            }
            if (await SingleTarget.PitchPerfect())
            {
                return(true);
            }

            if (Utilities.Routines.Bard.OnGcd)
            {
                if (await Songs.Sing())
                {
                    return(true);
                }
                if (await SingleTarget.SidewinderAndShadowbite())
                {
                    return(true);
                }
                if (await Aoe.RainOfDeath())
                {
                    return(true);
                }
                if (await SingleTarget.Bloodletter())
                {
                    return(true);
                }
                if (await SingleTarget.RepellingShot())
                {
                    return(true);
                }
                if (await SingleTarget.Feint())
                {
                    return(true);
                }
            }

            if (await Aoe.ApexArrow())
            {
                return(true);
            }
            if (await Aoe.QuickNock())
            {
                return(true);
            }
            if (await Dot.Windbite())
            {
                return(true);
            }
            if (await Dot.VenomousBite())
            {
                return(true);
            }
            if (await Dot.DotMultipleTargets())
            {
                return(true);
            }
            return(await SingleTarget.HeavyShot());
        }
示例#34
0
 /// <summary>
 /// update song in db
 /// </summary>
 /// <param name="song">song</param>
 public void update(Songs song)
 {
     dBContext.songs.Attach(song);
     dBContext.Entry(song).State = System.Data.Entity.EntityState.Modified;
     dBContext.SaveChanges();
 }
示例#35
0
 /// <summary>
 /// Create a new Songs object.
 /// </summary>
 /// <param name="ID">Initial value of Id.</param>
 public static Songs CreateSongs(int ID)
 {
     Songs songs = new Songs();
     songs.Id = ID;
     return songs;
 }
示例#36
0
 //Metodos para agregar a las listas playlist/cantantes
 public void AddFavSong(Songs song)
 {
     FavSong.Add(song);
 }
示例#37
0
    void Start()
    {
        moduleId = moduleIdCounter++;
        int u = Rnd.Range(0, songs.Count);

        selectedSong = songs[u];
        Debug.LogFormat("[Lyrical Nonsense #{0}], The song selected is {1}", moduleId, selectedSong.Song);
        Buttons[0].OnInteract += delegate
        {
            if (textChange != null)
            {
                StopCoroutine(textChange);
            }
            if (songCycle != null)
            {
                StopCoroutine(songCycle);
            }
            if (idle1)
            {
                Displays[0].text = "";
                Displays[1].text = "";
                textChange       = ChangeText1();
                StartCoroutine(textChange);
                Audio.PlaySoundAtTransform(selectedSong.SongParts[Rnd.Range(0, 3)], Buttons[0].transform);
                idle1 = false;
            }
            else
            {
                songSelect++;
                songSelect      %= 18;
                Displays[0].text = "";
                Displays[1].text = "";
                songCycle        = ChangeSongs(songSelect);
                StartCoroutine(songCycle);
            }
            return(false);
        };
        Buttons[1].OnInteract += delegate
        {
            if (idle1)
            {
                return(false);
            }
            if (textChange != null)
            {
                StopCoroutine(textChange);
            }
            if (songCycle != null)
            {
                StopCoroutine(songCycle);
            }
            Displays[0].text = "";
            Displays[1].text = "";
            textChange       = ChangeText1();
            StartCoroutine(textChange);
            Audio.PlaySoundAtTransform(selectedSong.SongParts[Rnd.Range(0, 3)], Buttons[0].transform);
            return(false);
        };
        Buttons[2].OnInteract += delegate
        {
            Submitting(); return(false);
        };
    }
示例#38
0
            public void Cal()
            {
                Dictionary <string, Songs> song = new Dictionary <string, Songs>();

                string[] part           = Console.ReadLine().Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries);
                string[] availableSongs = Console.ReadLine().Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries);

                while (true)
                {
                    string command = Console.ReadLine();
                    if (command == "dawn")
                    {
                        break;
                    }
                    string[] comm     = command.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries);
                    string   partname = comm[0];
                    string   songName = comm[1];
                    string   award    = comm[2];
                    Songs    op       = new Songs();
                    op.Participant = partname;
                    op.Song        = songName;
                    op.Ward        = award;
                    op.SongList    = new List <string>();
                    op.AwardsList  = new List <string>();
                    if (part.Contains(op.Participant))
                    {
                        if (!song.ContainsKey(op.Participant))
                        {
                            if (availableSongs.Contains(op.Song))
                            {
                                op.NumberOfWards += 1;
                                op.SongList.Add(op.Song);
                                op.AwardsList.Add(op.Ward);

                                song.Add(op.Participant, op);
                            }
                        }
                        else
                        {
                            for (int i = 0; i < song.Count; i++)
                            {
                                if (song.ContainsKey(op.Participant))
                                {
                                    if (availableSongs.Contains(op.Song))
                                    {
                                        KeyValuePair <string, Songs> songPath = song.ElementAt(i);
                                        if (songPath.Key == op.Participant)
                                        {
                                            if (!songPath.Value.SongList.Contains(op.Song))
                                            {
                                                songPath.Value.SongList.Add(op.Song);
                                                if (!songPath.Value.AwardsList.Contains(op.Ward))
                                                {
                                                    songPath.Value.AwardsList.Add(op.Ward);
                                                    songPath.Value.NumberOfWards += 1;
                                                }
                                            }
                                            else if (songPath.Value.SongList.Contains(op.Song))
                                            {
                                                if (!songPath.Value.AwardsList.Contains(op.Ward))
                                                {
                                                    songPath.Value.AwardsList.Add(op.Ward);
                                                    songPath.Value.NumberOfWards += 1;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                if (song.Count > 0)
                {
                    foreach (var p in song.OrderByDescending(r => r.Value.NumberOfWards).ThenBy(r => r.Key))
                    {
                        Console.WriteLine($"{p.Key}: {p.Value.NumberOfWards} awards");
                        p.Value.AwardsList.Sort();
                        foreach (var k in p.Value.AwardsList)
                        {
                            Console.WriteLine($"--{k}");
                        }
                    }
                }
                else
                {
                    Console.WriteLine("No awards");
                }
            }
示例#39
0
 public List <Comments> GetSongComments(Songs s, ISession session)
 {
     return((List <Comments>)session.QueryOver <Comments>().Where(x => x.Songs_Id == s).List <Comments>());
 }
示例#40
0
 private void Delete()
 {
     Songs.Remove(SelectedSong);
     SaveSongs();
 }
示例#41
0
 protected void ddlArtist6_SelectedIndexChanged(object sender, EventArgs e)
 {
     artsngs = new Songs();
     artst = new Artist(ddlArtist5.SelectedValue);
     artsngs.GetSongsForArtist(artst.ArtistID);
     ddlArtistSongs6.DataSource = artsngs;
     ddlArtistSongs6.DataTextField = "name";
     ddlArtistSongs6.DataValueField = "name";
     ddlArtistSongs6.DataBind();
     ddlArtistSongs6.Items.Insert(0, new ListItem(unknownValue));
     Utilities.General.SortDropDownList(ddlArtistSongs6);
 }
示例#42
0
 public void AddSong(Song song) => Songs.Enqueue(song);
示例#43
0
        public List<Songs> GetSongDetails(HtmlNode body)
        {
            var listNode = helper.GetElementWithAttribute(body, "div", "id", "soundtracks_content");

            List<Songs> songs = new List<Songs>();
            if (listNode != null)
            {
                var nodes = listNode.Elements("div");
                foreach (HtmlNode node in nodes)
                {
                    if (node.Attributes["class"] != null && node.Attributes["class"].Value == "list")
                    {
                        var songItems = node.Elements("div");

                        if (songItems != null)
                        {
                            foreach (HtmlNode song in songItems)
                            {
                                Songs songDetail = new Songs();
                                string title, lyrics, composer, performer, recite, courtsey;

                                GetSongDetails(song, out title, out lyrics, out composer, out performer, out recite, out courtsey);
                                songDetail.SongTitle = Cleanse(title);
                                songDetail.Lyrics = Cleanse(lyrics);
                                songDetail.Composed = Cleanse(composer);
                                songDetail.Performer = Cleanse(performer);
                                songDetail.Recite = Cleanse(recite);
                                songDetail.Courtsey = Cleanse(courtsey);

                                if (!title.Contains("It looks like we don't have any Soundtracks for this title yet."))
                                {
                                    songs.Add(songDetail);
                                }
                            }
                        }
                    }
                }
            }

            return songs;
        }
示例#44
0
 private void RemoveSong()
 {
     Songs.RemoveAt(SelectedSongIndex);
     SelectedSongIndex = -1;
 }
示例#45
0
 public void PlayMusic(Songs song)
 {
     this.PlayMusic(song, true);
 }
示例#46
0
 public bool AddNew(Songs song, string insertuser)
 {
     return(SongsDAL.AddNew(song, insertuser));
 }
示例#47
0
 public void AddSong(Song song)
 {
     Songs.Add((uint)(Songs.Keys.Count + 1), song);
 }
示例#48
0
        public AlbumDetailsContract(Album album, ContentLanguagePreference languagePreference, IUserPermissionContext userContext, IEntryThumbPersister thumbPersister,
                                    IEntryImagePersister imageStoreOld, Func <Song, SongVoteRating?> getSongRating = null)
            : base(album, languagePreference)
        {
            ArtistLinks = album.Artists.Select(a => new ArtistForAlbumContract(a, languagePreference)).OrderBy(a => a.Name).ToArray();
            CanEditPersonalDescription = EntryPermissionManager.CanEditPersonalDescription(userContext, album);
            CanRemoveTagUsages         = EntryPermissionManager.CanRemoveTagUsages(userContext, album);
            Description     = album.Description;
            Discs           = album.Songs.Any(s => s.DiscNumber > 1) ? album.Discs.Select(d => new AlbumDiscPropertiesContract(d)).ToDictionary(a => a.DiscNumber) : new Dictionary <int, AlbumDiscPropertiesContract>(0);
            OriginalRelease = (album.OriginalRelease != null ? new AlbumReleaseContract(album.OriginalRelease, languagePreference) : null);
            Pictures        = album.Pictures.Select(p => new EntryPictureFileContract(p, imageStoreOld)).ToArray();
            PVs             = album.PVs.Select(p => new PVContract(p)).ToArray();
            Songs           = album.Songs
                              .OrderBy(s => s.DiscNumber).ThenBy(s => s.TrackNumber)
                              .Select(s => new SongInAlbumContract(s, languagePreference, false, rating: getSongRating?.Invoke(s.Song)))
                              .ToArray();
            Tags     = album.Tags.ActiveUsages.Select(u => new TagUsageForApiContract(u, languagePreference)).OrderByDescending(t => t.Count).ToArray();
            WebLinks = album.WebLinks.Select(w => new WebLinkContract(w)).OrderBy(w => w.DescriptionOrUrl).ToArray();

            PersonalDescriptionText = album.PersonalDescriptionText;
            var author = album.PersonalDescriptionAuthor;

            PersonalDescriptionAuthor = author != null ? new ArtistForApiContract(author, languagePreference, thumbPersister, true, ArtistOptionalFields.MainPicture) : null;

            TotalLength = Songs.All(s => s.Song != null && s.Song.LengthSeconds > 0) ? TimeSpan.FromSeconds(Songs.Sum(s => s.Song.LengthSeconds)) : TimeSpan.Zero;
        }
示例#49
0
 public AsyncArtist(IFileWriter writer)
 {
     Writer = writer;
     Songs = new Songs();
 }
示例#50
0
        public AlbumDisc(int discNumber, IEnumerable <SongInAlbumContract> songs, AlbumDiscPropertiesContract discProperties)
        {
            DiscNumber = discNumber;
            Songs      = songs.ToArray();

            IsVideo     = discProperties != null && discProperties.MediaType == DiscMediaType.Video;
            Name        = discProperties != null ? discProperties.Name : null;
            TotalLength = Songs.All(s => s.Song != null && s.Song.LengthSeconds > 0) ? TimeSpan.FromSeconds(Songs.Sum(s => s.Song.LengthSeconds)) : TimeSpan.Zero;
        }
示例#51
0
 public Music(Songs p_song, double p_end, double p_loop)
 {
     this.Init(p_song, p_end, p_loop);
 }
示例#52
0
        private void UCWindowOverlay_Load(object sender, EventArgs e)
        {
            if (BLLocalDatabase.Setting.Settings == null)
            {
                Settings set = new Settings();
                set.PopupType  = popupType;
                set.StickyForm = 0;
                set.EnableHourBeforeReminder = 1;
                set.EnableReminderCountPopup = 1;
                set.EnableQuickTimer         = 1;
                BLLocalDatabase.Setting.UpdateSettings(set);
            }

            if (BLLocalDatabase.Setting.Settings.PopupType == "AlwaysOnTop")
            {
                cbPopupType.SelectedItem = cbPopupType.Items[0];
            }
            else if (BLLocalDatabase.Setting.Settings.PopupType == "Minimized")
            {
                cbPopupType.SelectedItem = cbPopupType.Items[1];
            }
            else if (BLLocalDatabase.Setting.Settings.PopupType == "SoundOnly")
            {
                cbPopupType.SelectedItem = cbPopupType.Items[2];
            }

            cbRemindMeMessages.Checked          = BLLocalDatabase.Setting.IsReminderCountPopupEnabled();
            cbOneHourBeforeNotification.Checked = BLLocalDatabase.Setting.IsHourBeforeNotificationEnabled();
            cbQuicktimer.Checked        = BLLocalDatabase.Setting.Settings.EnableQuickTimer == 1;
            cbAdvancedReminders.Checked = BLLocalDatabase.Setting.Settings.EnableAdvancedReminders == 1;

            Hotkeys timerKey   = BLLocalDatabase.Hotkey.TimerPopup;
            Hotkeys timerCheck = BLLocalDatabase.Hotkey.TimerCheck;

            foreach (string m in timerKey.Modifiers.Split(','))
            {
                tbTimerHotkey.Text += m + " + ";
            }
            tbTimerHotkey.Text += timerKey.Key;

            foreach (string m in timerCheck.Modifiers.Split(','))
            {
                tbCheckTimerHotKey.Text += m + " + ";
            }
            tbCheckTimerHotKey.Text += timerCheck.Key;

            //Fill the combobox to select a timer popup sound with data
            FillSoundCombobox();
            //Set the item the user selected as text
            string def = BLLocalDatabase.Setting.Settings.DefaultTimerSound;

            if (def == null) //User has no default sound combobox
            {
                foreach (ComboBoxItem itm in cbSound.Items)
                {
                    if (itm.Text.ToLower().Contains("unlock")) //Set the default timer sound to windows unlock
                    {
                        Songs    sng = (Songs)itm.Value;
                        Settings set = BLLocalDatabase.Setting.Settings;
                        set.DefaultTimerSound = sng.SongFilePath;
                        BLLocalDatabase.Setting.UpdateSettings(set);
                    }
                }
            }
            if (BLLocalDatabase.Setting.Settings.DefaultTimerSound == null)//Still null? well damn.
            {
                return;
            }

            cbSound.Items.Add(new ComboBoxItem(Path.GetFileNameWithoutExtension(BLLocalDatabase.Setting.Settings.DefaultTimerSound), BLLocalDatabase.Song.GetSongByFullPath(BLLocalDatabase.Setting.Settings.DefaultTimerSound)));
            cbSound.Text = Path.GetFileNameWithoutExtension(BLLocalDatabase.Setting.Settings.DefaultTimerSound);
        }
示例#53
0
 public void UpdateMap(string texture, Songs p_song, int newWidth, int newHeight, int p_difficulty, int p_yOffset, bool alternateColors)
 {
     this.yOffset = p_yOffset;
     GameEngine.Game.BaseDifficulty = p_difficulty;
     this.song = p_song;
     GameEngine.Framework.PlayMusic(this.song);
     if (!alternateColors)
     {
         this.tileTexture = new GameTexture(texture, TileSize, TextureDisposePolicy.DisposeOnTileChange);
     }
     else
     {
         this.tileTexture = new GameTexture(texture, TileSize, ColorSwaps.CaveNormal, ColorSwaps.CaveAlternate, TextureDisposePolicy.DisposeOnTileChange);
     }
     this.tileMap.UpdateTexture(this.tileTexture);
     this.alternatePalette = alternateColors;
     this.tileMap.UpdateSize(newWidth, newHeight);
 }
        /// <summary>
        /// Checks if its possible to login depending on the given username and password and saves the logged in user to a list
        /// </summary>
        /// <param name="obj"></param>
        private void LoginExecute(object obj)
        {
            bool   found         = false;
            bool   foundUsername = false;
            string password      = (obj as PasswordBox).Password;

            for (int i = 0; i < UserList.Count; i++)
            {
                if (User.Username == UserList[i].Username && password == UserList[i].UserPassword)
                {
                    LoggedUser.CurrentUser = new tblUser
                    {
                        UserID       = UserList[i].UserID,
                        Username     = UserList[i].Username,
                        UserPassword = UserList[i].UserPassword
                    };

                    InfoLabel = "Logged in";
                    found     = true;
                    Songs song = new Songs();
                    view.Close();
                    song.Show();
                    break;
                }
            }

            if (found == false)
            {
                for (int i = 0; i < UserList.Count; i++)
                {
                    if (User.Username == UserList[i].Username)
                    {
                        InfoLabel     = "Username already exists";
                        foundUsername = true;
                        break;
                    }
                }

                if (foundUsername == false)
                {
                    if (password == validation.PasswordChecker(password))
                    {
                        InfoLabel         = "Logged in";
                        User.UserPassword = password;
                        service.AddUser(User);
                        UserList.Add(User);

                        LoggedUser.CurrentUser = new tblUser
                        {
                            UserID       = User.UserID,
                            Username     = User.Username,
                            UserPassword = User.UserPassword
                        };

                        Songs song = new Songs();
                        view.Close();
                        song.Show();
                    }
                    else
                    {
                        InfoLabel = "Wrong Username or Password";
                    }
                }
            }
        }
示例#55
0
        protected void ddlArtist1_SelectedIndexChanged(object sender, EventArgs e)
        {
            artsngs = new Songs();
            artst = new Artist(ddlArtist1.SelectedValue);
            artsngs.GetSongsForArtist(artst.ArtistID);
            ddlArtistSongs1.DataSource = artsngs;
            ddlArtistSongs1.DataTextField = "name";
            ddlArtistSongs1.DataValueField = "name";
            ddlArtistSongs1.DataBind();
            ddlArtistSongs1.Items.Insert(0, new ListItem(unknownValue));
            Utilities.General.SortDropDownList(ddlArtistSongs1);

            txtAmazonLink.Text = string.Empty;
            txtiTunesLink.Text = string.Empty;
        }
示例#56
0
        /// <summary>
        /// Gets the file specified by a <see cref="SongBackground"/> instance.
        /// The background's IsImage property must be <c>true</c>.
        /// </summary>
        /// <param name="background">The background to get the file for.</param>
        /// <returns>The background file.</returns>
        public BackgroundStorageEntry GetFile(Songs.SongBackground background)
        {
            if (!background.IsFile)
                throw new ArgumentException("background is not a file");

            return GetFile("/" + background.FilePath.Replace('\\', '/'));
        }