本文整理汇总了C#中Track类的典型用法代码示例。如果您正苦于以下问题:C# Track类的具体用法?C# Track怎么用?C# Track使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Track类属于命名空间,在下文中一共展示了Track类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: CPAPointsEx
public static float CPAPointsEx(Vector2 p1, Vector2 v1, Vector2 p2, Vector2 v2, Vector2 p1End, Vector2 p2End,
out Vector2 p1Out, out Vector2 p2Out)
{
Track tr1 = new Track(p1, v1);
Track tr2 = new Track(p2, v2);
float ctime = cpa_time(tr1, tr2);
if (ctime == 0)
{
bool collision;
var collisionTime = MathUtils.GetCollisionTime(p1, p2, v1, v2, 10, 10, out collision);
if (collision)
{
ctime = collisionTime;
}
}
Vector2 P1 = tr1.P0 + (ctime * tr1.V);
Vector2 P2 = tr2.P0 + (ctime * tr2.V);
//P1 = d(p1, P1) > d(p1, p1end) ? p1end : P1;
//P2 = d(p2, P2) > d(p2, p2end) ? p2end : P2;
p1Out = P1;//P1.ProjectOn(p1, p1end).SegmentPoint;//P1;
p2Out = P2;//P2.ProjectOn(p2, p2end).SegmentPoint;
return D(P1, P2);
}
开发者ID:giaanthunder,项目名称:EloBuddy,代码行数:30,代码来源:MathUtilsCPA.cs
示例17: GetMixableTracks
/// <summary>
/// Gets all preferred tracks for the specified track
/// </summary>
/// <param name="track">The track.</param>
/// <returns>A list of tracks in the library the specified track should prefer to mix with</returns>
public List<Track> GetMixableTracks(Track track, int mixLevel)
{
var tracks = new List<Track>();
if (track == null) return tracks;
if (mixLevel == 1)
{
var excludeTracks = new List<Track>();
excludeTracks.Add(track);
excludeTracks.AddRange(GetMixableTracks(track, 0));
excludeTracks.AddRange(GetMixableTracks(track, 2));
excludeTracks.AddRange(GetMixableTracks(track, 3));
excludeTracks.AddRange(GetMixableTracks(track, 4));
excludeTracks.AddRange(GetMixableTracks(track, 5));
var tracksInRange = BassHelper.GetTracksInBPMRange(track.EndBPM, 5M, _library.GetTracks());
return tracksInRange
.Distinct()
.Except(excludeTracks)
.ToList();
}
else
{
foreach (var toTrack in GetMixTracks(track).GetToTracks(mixLevel))
{
var mixableTrack = _library.GetTracks()
.Where(t => t.Description == toTrack.TrackDescription)
.FirstOrDefault();
if (mixableTrack != null) tracks.Add(mixableTrack);
}
}
return tracks;
}
开发者ID:jasonhighet,项目名称:Halloumi.Shuffler,代码行数:39,代码来源:MixLibrary.cs
示例18: Poll
public void Poll()
{
if (!_session.Authenticated)
return;
if (_session != null && _session.Authenticated && _lfmUser != null)
{
var track = _lfmUser.GetNowPlaying();
if (track != null)
{
if (_currentTrack == null || (_currentTrack.GetID() != track.GetID()))
{
var album = track.GetAlbum();
var artist = track.Artist;
if (OnTrackChange != null)
OnTrackChange(this, new LastFmArgs() { Album = (album == null ? "" : album.Title), Artist = (artist == null ? "" : artist.Name), ArtistImage = null, Title = track.Title });
}
_currentTrack = track;
}
}
}
开发者ID:jfarre20,项目名称:Ubiquitous,代码行数:26,代码来源:ULastFm.cs
示例19: Sector
public Sector(int id, int sectorNr, Track track)
{
this.Id = id;
this.SectorNr = sectorNr;
this.Track = track;
this.Blocked = false;
}
开发者ID:Zwerik,项目名称:CODEPANDA5,代码行数:7,代码来源:Sector.cs
示例20: OnInit
public static void OnInit()
{
MacroEx macro = new MacroEx();
WaitForMsg wait = new WaitForMsg(1042635, 1008124, 1008125, 1043297, 1055086, 1055087, 503172, 503171);
macro.Insert(-1, new UseFishingPole(wait));
macro.Insert(-1, new WaitForTargetAction(new[] { "", "2" }));
macro.Insert(-1, new TargetRelLocAction(0, 0));
macro.Insert(-1, new AttackClosestAction());
macro.Insert(-1, new Clean());
Track track = new Track();
macro.Insert(-1, track);
macro.Insert(-1, new WaitForTrack(track));
macro.Insert(-1, new TrackResponse(track));
macro.Insert(-1, wait);
macro.Insert(-1, new SailAction(wait));
Command.Register("fish", args => MacroManager.HotKeyPlay(macro));
Core.AddHotkey("Fishing", () => MacroManager.HotKeyPlay(macro));
MacroEx sos = new MacroEx();
WaitForMsg waitSos = new WaitForMsg(1042635, 1008124, 1008125, 1043297, 1055086, 1055087, 503172, 503171, 501747);
sos.Insert(-1, new UseFishingPole(waitSos));
sos.Insert(-1, new WaitForTargetAction(new[] { "", "2" }));
sos.Insert(-1, new TargetRelLocAction(0, 0));
sos.Insert(-1, waitSos);
sos.Insert(-1, new FoundSOSAction(waitSos));
Command.Register("sos", args => MacroManager.HotKeyPlay(sos));
Core.AddHotkey("SOS", () => MacroManager.HotKeyPlay(sos));
Command.Register("sit", OnCommand);
}
开发者ID:jaryn-kubik,项目名称:RazorEx,代码行数:29,代码来源:Fishing.cs
注:本文中的Track类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论