Exemplo n.º 1
0
		private static MusicData ParseMusicData(IEnumerable<string[]> input)
		{
			var musicData = new MusicData();
			foreach (var result in input)
			{
				switch (result[0])
				{
				case "address": musicData.Address = result[1]; break;
				case "length": musicData.Length = TimeSpan.FromSeconds(double.Parse(result[1], CultureInfo.InvariantCulture)); break;
				case "loop": musicData.Loop = result[1] != "off"; break;
				case "position": musicData.Position = TimeSpan.FromSeconds(double.Parse(result[1], CultureInfo.InvariantCulture)); break;
				case "status": musicData.Status = (MusicStatus)Enum.Parse(typeof(MusicStatus), result[1], true); break;
				case "title": musicData.Title = result[1]; break;
				case "volume": musicData.Volume = double.Parse(result[1], CultureInfo.InvariantCulture); break;
				default: Log.Write(Log.Level.Warning, "Unparsed key: {0}={1}", result[0], result[1]); break;
				}
			}
			return musicData;
		}