当前位置: 首页>>代码示例>>C#>>正文


C# Track类代码示例

本文整理汇总了C#中Track的典型用法代码示例。如果您正苦于以下问题:C# Track类的具体用法?C# Track怎么用?C# Track使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Track类属于命名空间,在下文中一共展示了Track类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateTaskAsync

        private async Task CreateTaskAsync(Track track)
        {
            await _semaphoreSlim.WaitAsync();

            using (var timer = _insightsService.TrackTimeEvent("SongMatched", new Dictionary<string, string>
            {
                {"Title", track.Title},
                {"Artists", track.Artists},
                {"Album", track.AlbumTitle},
                {"Album artist", track.AlbumArtist}
            }))
                try
                {
                    var uri = await _matchEngineService.GetLinkAsync(track.Title, track.DisplayArtist);
                    if (uri != null)
                    {
                        timer.AddProperty("Status", "Found match");
                        track.AudioWebUri = uri.ToString();
                        track.Status = TrackStatus.None;
                        await _downloadService.StartDownloadAsync(track);
                    }
                    else
                    {
                        timer.AddProperty("Status", "No match");
                        track.Status = TrackStatus.NoMatch;
                    }
                    await _libraryService.UpdateTrackAsync(track);
                }
                catch
                {
                    timer.AddProperty("Status", "Error");
                }

            _semaphoreSlim.Release();
        }
开发者ID:haroldma,项目名称:Audiotica,代码行数:35,代码来源:LibraryMatchingService.cs

示例2: TrackPoint

 public TrackPoint(Vector2 position, Track track)
 {
     this.track = track;
     track.Register(this);
     this.position = position;
     id = track.NewId;
 }
开发者ID:peperbol,项目名称:OCDgame,代码行数:7,代码来源:TrackPoint.cs

示例3: CreateXML

        XmlDocument CreateXML(string result, Track[] items = null)
        {
            XmlDocument xmldoc = new XmlDocument();
            XmlDeclaration decl = xmldoc.CreateXmlDeclaration("1.0", "utf-8", null);
            xmldoc.AppendChild(decl);
            XmlNode root = xmldoc.CreateElement("HttpResponse");
            xmldoc.AppendChild(root);
            XmlNode res = xmldoc.CreateElement("Result");
            res.InnerText = result;
            root.AppendChild(res);
            XmlNode args = xmldoc.CreateElement("Params");
            root.AppendChild(args);
            if (items!=null)
            {
                for (int i = 0; i < items.Length; i++)
                {
                    XmlNode node = xmldoc.CreateElement("Song");
                    args.AppendChild(node);

                    XmlNode name = xmldoc.CreateElement("Name");
                    name.InnerText = items[i].Name;
                    XmlNode title = xmldoc.CreateElement("Title");
                    title.InnerText = items[i].Title;
                    XmlNode filestream = xmldoc.CreateElement("FileStream");
                    filestream.InnerText = items[i].FileStream;

                    node.AppendChild(name);
                    node.AppendChild(title);
                    node.AppendChild(filestream);
                }
            }
            return xmldoc;
        }
开发者ID:yanatokareva01,项目名称:ITMO,代码行数:33,代码来源:Program.cs

示例4: getOffsetFromPlace

    Vector3 getOffsetFromPlace(Track.MoveDestination dir)
    {
        Vector3 returnOffset = Vector3.zero;
        GridManager gm = GameObject.FindObjectOfType<GridManager>();

        switch (dir)
        {
            case Track.MoveDestination.FORWARD:
                returnOffset = new Vector3(0f, 0f, gm.gridLength);
                break;
            case Track.MoveDestination.BACKWARD:
                returnOffset = new Vector3(0f, 0f, gm.gridLength * -1.0f);
                break;
            case Track.MoveDestination.WESTLINE:
                returnOffset = getWestLineOffset();
                break;
            case Track.MoveDestination.EASTLINE:
                returnOffset = getEastLineOffset();
                break;
            case Track.MoveDestination.MIDLINE:
                returnOffset = getMidLineOffset();
                break;
            case Track.MoveDestination.NORTHLINE:
                returnOffset = getNorthLineOffset();
                break;
            case Track.MoveDestination.SOUTHLINE:
                returnOffset = getSouthLineOffset();
                break;

        }

        return returnOffset;
    }
