/// <summary> /// Загрузка информации со страницы поиска. /// </summary> /// <returns>Возвращает список с элементами из результатов поиска.</returns> private List <TrackOptions> LoadTracksFromSite() { if (pageSearchMuzoFon == null) { pageSearchMuzoFon = new PageSearchMuzoFon(browser); } listArtists = browser.FindElements(pageSearchMuzoFon.TextArtistBy).ToList(); listTracks = browser.FindElements(pageSearchMuzoFon.TextTrackBy).ToList(); listDuration = browser.FindElements(pageSearchMuzoFon.TextDurationBy).ToList(); listDownload = browser.FindElements(pageSearchMuzoFon.IconDownloadBy).ToList(); for (int i = 0; i < listArtists.Count; i++) { TrackOptions trackOptions = new TrackOptions( i, listArtists[i].Text, listTracks[i].Text, listDuration[i].Text, listDownload[i].GetAttribute("href"), "not defined"); listTrackOptions.Add(trackOptions); } return(listTrackOptions); }
public static int Run(TrackOptions options, string[] args) { // Create a new FileSystemWatcher and set its properties. using (FileSystemWatcher watcher = new FileSystemWatcher()) { String path = ""; // figure out message List <string> trimmedArgs = new List <string>(args); trimmedArgs.RemoveAll(s => s.StartsWith("-") || s == "track"); if (trimmedArgs.Count > 0) { path = trimmedArgs.ToArray()[0]; } else { // write out error message ConsoleColor userDefaultColor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Error: No file or directory path provided."); Console.ForegroundColor = userDefaultColor; return(1); } if (!(File.Exists(path) || Directory.Exists(path))) { // write out error message ConsoleColor userDefaultColor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Error: Provided directory/file path does not exist."); Console.ForegroundColor = userDefaultColor; return(2); } watcher.Path = path; watcher.NotifyFilter = NotifyFilters.LastWrite; watcher.Filter = "*.*"; watcher.Changed += new FileSystemEventHandler(OnChanged); // begin watching watcher.EnableRaisingEvents = true; // Wait for the user to quit the program. Console.WriteLine("Press 'q' to stop tracking " + watcher.Path); while (Console.Read() != 'q') { ; } } return(0); }
private String GetTrackValue(short trackOp) { if (TrackOptions != null && TrackOptions.Where(f => f.TrackOption.RowID == trackOp).Count() > 0) { return(TrackOptions.Where(f => f.TrackOption.RowID == trackOp).First().TrackValue); } else { return(""); } }
public void Test_accept_string_icorrect_format2_returned_int_minus1() { //Arange TrackOptions element = new TrackOptions(1, "Шатунов", "Белые розы", "0350", "http://", "001.mp3"); int result = element.TimeStringToInt(element.Duration); //Act int actual = -1; //Assert Assert.AreEqual(actual, result); }
public void Test_accept_string_0000_returned_int_0() { //Arange TrackOptions element = new TrackOptions(1, "Шатунов", "Белые розы", "00:00", "http://", "001.mp3"); int result = element.TimeStringToInt(element.Duration); //Act int actual = 0; //Assert Assert.AreEqual(actual, result); }
Track(Media media, TrackMetadata metadata, TrackOptions options) { this.media = media; this.metadata = metadata; this.options = options; }
public static extern int adl_setTrackOptions(IntPtr device, UIntPtr trackNumber, TrackOptions trackOptions);