예제 #1
0
		public MusicInfo(string key, MiniYaml value)
		{
			Title = value.Value;

			var nd = value.ToDictionary();
			if (nd.ContainsKey("Hidden"))
				bool.TryParse(nd["Hidden"].Value, out Hidden);

			var ext = nd.ContainsKey("Extension") ? nd["Extension"].Value : "aud";
			Filename = (nd.ContainsKey("Filename") ? nd["Filename"].Value : key) + "." + ext;
		}
예제 #2
0
		public MusicInfo( string key, MiniYaml value )
		{
			Title = value.Value;

			var nd = value.ToDictionary();
			var ext = nd.ContainsKey("Extension") ? nd["Extension"].Value : "aud";
			Filename = (nd.ContainsKey("Filename") ? nd["Filename"].Value : key)+"."+ext;
			if (!GlobalFileSystem.Exists(Filename))
				return;

			Exists = true;
			using (var s = GlobalFileSystem.Open(Filename))
				Length = (int)AudLoader.SoundLength(s);
		}
예제 #3
0
        public MusicInfo(string key, MiniYaml value)
        {
            Title = value.Value;

            var nd = value.ToDictionary();
            if (nd.ContainsKey("Hidden"))
                bool.TryParse(nd["Hidden"].Value, out Hidden);

            var ext = nd.ContainsKey("Extension") ? nd["Extension"].Value : "aud";
            Filename = (nd.ContainsKey("Filename") ? nd["Filename"].Value : key) + "." + ext;

            if (!GlobalFileSystem.Exists(Filename))
                return;

            Exists = true;
            using (var s = GlobalFileSystem.Open(Filename))
            {
                if (Filename.ToLowerInvariant().EndsWith("wav"))
                    Length = (int)WavLoader.WaveLength(s);
                else
                    Length = (int)AudLoader.SoundLength(s);
            }
        }