开发者ID:Mattys410305,项目名称:Magical-Girl-Shop,代码行数:33,代码来源:MoveOnTrackButtom.cs

示例5: Update

 public void Update(Track track)
 {
     foreach (Particle p in particles)
     {
         p.Move(track);
     }
 }
开发者ID:kbarrett,项目名称:particle-car,代码行数:7,代码来源:ParticleManager.cs

示例6: Agenda

        public ActionResult Agenda(int eventid)
        {
            var tracks = service.GetAgenda(eventid);

            List<Track> model = new List<Track>();

            foreach (var track in tracks)
            {
                Track t = new Track() { ID = track.ID, Name = track.Name, Description = track.Description };

                foreach (var session in track.Sessions.OrderBy((s) => s.StartTime))
                    t.Sessions.Add(new Session()
                                       {
                                           ID = session.ID,
                                           Name = session.Name,
                                           Description = session.Description,
                                           Speaker = session.Speaker,
                                           SpeakerID = session.SpeakerID,
                                           StartTime = session.StartTime.Value.ToShortTimeString(),
                                           EndTime = session.EndTime.Value.ToShortTimeString(),
                                           Location = string.IsNullOrEmpty(session.Location) ? string.Empty : session.Location
                                       });

                model.Add(t);
            }

            return View(model);
        }
开发者ID:cfranciscodev,项目名称:WebSite,代码行数:28,代码来源:HomeController.cs

示例7: UpdateTrack

        protected override void UpdateTrack(Track tbd)
        {
            if (tbd != _Tr)
                return;

            tbd.UpdateTrackOnly(this);
        }
开发者ID:David-Desmaisons,项目名称:MusicCollection,代码行数:7,代码来源:SingleTrackUpdater.cs

示例8: PrintTrack

 public static void PrintTrack(SpotifySession aSession, Track aTrack)
 {
     int duration = aTrack.Duration();
     Console.Write(" {0} ", Track.IsStarred(aSession, aTrack) ? "*" : " ");
     Console.Write("Track {0} [{1}:{2:D02}] has {3} artist(s), {4}% popularity",
         aTrack.Name(),
         duration / 60000,
         (duration / 1000) % 60,
         aTrack.NumArtists(),
         aTrack.Popularity());
     if (aTrack.Disc() != 0)
     {
         Console.Write(", {0} on disc {1}",
             aTrack.Index(),
             aTrack.Disc());
     }
     for (int i = 0; i < aTrack.NumArtists(); ++i)
     {
         var artist = aTrack.Artist(i);
         Console.Write("\tArtist {0}: {1}", i + 1, artist.Name());
     }
     var link = Link.CreateFromTrack(aTrack, 0);
     Console.WriteLine("\t\t{0}", link.AsString());
     link.Release();
 }
开发者ID:bschenk,项目名称:ohLibSpotify,代码行数:25,代码来源:Printing.cs

