本文整理汇总了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();
}
示例2: TrackPoint
public TrackPoint(Vector2 position, Track track)
{
this.track = track;
track.Register(this);
this.position = position;
id = track.NewId;
}
示例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;
}
示例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;
}
示例5: Update
public void Update(Track track)
{
foreach (Particle p in particles)
{
p.Move(track);
}
}
示例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);
}
示例7: UpdateTrack
protected override void UpdateTrack(Track tbd)
{
if (tbd != _Tr)
return;
tbd.UpdateTrackOnly(this);
}
示例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();
}
示例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); }
}
示例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;
}
}
示例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();
}
示例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;
}
示例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");
}
示例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 "";
}
}
示例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;
}