// // Stereo.cs // // Author: // Jacob Johnston (jacobj@inchoatethoughts.com) // // Copyright (C) 2009 Jacob Johnston // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as // published by the Free Software Foundation, either version 3 of // the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . using System.IO; namespace ZenLibrary.RuleBase { /// /// This rule checks to see if the MP3 Header indicates /// the file is stereo. /// class Stereo : Rule { public override string Name { get { return "File Is Stereo"; } } public override TestType TestType { get { return TestType.FileScan; } } public override RuleTestResult RunTest(DirectoryInfo directoryInfo, FileInfo fileInfo) { RuleTestResult result = new RuleTestResult(); TagLib.File file = TagLib.File.Create(fileInfo.FullName); result = new RuleTestResult(); if (file.Properties.AudioChannels == 2) { result.TestPassed = true; } else { result.TestPassed = false; result.ResultPath = fileInfo.FullName; result.RuleTestFailedString = string.Format("The file \"{0}\" is not streo.", result.ResultPath); } return result; } } }