示例9: Main

        /*[STAThread]
        static void Main() {
            if(!SoundCloudCore.Connect(new Login(user, pass, ClientID, ClientSecret)))
                return;

            var list = new List<int>();
            for(var i = 0; i < Me.LikesCount; i += 10) {
                if(i >= Me.LikesCount)
                    break;
                list = list.Concat(Me.GetLikedTracks(i, 10)).ToList();
                Console.WriteLine("SEARCHING: " + i + "/" + Me.LikesCount);
            }
            Console.WriteLine("COMPLETED: " + list.Count + " / " + Me.LikesCount + "Track info was downloaded");

            // Download all tracks to folder
            foreach(var id in list)
                DownloadTrack(SoundCloudCore.Tracks[id]);
            Directory.Delete("Images", true);
            Console.ReadLine();
        }*/
        static void DownloadTrack(Track track)
        {
            var wc = new WebClient();
            if(!Directory.Exists("Tracks")) Directory.CreateDirectory("Tracks");
            if(!Directory.Exists("Images")) Directory.CreateDirectory("Images");

            var path = "Tracks\\" + track.Title + ".mp3";
            if(System.IO.File.Exists(path)) return;
            try {

                wc.DownloadFile(new Uri(track.StreamUrl), path);

                // Write tag
                if(!System.IO.File.Exists(path)) return;
                var tag = TagLib.File.Create(path);
                tag.Tag.Title = track.Title;
                tag.Tag.BeatsPerMinute = (uint)track.Bpm;
                tag.Tag.Year = (uint)track.Created.Year;
                // Get track cover

                var imgPath = "Images\\" + track.Title + ".jpg";
                wc.DownloadFile(new Uri(track.GetCover(AlbumSize.x300)), imgPath);
                if(System.IO.File.Exists(imgPath)) {
                    var pic = new IPicture[1];
                    pic[0] = new Picture(imgPath);
                    tag.Tag.Pictures = pic;
                }

                // Save tag info
                tag.Save();
                Console.WriteLine("Downloaded track: " + track.Title);
            }
            catch(Exception ex) { Console.WriteLine("Error downloading track: " + track.Title + "; Exception: " + ex.Message); }
        }
开发者ID:jpmckearin,项目名称:SoundStreamer,代码行数:54,代码来源:Program.cs

示例10: PostTracks

 public static Inbox PostTracks(
     SpotifySession session,
     string username,
     Track[] tracks,
     string message,
     InboxPostComplete callback,
     object userdata)
 {
     using (var utf8_username = SpotifyMarshalling.StringToUtf8(username))
     using (var utf8_message = SpotifyMarshalling.StringToUtf8(message))
     using (var track_array = SpotifyMarshalling.ArrayToNativeArray(tracks.Select(x=>x._handle).ToArray()))
     {
         IntPtr listenerToken = ListenerTable.PutUniqueObject(callback, userdata);
         IntPtr ptr = NativeMethods.sp_inbox_post_tracks(
             session._handle,
             utf8_username.IntPtr,
             track_array.IntPtr,
             track_array.Length,
             utf8_message.IntPtr,
             InboxPostCompleteDelegate,
             listenerToken);
         Inbox search = InboxTable.GetUniqueObject(ptr);
         search.ListenerToken = listenerToken;
         return search;
     }
 }
开发者ID:bschenk,项目名称:ohLibSpotify,代码行数:26,代码来源:Inbox.cs

示例11: PlayOrResume

        void PlayOrResume(Track track)
        {
            if (track == null) throw new ArgumentNullException("track");
            if (!CanPlay(track)) return;

            if (!track.Equals(CurrentTrack))
            {
                Stop();
                
                try
                {
                    naudio.OpenFile(track.Filename);
                }
                catch (Exception e)
                {
                    Log.WarnFormat("Unable to play {0}.", track.Filename);
                    Log.Warn(e);
                    return;
                }

                CurrentTrack = track;
                messenger.SendToUI(new PlayerLoadedEvent(track));
            }

            naudio.Play();
        }
开发者ID:rdingwall,项目名称:mixplanner,代码行数:26,代码来源:AudioPlayer.cs

