Changeset 3
- Timestamp:
- 10/26/08 15:59:45 (4 weeks ago)
- Location:
- trunk
- Files:
-
- 8 added
- 14 modified
- 10 moved
-
AddInViews/AudioModel.AddInViews/AudioInvalidException.cs (moved) (moved from trunk/AddInViews/AudioModel.AddInViews/InvalidAudioException.cs) (1 diff, 1 prop)
-
AddInViews/AudioModel.AddInViews/AudioModel.AddInViews.csproj (modified) (1 diff)
-
AddInViews/AudioModel.AddInViews/AudioUnsupportedException.cs (moved) (moved from trunk/AddInViews/AudioModel.AddInViews/UnsupportedAudioException.cs) (1 diff, 1 prop)
-
AddIns/WaveAudio/WaveAudio.cs (modified) (2 diffs)
-
AddIns/WaveAudio/WaveReader.cs (modified) (1 diff)
-
AudioModel/AudioInvalidException.cs (moved) (moved from trunk/AudioModel/InvalidAudioException.cs) (1 diff, 1 prop)
-
AudioModel/AudioModel.csproj (modified) (1 diff)
-
AudioModel/AudioUnsupportedException.cs (moved) (moved from trunk/AudioModel/UnsupportedAudioException.cs) (1 diff, 1 prop)
-
AudioModel/CompositeAudioFormat.cs (modified) (3 diffs)
-
DataModel.UnitTests/AddTrackTests.cs (modified) (4 diffs)
-
DataModel.UnitTests/App.config (modified) (1 diff)
-
DataModel.UnitTests/DataModel.UnitTests.csproj (modified) (1 diff)
-
DataModel/DataModel.csproj (modified) (1 diff)
-
DataModel/Track.cs (modified) (3 diffs)
-
DataModel/TrackFactory.cs (modified) (2 diffs)
-
HostSideAdapters/AudioModel.HostSideAdapters/AudioFormatContractToViewAdapter.cs (modified) (1 diff)
-
OmniEncoder.sln (modified) (3 diffs)
-
TagModel (added)
-
TagModel/CompositeTagFormat.cs (added)
-
TagModel/ITag.cs (added)
-
TagModel/ITagFormat.cs (added)
-
TagModel/Properties (added)
-
TagModel/Properties/AssemblyInfo.cs (added)
-
TagModel/TagModel.csproj (added)
-
TestFiles/AudioInvalid00.wav (moved) (moved from trunk/TestFiles/Invalid00.wav) (1 prop)
-
TestFiles/AudioSupported00.wav (moved) (moved from trunk/TestFiles/Supported00.wav) (1 prop)
-
TestFiles/AudioSupported01.wav (moved) (moved from trunk/TestFiles/Supported01.wav) (1 prop)
-
TestFiles/AudioSupported02.wav (moved) (moved from trunk/TestFiles/Supported02.wav) (1 prop)
-
TestFiles/AudioUnsupported00.txt (moved) (moved from trunk/TestFiles/Unsupported00.txt) (1 prop)
-
TestFiles/AudioUnsupported00.wav (moved) (moved from trunk/TestFiles/Unsupported00.wav) (1 prop)
-
TestFiles/FileList.xlsx (modified) (previous)
-
TestFiles/TagSupported00.wav (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/AddInViews/AudioModel.AddInViews/AudioInvalidException.cs
r2 r3 24 24 { 25 25 [Serializable] 26 public class InvalidAudioException : Exception26 public class AudioInvalidException : Exception 27 27 { 28 public InvalidAudioException()28 public AudioInvalidException() 29 29 : base() 30 30 { 31 31 } 32 32 33 public InvalidAudioException(string message)33 public AudioInvalidException(string message) 34 34 : base(message) 35 35 { 36 36 } 37 37 38 public InvalidAudioException(string message, Exception innerException)38 public AudioInvalidException(string message, Exception innerException) 39 39 : base(message, innerException) 40 40 { 41 41 } 42 42 43 protected InvalidAudioException(SerializationInfo info, StreamingContext context)43 protected AudioInvalidException(SerializationInfo info, StreamingContext context) 44 44 : base(info, context) 45 45 { -
trunk/AddInViews/AudioModel.AddInViews/AudioModel.AddInViews.csproj
r2 r3 56 56 <Compile Include="IAudioFormat.cs" /> 57 57 <Compile Include="IAudio.cs" /> 58 <Compile Include=" InvalidAudioException.cs" />58 <Compile Include="AudioInvalidException.cs" /> 59 59 <Compile Include="Properties\AssemblyInfo.cs" /> 60 <Compile Include=" UnsupportedAudioException.cs" />60 <Compile Include="AudioUnsupportedException.cs" /> 61 61 </ItemGroup> 62 62 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
trunk/AddInViews/AudioModel.AddInViews/AudioUnsupportedException.cs
r2 r3 24 24 { 25 25 [Serializable] 26 public class UnsupportedAudioException : Exception26 public class AudioUnsupportedException : Exception 27 27 { 28 public UnsupportedAudioException()28 public AudioUnsupportedException() 29 29 : base() 30 30 { 31 31 } 32 32 33 public UnsupportedAudioException(string message)33 public AudioUnsupportedException(string message) 34 34 : base(message) 35 35 { 36 36 } 37 37 38 public UnsupportedAudioException(string message, Exception innerException)38 public AudioUnsupportedException(string message, Exception innerException) 39 39 : base(message, innerException) 40 40 { 41 41 } 42 42 43 protected UnsupportedAudioException(SerializationInfo info, StreamingContext context)43 protected AudioUnsupportedException(SerializationInfo info, StreamingContext context) 44 44 : base(info, context) 45 45 { -
trunk/AddIns/WaveAudio/WaveAudio.cs
r2 r3 49 49 break; 50 50 default: 51 throw new UnsupportedAudioException("The Wave format '0x" + waveFormatEx.FormatTag.ToString("X", CultureInfo.CurrentCulture) + "' is not supported.");51 throw new AudioUnsupportedException("The Wave format '0x" + waveFormatEx.FormatTag.ToString("X", CultureInfo.CurrentCulture) + "' is not supported."); 52 52 } 53 53 … … 55 55 channels = waveFormatEx.Channels; 56 56 else 57 throw new UnsupportedAudioException(waveFormatEx.Channels + "-channel Wave files are not supported.");57 throw new AudioUnsupportedException(waveFormatEx.Channels + "-channel Wave files are not supported."); 58 58 59 59 bitrate = (int)(waveFormatEx.AvgBytesPerSec * 8); -
trunk/AddIns/WaveAudio/WaveReader.cs
r2 r3 36 36 { 37 37 if (new string(reader.ReadChars(4)) != "RIFF") 38 throw new InvalidAudioException("The file '" + fileName + "' does not contain a RIFF header.");38 throw new AudioInvalidException("The file '" + fileName + "' does not contain a RIFF header."); 39 39 40 40 reader.BaseStream.Seek(4, SeekOrigin.Current); 41 41 42 42 if (new string(reader.ReadChars(4)) != "WAVE") 43 throw new InvalidAudioException("The file '" + fileName + "' is not a Wave file.");43 throw new AudioInvalidException("The file '" + fileName + "' is not a Wave file."); 44 44 } 45 45 catch (EndOfStreamException e) 46 46 { 47 throw new InvalidAudioException("The file '" + fileName + "' is missing data.", e);47 throw new AudioInvalidException("The file '" + fileName + "' is missing data.", e); 48 48 } 49 49 } -
trunk/AudioModel/AudioInvalidException.cs
r2 r3 24 24 { 25 25 [Serializable] 26 public class InvalidAudioException : Exception26 public class AudioInvalidException : Exception 27 27 { 28 public InvalidAudioException()28 public AudioInvalidException() 29 29 : base() 30 30 { 31 31 } 32 32 33 public InvalidAudioException(string message)33 public AudioInvalidException(string message) 34 34 : base(message) 35 35 { 36 36 } 37 37 38 public InvalidAudioException(string message, Exception innerException)38 public AudioInvalidException(string message, Exception innerException) 39 39 : base(message, innerException) 40 40 { 41 41 } 42 42 43 protected InvalidAudioException(SerializationInfo info, StreamingContext context)43 protected AudioInvalidException(SerializationInfo info, StreamingContext context) 44 44 : base(info, context) 45 45 { -
trunk/AudioModel/AudioModel.csproj
r2 r3 54 54 <Compile Include="IAudioFormat.cs" /> 55 55 <Compile Include="IAudio.cs" /> 56 <Compile Include=" InvalidAudioException.cs" />56 <Compile Include="AudioInvalidException.cs" /> 57 57 <Compile Include="Properties\AssemblyInfo.cs" /> 58 <Compile Include=" UnsupportedAudioException.cs" />58 <Compile Include="AudioUnsupportedException.cs" /> 59 59 </ItemGroup> 60 60 <ItemGroup> -
trunk/AudioModel/AudioUnsupportedException.cs
r2 r3 24 24 { 25 25 [Serializable] 26 public class UnsupportedAudioException : Exception26 public class AudioUnsupportedException : Exception 27 27 { 28 public UnsupportedAudioException()28 public AudioUnsupportedException() 29 29 : base() 30 30 { 31 31 } 32 32 33 public UnsupportedAudioException(string message)33 public AudioUnsupportedException(string message) 34 34 : base(message) 35 35 { 36 36 } 37 37 38 public UnsupportedAudioException(string message, Exception innerException)38 public AudioUnsupportedException(string message, Exception innerException) 39 39 : base(message, innerException) 40 40 { 41 41 } 42 42 43 protected UnsupportedAudioException(SerializationInfo info, StreamingContext context)43 protected AudioUnsupportedException(SerializationInfo info, StreamingContext context) 44 44 : base(info, context) 45 45 { -
trunk/AudioModel/CompositeAudioFormat.cs
r2 r3 37 37 List<string> result = new List<string>(); 38 38 39 foreach (IAudioFormat containerin manager.AddIns)40 foreach (string extension in container.Extensions)39 foreach (IAudioFormat format in manager.AddIns) 40 foreach (string extension in format.Extensions) 41 41 if (!result.Contains(extension)) 42 42 result.Add(extension); … … 50 50 string fileExtension = Path.GetExtension(fileName).ToUpperInvariant(); 51 51 52 UnsupportedAudioException priorException = null;52 AudioUnsupportedException priorException = null; 53 53 54 foreach (IAudioFormat containerin manager.AddIns)55 if ( container.Extensions.Contains(fileExtension))54 foreach (IAudioFormat format in manager.AddIns) 55 if (format.Extensions.Contains(fileExtension)) 56 56 { 57 57 try 58 58 { 59 return container.GetAudio(fileName);59 return format.GetAudio(fileName); 60 60 } 61 catch ( UnsupportedAudioException e)61 catch (AudioUnsupportedException e) 62 62 { 63 63 priorException = e; … … 69 69 throw priorException; 70 70 else 71 throw new UnsupportedAudioException("The file '" + fileName + "' is not in a supported audio format.");71 throw new AudioUnsupportedException("The file '" + fileName + "' is not in a supported audio format."); 72 72 } 73 73 -
trunk/DataModel.UnitTests/AddTrackTests.cs
r2 r3 92 92 93 93 [TestMethod] 94 [DataSource(" SupportedFiles")]95 public void AddTracksFor SupportedFiles()94 [DataSource("AudioSupportedFiles")] 95 public void AddTracksForFilesWithSupportedAudio() 96 96 { 97 97 string fileName = testContextInstance.DataRow["FileName"].ToString(); … … 102 102 TimeSpan length = new TimeSpan(0, 0, Convert.ToInt32(testContextInstance.DataRow["Length"])); 103 103 104 // Execute the command. 104 105 AddTrackCommand command = new AddTrackCommand(fileName); 105 106 command.Execute(); 107 Track track = TrackCollection.Instance[fileName]; 106 108 107 Track track = TrackCollection.Instance[fileName];109 // Compare. 108 110 Assert.IsNotNull(track, "The file '" + fileName + "' was not found in the track collection."); 109 Assert.IsNotNull(track.Audio Info, "The file '" + fileName + "' has a null AudioInfo property.");110 Assert.AreEqual<string>(format, track.Audio Info.Format);111 Assert.AreEqual<int>(channels, track.Audio Info.Channels);112 Assert.AreEqual<int>(bitRate, track.Audio Info.Bitrate);113 Assert.AreEqual<int>(sampleRate, track.Audio Info.SampleRate);114 Assert.AreEqual<TimeSpan>(length, track.Audio Info.Length);111 Assert.IsNotNull(track.Audio, "The file '" + fileName + "' has a null AudioInfo property."); 112 Assert.AreEqual<string>(format, track.Audio.Format); 113 Assert.AreEqual<int>(channels, track.Audio.Channels); 114 Assert.AreEqual<int>(bitRate, track.Audio.Bitrate); 115 Assert.AreEqual<int>(sampleRate, track.Audio.SampleRate); 116 Assert.AreEqual<TimeSpan>(length, track.Audio.Length); 115 117 } 116 118 117 119 [TestMethod] 118 [DataSource(" UnsupportedFiles")]119 [ExpectedException(typeof( UnsupportedAudioException))]120 public void AddTracksFor UnsupportedFiles()120 [DataSource("AudioUnsupportedFiles")] 121 [ExpectedException(typeof(AudioUnsupportedException))] 122 public void AddTracksForFilesWithUnsupportedAudio() 121 123 { 122 124 string fileName = testContextInstance.DataRow["FileName"].ToString(); … … 126 128 127 129 [TestMethod] 128 [DataSource(" InvalidFiles")]129 [ExpectedException(typeof( InvalidAudioException))]130 public void AddTracksFor InvalidFiles()130 [DataSource("AudioInvalidFiles")] 131 [ExpectedException(typeof(AudioInvalidException))] 132 public void AddTracksForFilesWithInvalidAudio() 131 133 { 132 134 string fileName = testContextInstance.DataRow["FileName"].ToString(); … … 134 136 command.Execute(); 135 137 } 138 139 [TestMethod] 140 [DataSource("TagSupportedFiles")] 141 public void AddTracksForFilesWithSupportedTags() 142 { 143 string fileName = testContextInstance.DataRow["FileName"].ToString(); 144 string trackNumber = testContextInstance.DataRow["TrackNumber"].ToString(); 145 146 AddTrackCommand command = new AddTrackCommand(fileName); 147 command.Execute(); 148 149 Track track = TrackCollection.Instance[fileName]; 150 Assert.IsNotNull(track.Tag, "The file '" + fileName + "' has a null Tag property."); 151 Assert.AreEqual<int>(Convert.ToInt32(trackNumber), (int)track.Tag["TrackNumber"]); 152 } 136 153 } 137 154 } -
trunk/DataModel.UnitTests/App.config
r2 r3 10 10 <microsoft.visualstudio.testtools> 11 11 <dataSources> 12 <add name="SupportedFiles" connectionString="FileListConnection" dataTableName="Supported$" dataAccessMethod="Sequential"/> 13 <add name="UnsupportedFiles" connectionString="FileListConnection" dataTableName="Unsupported$" dataAccessMethod="Sequential"/> 14 <add name="InvalidFiles" connectionString="FileListConnection" dataTableName="Invalid$" dataAccessMethod="Sequential"/> 12 <add name="AudioSupportedFiles" connectionString="FileListConnection" dataTableName="AudioSupported$" dataAccessMethod="Sequential"/> 13 <add name="AudioUnsupportedFiles" connectionString="FileListConnection" dataTableName="AudioUnsupported$" dataAccessMethod="Sequential"/> 14 <add name="AudioInvalidFiles" connectionString="FileListConnection" dataTableName="AudioInvalid$" dataAccessMethod="Sequential"/> 15 <add name="TagSupportedFiles" connectionString="FileListConnection" dataTableName="TagSupported$" dataAccessMethod="Sequential"/> 15 16 </dataSources> 16 17 </microsoft.visualstudio.testtools> -
trunk/DataModel.UnitTests/DataModel.UnitTests.csproj
r2 r3 53 53 <Project>{08D4BF3C-24E5-4D2D-BE7C-5C09F3DA7D88}</Project> 54 54 <Name>AddInModel</Name> 55 <Private>False</Private> 55 56 </ProjectReference> 56 57 <ProjectReference Include="..\AudioModel\AudioModel.csproj"> 57 58 <Project>{1EFE00B7-0B55-4A02-9C7B-78C8049016F9}</Project> 58 59 <Name>AudioModel</Name> 60 <Private>False</Private> 59 61 </ProjectReference> 60 62 <ProjectReference Include="..\DataModel\DataModel.csproj"> 61 63 <Project>{DDE1CDD5-8D83-4A63-A6E3-DD0863C0FE70}</Project> 62 64 <Name>DataModel</Name> 65 <Private>False</Private> 66 </ProjectReference> 67 <ProjectReference Include="..\TagModel\TagModel.csproj"> 68 <Project>{06D79C17-FC18-4F59-A115-6B1E01E5E32A}</Project> 69 <Name>TagModel</Name> 70 <Private>False</Private> 63 71 </ProjectReference> 64 72 </ItemGroup> -
trunk/DataModel/DataModel.csproj
r2 r3 64 64 <Private>False</Private> 65 65 </ProjectReference> 66 <ProjectReference Include="..\TagModel\TagModel.csproj"> 67 <Project>{06D79C17-FC18-4F59-A115-6B1E01E5E32A}</Project> 68 <Name>TagModel</Name> 69 <Private>False</Private> 70 </ProjectReference> 66 71 </ItemGroup> 67 72 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
trunk/DataModel/Track.cs
r2 r3 19 19 20 20 using OmniEncoder.AudioModel; 21 using OmniEncoder.TagModel; 21 22 22 23 namespace OmniEncoder.DataModel … … 25 26 { 26 27 readonly string fileName; 27 readonly IAudio audioInfo; 28 readonly IAudio audio; 29 readonly ITag tag; 28 30 29 internal Track(string fileName, IAudio audio Info)31 internal Track(string fileName, IAudio audio, ITag tag) 30 32 { 31 33 this.fileName = fileName; 32 this.audioInfo = audioInfo; 34 this.audio = audio; 35 this.tag = tag; 33 36 } 34 37 … … 38 41 } 39 42 40 public IAudio Audio Info43 public IAudio Audio 41 44 { 42 get { return audioInfo; } 45 get { return audio; } 46 } 47 48 public ITag Tag 49 { 50 get { return tag; } 43 51 } 44 52 } -
trunk/DataModel/TrackFactory.cs
r2 r3 19 19 20 20 using OmniEncoder.AudioModel; 21 using OmniEncoder.TagModel; 21 22 22 23 namespace OmniEncoder.DataModel … … 26 27 internal static Track MakeTrack(string fileName) 27 28 { 28 IAudio audioInfo = new CompositeAudioFormat().GetAudio(fileName); 29 return new Track(fileName, audioInfo); 29 IAudio audio = new CompositeAudioFormat().GetAudio(fileName); 30 ITag tag = new CompositeTagFormat().GetTag(fileName); 31 return new Track(fileName, audio, tag); 30 32 } 31 33 } -
trunk/HostSideAdapters/AudioModel.HostSideAdapters/AudioFormatContractToViewAdapter.cs
r2 r3 66 66 { 67 67 // Custom exceptions don't have contracts, so re-throw based on the name. 68 case "OmniEncoder.AudioModel.AddInViews. UnsupportedAudioException":69 throw new UnsupportedAudioException(e.Message, e);70 case "OmniEncoder.AudioModel.AddInViews. InvalidAudioException":71 throw new InvalidAudioException(e.Message, e);68 case "OmniEncoder.AudioModel.AddInViews.AudioUnsupportedException": 69 throw new AudioUnsupportedException(e.Message, e); 70 case "OmniEncoder.AudioModel.AddInViews.AudioInvalidException": 71 throw new AudioInvalidException(e.Message, e); 72 72 73 73 // All other exceptions indicate add-in failure. -
trunk/OmniEncoder.sln
r2 r3 14 14 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestFiles", "TestFiles", "{57261C29-B3B2-4FD0-9C0C-F2B41F6634D6}" 15 15 ProjectSection(SolutionItems) = preProject 16 TestFiles\AudioInvalid00.wav = TestFiles\AudioInvalid00.wav 17 TestFiles\AudioSupported00.wav = TestFiles\AudioSupported00.wav 18 TestFiles\AudioSupported01.wav = TestFiles\AudioSupported01.wav 19 TestFiles\AudioSupported02.wav = TestFiles\AudioSupported02.wav 20 TestFiles\AudioUnsupported00.txt = TestFiles\AudioUnsupported00.txt 21 TestFiles\AudioUnsupported00.wav = TestFiles\AudioUnsupported00.wav 16 22 TestFiles\FileList.xlsx = TestFiles\FileList.xlsx 17 TestFiles\Invalid00.wav = TestFiles\Invalid00.wav 18 TestFiles\Supported00.wav = TestFiles\Supported00.wav 19 TestFiles\Supported01.wav = TestFiles\Supported01.wav 20 TestFiles\Supported02.wav = TestFiles\Supported02.wav 21 TestFiles\Unsupported00.txt = TestFiles\Unsupported00.txt 22 TestFiles\Unsupported00.wav = TestFiles\Unsupported00.wav 23 TestFiles\TagSupported00.wav = TestFiles\TagSupported00.wav 23 24 EndProjectSection 24 25 EndProject … … 48 49 EndProject 49 50 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WaveAudio", "AddIns\WaveAudio\WaveAudio.csproj", "{60743B1C-8EC7-4278-B940-EEB22EAA961D}" 51 EndProject 52 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TagModel", "TagModel\TagModel.csproj", "{06D79C17-FC18-4F59-A115-6B1E01E5E32A}" 50 53 EndProject 51 54 Global … … 99 102 {60743B1C-8EC7-4278-B940-EEB22EAA961D}.Release|Any CPU.ActiveCfg = Release|Any CPU 100 103 {60743B1C-8EC7-4278-B940-EEB22EAA961D}.Release|Any CPU.Build.0 = Release|Any CPU 104 {06D79C17-FC18-4F59-A115-6B1E01E5E32A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 105 {06D79C17-FC18-4F59-A115-6B1E01E5E32A}.Debug|Any CPU.Build.0 = Debug|Any CPU 106 {06D79C17-FC18-4F59-A115-6B1E01E5E32A}.Release|Any CPU.ActiveCfg = Release|Any CPU 107 {06D79C17-FC18-4F59-A115-6B1E01E5E32A}.Release|Any CPU.Build.0 = Release|Any CPU 101 108 EndGlobalSection 102 109 GlobalSection(SolutionProperties) = preSolution -
trunk/TestFiles/AudioInvalid00.wav
-
trunk/TestFiles/AudioSupported00.wav
-
trunk/TestFiles/AudioSupported01.wav
-
trunk/TestFiles/AudioSupported02.wav
-
trunk/TestFiles/AudioUnsupported00.txt
-
trunk/TestFiles/AudioUnsupported00.wav
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)