示例12: GetTrack

        static Track GetTrack(ref byte[] arrayToParse, ref LocFile01.Track[] tracks)
        {
            Track track = new Track();
            int cursor = 0;
            int cursor1 = 0;
            // Want a searchable string in which we look for data.
            string parseMe = Encoding.UTF8.GetString(arrayToParse, 0, arrayToParse.Length);

            // 0xFF 52/R 21/! 0D seems to be identifier.
            cursor = parseMe.IndexOf("R!") + 3;
            // Name on GPS is terminated by 0x26/&.
            cursor1 = parseMe.IndexOf("&");
            track.NameOnGps = parseMe.Substring(cursor, cursor1 - cursor);
            cursor1++;
            arrayToParse = Extensions.Right(arrayToParse, cursor1, arrayToParse.Length - cursor1);
            parseMe = Encoding.UTF8.GetString(arrayToParse, 0, arrayToParse.Length);
            cursor = 0;
            // Label on map seems to be terminated by 0x00.
            while (arrayToParse[cursor] != 0x0)
            {
                track.LabelOnMap = track.LabelOnMap + (char)arrayToParse[cursor];
                cursor++;
            }
            cursor++;
            arrayToParse = Extensions.Right(arrayToParse, cursor1, arrayToParse.Length - cursor1);
            // Get rid of eight bytes we don't know what to do with.
            arrayToParse = Extensions.Right(arrayToParse, 8, arrayToParse.Length - 8);
            parseMe = Encoding.UTF8.GetString(arrayToParse, 0, arrayToParse.Length);
            cursor = 0;
            GetTrackPoints(ref arrayToParse, ref track);
            return track;
        }
开发者ID:johnbryanpeters,项目名称:LOC-to-GPX-proto,代码行数:32,代码来源:LocFile01.cs

示例13: AddTrack

 /// <summary>
 /// Adds a track to a channel
 /// </summary>
 /// <param name="file"></param>
 /// <param name="channelId"></param>
 /// <param name="trackName"></param>
 /// <param name="artistName"></param>
 /// <returns></returns>
 public ActionResult AddTrack(HttpPostedFileBase file, int channelId, int? userId, string trackName, string artistName)
 {
     if (userId.HasValue)
     {
         try
         {
             // Verify that the user selected a file
             if (file != null && file.ContentLength > 0)
             {
                 Stream stream = file.InputStream;
                 MemoryStream memory = new MemoryStream();
                 stream.CopyTo(memory);
                 Track track = new Track();
                 track.Artist = artistName;
                 track.Name = trackName;
                 using (RentItServiceClient proxy = new RentItServiceClient())
                 {
                     proxy.AddTrack(userId.Value, channelId, memory);
                 }
             }
         }
         catch (Exception)
         {
         }
         return Redirect(Request.UrlReferrer.PathAndQuery);
     }
     return RedirectToAction("Index", "Home");
 }
开发者ID:markthor,项目名称:RentIt,代码行数:36,代码来源:TrackController.cs

示例14: getAvsCode

 public string getAvsCode(SortedList<String, String[]> fileDetails, Track video, SortedList<String, String> EncOpts)
 {
     ExtApplication filter;
     switch (EncOpts["sharpen"])
     {
         case "1":
             filter = ToolsManager.Instance.getTool("UnFilter");
             if (!filter.isInstalled())
                 filter.download();
             return "UnFilter(20,20)\r\n";
         case "2":
             filter = ToolsManager.Instance.getTool("Toon-v1.0-lite");
             if (!filter.isInstalled())
                 filter.download();
             return "ToonLite(strength=0.75)\r\n";
         case "3":
             filter = ToolsManager.Instance.getTool("aWarpSharp");
             if (!filter.isInstalled())
                 filter.download();
             return "aWarpSharp()\r\n";
         case "4":
             filter = ToolsManager.Instance.getTool("MSharpen");
             if (!filter.isInstalled())
                 filter.download();
             return "MSharpen()\r\n";
         default:
             return "";
     }
 }
开发者ID:NeoBoy,项目名称:MiniCoder,代码行数:29,代码来源:Sharpen.cs

示例15: GetTrackArtistsNames

 public static string GetTrackArtistsNames(Track track)
 {
     var ret = "";
     for (int i = 0; i < track.NumArtists(); i++)
         ret += (i != 0 ? ", " : "") + track.Artist(i).Name();
     return ret;
 }
开发者ID:Jalau11,项目名称:downtify,代码行数:7,代码来源:SpotifyDownloader.cs


注:本文中的Track类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。