- Working on implementing the WindowsMediaLibrary via the WMPLib

- Implemented nearly all classes in the Media namespace side by side with the Windows implementation
- Started adding unit tests to compare the ANX and XNA MediaLibrary behaviour
- Merged the ConvertEquals for PackedVectors to a single method that does the job equally good
This commit is contained in:
SND\AstrorEnales_cp 2012-10-10 10:48:19 +00:00 committed by Konstantin Koch
parent b5d8b48376
commit 9f4369c05d
54 changed files with 945 additions and 1093 deletions

View File

@ -10,27 +10,26 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ANX.Framework.Content.Pipeline</RootNamespace> <RootNamespace>ANX.Framework.Content.Pipeline</RootNamespace>
<AssemblyName>ANX.Framework.Content.Pipeline</AssemblyName> <AssemblyName>ANX.Framework.Content.Pipeline</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>False</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;LINUX;</DefineConstants> <DefineConstants>TRACE;DEBUG;LINUX;</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>True</Optimize>
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;LINUX;</DefineConstants> <DefineConstants>TRACE;LINUX;</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
@ -186,7 +185,9 @@
<Compile Include="Tasks\BuildContent.cs" /> <Compile Include="Tasks\BuildContent.cs" />
<Compile Include="Tasks\BuildItem.cs" /> <Compile Include="Tasks\BuildItem.cs" />
<Compile Include="Tasks\ContentProject.cs" /> <Compile Include="Tasks\ContentProject.cs" />
<Compile Include="Tasks\ImporterConverter.cs" />
<Compile Include="Tasks\ImporterManager.cs" /> <Compile Include="Tasks\ImporterManager.cs" />
<Compile Include="Tasks\ProcessorConverter.cs" />
<Compile Include="Tasks\ProcessorManager.cs" /> <Compile Include="Tasks\ProcessorManager.cs" />
<Compile Include="VideoContent.cs" /> <Compile Include="VideoContent.cs" />
<Compile Include="Serialization\XmlReaderExtensions.cs" /> <Compile Include="Serialization\XmlReaderExtensions.cs" />

View File

@ -14,23 +14,23 @@
<ProjectTypeGuids>{69878862-DA7D-4DC6-B0A1-50D8FAB4242F};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{69878862-DA7D-4DC6-B0A1-50D8FAB4242F};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>False</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;PSVITA;</DefineConstants> <DefineConstants>TRACE;DEBUG;PSVITA;</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>True</Optimize>
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;PSVITA;</DefineConstants> <DefineConstants>TRACE;PSVITA;</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
@ -187,7 +187,9 @@
<Compile Include="Tasks\BuildContent.cs" /> <Compile Include="Tasks\BuildContent.cs" />
<Compile Include="Tasks\BuildItem.cs" /> <Compile Include="Tasks\BuildItem.cs" />
<Compile Include="Tasks\ContentProject.cs" /> <Compile Include="Tasks\ContentProject.cs" />
<Compile Include="Tasks\ImporterConverter.cs" />
<Compile Include="Tasks\ImporterManager.cs" /> <Compile Include="Tasks\ImporterManager.cs" />
<Compile Include="Tasks\ProcessorConverter.cs" />
<Compile Include="Tasks\ProcessorManager.cs" /> <Compile Include="Tasks\ProcessorManager.cs" />
<Compile Include="VideoContent.cs" /> <Compile Include="VideoContent.cs" />
<Compile Include="Serialization\XmlReaderExtensions.cs" /> <Compile Include="Serialization\XmlReaderExtensions.cs" />

View File

@ -16,23 +16,23 @@
<PackageCertificateKeyFile>Test_TemporaryKey.pfx</PackageCertificateKeyFile> <PackageCertificateKeyFile>Test_TemporaryKey.pfx</PackageCertificateKeyFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>False</Optimize>
<OutputPath>bin\Debug\ModernUI</OutputPath> <OutputPath>bin\Debug\ModernUI</OutputPath>
<DefineConstants>TRACE;DEBUG;WINDOWSMETRO;</DefineConstants> <DefineConstants>TRACE;DEBUG;WINDOWSMETRO;</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>True</Optimize>
<OutputPath>bin\Release\ModernUI</OutputPath> <OutputPath>bin\Release\ModernUI</OutputPath>
<DefineConstants>TRACE;WINDOWSMETRO;</DefineConstants> <DefineConstants>TRACE;WINDOWSMETRO;</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
@ -188,7 +188,9 @@
<Compile Include="Tasks\BuildContent.cs" /> <Compile Include="Tasks\BuildContent.cs" />
<Compile Include="Tasks\BuildItem.cs" /> <Compile Include="Tasks\BuildItem.cs" />
<Compile Include="Tasks\ContentProject.cs" /> <Compile Include="Tasks\ContentProject.cs" />
<Compile Include="Tasks\ImporterConverter.cs" />
<Compile Include="Tasks\ImporterManager.cs" /> <Compile Include="Tasks\ImporterManager.cs" />
<Compile Include="Tasks\ProcessorConverter.cs" />
<Compile Include="Tasks\ProcessorManager.cs" /> <Compile Include="Tasks\ProcessorManager.cs" />
<Compile Include="VideoContent.cs" /> <Compile Include="VideoContent.cs" />
<Compile Include="Serialization\XmlReaderExtensions.cs" /> <Compile Include="Serialization\XmlReaderExtensions.cs" />

View File

@ -74,6 +74,7 @@
<Compile Include="Strukturen\Input\KeyboardStateTest.cs" /> <Compile Include="Strukturen\Input\KeyboardStateTest.cs" />
<Compile Include="Strukturen\Input\MouseStateTest.cs" /> <Compile Include="Strukturen\Input\MouseStateTest.cs" />
<Compile Include="Strukturen\Input\MouseTest.cs" /> <Compile Include="Strukturen\Input\MouseTest.cs" />
<Compile Include="Strukturen\Media\MediaLibraryTests.cs" />
<Compile Include="Strukturen\Storage\StorageContainerTest.cs" /> <Compile Include="Strukturen\Storage\StorageContainerTest.cs" />
<Compile Include="Strukturen\Storage\StorageDeviceTest.cs" /> <Compile Include="Strukturen\Storage\StorageDeviceTest.cs" />
<Compile Include="Strukturen\BoundingBoxTest.cs" /> <Compile Include="Strukturen\BoundingBoxTest.cs" />
@ -118,7 +119,6 @@
<Folder Include="Strukturen\Design\GamerServices\" /> <Folder Include="Strukturen\Design\GamerServices\" />
<Folder Include="Strukturen\Input\MotionSensing\" /> <Folder Include="Strukturen\Input\MotionSensing\" />
<Folder Include="Strukturen\Input\Touch\" /> <Folder Include="Strukturen\Input\Touch\" />
<Folder Include="Strukturen\Media\" />
<Folder Include="Strukturen\Net\" /> <Folder Include="Strukturen\Net\" />
<Folder Include="Strukturen\NonXNA\InputSystem\" /> <Folder Include="Strukturen\NonXNA\InputSystem\" />
<Folder Include="Strukturen\NonXNA\RenderSystem\" /> <Folder Include="Strukturen\NonXNA\RenderSystem\" />
@ -142,6 +142,10 @@
<Project>{068EB2E9-963C-4E1B-8831-E25011F11FFE}</Project> <Project>{068EB2E9-963C-4E1B-8831-E25011F11FFE}</Project>
<Name>ANX.PlatformSystem.Windows</Name> <Name>ANX.PlatformSystem.Windows</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\SoundSystems\ANX.SoundSystem.Windows.XAudio\ANX.SoundSystem.Windows.XAudio.csproj">
<Project>{6A582788-C4D2-410C-96CD-177F75712D65}</Project>
<Name>ANX.SoundSystem.Windows.XAudio</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@ -74,6 +74,7 @@
<Compile Include="Strukturen\Input\KeyboardStateTest.cs" /> <Compile Include="Strukturen\Input\KeyboardStateTest.cs" />
<Compile Include="Strukturen\Input\MouseStateTest.cs" /> <Compile Include="Strukturen\Input\MouseStateTest.cs" />
<Compile Include="Strukturen\Input\MouseTest.cs" /> <Compile Include="Strukturen\Input\MouseTest.cs" />
<Compile Include="Strukturen\Media\MediaLibraryTests.cs" />
<Compile Include="Strukturen\Storage\StorageContainerTest.cs" /> <Compile Include="Strukturen\Storage\StorageContainerTest.cs" />
<Compile Include="Strukturen\Storage\StorageDeviceTest.cs" /> <Compile Include="Strukturen\Storage\StorageDeviceTest.cs" />
<Compile Include="Strukturen\BoundingBoxTest.cs" /> <Compile Include="Strukturen\BoundingBoxTest.cs" />
@ -118,7 +119,6 @@
<Folder Include="Strukturen\Design\GamerServices\" /> <Folder Include="Strukturen\Design\GamerServices\" />
<Folder Include="Strukturen\Input\MotionSensing\" /> <Folder Include="Strukturen\Input\MotionSensing\" />
<Folder Include="Strukturen\Input\Touch\" /> <Folder Include="Strukturen\Input\Touch\" />
<Folder Include="Strukturen\Media\" />
<Folder Include="Strukturen\Net\" /> <Folder Include="Strukturen\Net\" />
<Folder Include="Strukturen\NonXNA\InputSystem\" /> <Folder Include="Strukturen\NonXNA\InputSystem\" />
<Folder Include="Strukturen\NonXNA\RenderSystem\" /> <Folder Include="Strukturen\NonXNA\RenderSystem\" />
@ -142,6 +142,10 @@
<Project>{068EB2E9-963C-4E1B-8831-E25011F11FFE}</Project> <Project>{068EB2E9-963C-4E1B-8831-E25011F11FFE}</Project>
<Name>ANX.PlatformSystem.Windows</Name> <Name>ANX.PlatformSystem.Windows</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\SoundSystems\ANX.SoundSystem.Windows.XAudio\ANX.SoundSystem.Windows.XAudio_Linux.csproj">
<Project>{6A582788-C4D2-410C-96CD-177F75712D65}</Project>
<Name>ANX.SoundSystem.Windows.XAudio</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@ -75,6 +75,7 @@
<Compile Include="Strukturen\Input\KeyboardStateTest.cs" /> <Compile Include="Strukturen\Input\KeyboardStateTest.cs" />
<Compile Include="Strukturen\Input\MouseStateTest.cs" /> <Compile Include="Strukturen\Input\MouseStateTest.cs" />
<Compile Include="Strukturen\Input\MouseTest.cs" /> <Compile Include="Strukturen\Input\MouseTest.cs" />
<Compile Include="Strukturen\Media\MediaLibraryTests.cs" />
<Compile Include="Strukturen\Storage\StorageContainerTest.cs" /> <Compile Include="Strukturen\Storage\StorageContainerTest.cs" />
<Compile Include="Strukturen\Storage\StorageDeviceTest.cs" /> <Compile Include="Strukturen\Storage\StorageDeviceTest.cs" />
<Compile Include="Strukturen\BoundingBoxTest.cs" /> <Compile Include="Strukturen\BoundingBoxTest.cs" />
@ -119,7 +120,6 @@
<Folder Include="Strukturen\Design\GamerServices\" /> <Folder Include="Strukturen\Design\GamerServices\" />
<Folder Include="Strukturen\Input\MotionSensing\" /> <Folder Include="Strukturen\Input\MotionSensing\" />
<Folder Include="Strukturen\Input\Touch\" /> <Folder Include="Strukturen\Input\Touch\" />
<Folder Include="Strukturen\Media\" />
<Folder Include="Strukturen\Net\" /> <Folder Include="Strukturen\Net\" />
<Folder Include="Strukturen\NonXNA\InputSystem\" /> <Folder Include="Strukturen\NonXNA\InputSystem\" />
<Folder Include="Strukturen\NonXNA\RenderSystem\" /> <Folder Include="Strukturen\NonXNA\RenderSystem\" />
@ -143,6 +143,10 @@
<Project>{068EB2E9-963C-4E1B-8831-E25011F11FFE}</Project> <Project>{068EB2E9-963C-4E1B-8831-E25011F11FFE}</Project>
<Name>ANX.PlatformSystem.Windows</Name> <Name>ANX.PlatformSystem.Windows</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\SoundSystems\ANX.SoundSystem.Windows.XAudio\ANX.SoundSystem.Windows.XAudio_PSVita.csproj">
<Project>{6A582788-C4D2-410C-96CD-177F75712D65}</Project>
<Name>ANX.SoundSystem.Windows.XAudio</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Sce\Sce.Psm.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Sce\Sce.Psm.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@ -76,6 +76,7 @@
<Compile Include="Strukturen\Input\KeyboardStateTest.cs" /> <Compile Include="Strukturen\Input\KeyboardStateTest.cs" />
<Compile Include="Strukturen\Input\MouseStateTest.cs" /> <Compile Include="Strukturen\Input\MouseStateTest.cs" />
<Compile Include="Strukturen\Input\MouseTest.cs" /> <Compile Include="Strukturen\Input\MouseTest.cs" />
<Compile Include="Strukturen\Media\MediaLibraryTests.cs" />
<Compile Include="Strukturen\Storage\StorageContainerTest.cs" /> <Compile Include="Strukturen\Storage\StorageContainerTest.cs" />
<Compile Include="Strukturen\Storage\StorageDeviceTest.cs" /> <Compile Include="Strukturen\Storage\StorageDeviceTest.cs" />
<Compile Include="Strukturen\BoundingBoxTest.cs" /> <Compile Include="Strukturen\BoundingBoxTest.cs" />
@ -120,7 +121,6 @@
<Folder Include="Strukturen\Design\GamerServices\" /> <Folder Include="Strukturen\Design\GamerServices\" />
<Folder Include="Strukturen\Input\MotionSensing\" /> <Folder Include="Strukturen\Input\MotionSensing\" />
<Folder Include="Strukturen\Input\Touch\" /> <Folder Include="Strukturen\Input\Touch\" />
<Folder Include="Strukturen\Media\" />
<Folder Include="Strukturen\Net\" /> <Folder Include="Strukturen\Net\" />
<Folder Include="Strukturen\NonXNA\InputSystem\" /> <Folder Include="Strukturen\NonXNA\InputSystem\" />
<Folder Include="Strukturen\NonXNA\RenderSystem\" /> <Folder Include="Strukturen\NonXNA\RenderSystem\" />
@ -136,6 +136,10 @@
<Project>{49066074-3B7B-4A55-B122-6BD33AB73558}</Project> <Project>{49066074-3B7B-4A55-B122-6BD33AB73558}</Project>
<Name>ANX.InputSystem.Standard</Name> <Name>ANX.InputSystem.Standard</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\SoundSystems\ANX.SoundSystem.Windows.XAudio\ANX.SoundSystem.Windows.XAudio_WindowsMetro.csproj">
<Project>{6A582788-C4D2-410C-96CD-177F75712D65}</Project>
<Name>ANX.SoundSystem.Windows.XAudio</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@ -1,8 +1,5 @@
#region Using Statements #region Using Statements
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework; using NUnit.Framework;
#endregion // Using Statements #endregion // Using Statements
@ -45,57 +42,6 @@ using ANXPlane = ANX.Framework.Plane;
using XNARect = Microsoft.Xna.Framework.Rectangle; using XNARect = Microsoft.Xna.Framework.Rectangle;
using ANXRect = ANX.Framework.Rectangle; using ANXRect = ANX.Framework.Rectangle;
using XNAAlpha8 = Microsoft.Xna.Framework.Graphics.PackedVector.Alpha8;
using ANXAlpha8 = ANX.Framework.Graphics.PackedVector.Alpha8;
using XNABgr565 = Microsoft.Xna.Framework.Graphics.PackedVector.Bgr565;
using ANXBgr565 = ANX.Framework.Graphics.PackedVector.Bgr565;
using XNABgra5551 = Microsoft.Xna.Framework.Graphics.PackedVector.Bgra5551;
using ANXBgra5551 = ANX.Framework.Graphics.PackedVector.Bgra5551;
using XNABgra4444 = Microsoft.Xna.Framework.Graphics.PackedVector.Bgra4444;
using ANXBgra4444 = ANX.Framework.Graphics.PackedVector.Bgra4444;
using XNAByte4 = Microsoft.Xna.Framework.Graphics.PackedVector.Byte4;
using ANXByte4 = ANX.Framework.Graphics.PackedVector.Byte4;
using XNAHalfSingle = Microsoft.Xna.Framework.Graphics.PackedVector.HalfSingle;
using ANXHalfSingle = ANX.Framework.Graphics.PackedVector.HalfSingle;
using XNAHalfVector2 = Microsoft.Xna.Framework.Graphics.PackedVector.HalfVector2;
using ANXHalfVector2 = ANX.Framework.Graphics.PackedVector.HalfVector2;
using XNAHalfVector4 = Microsoft.Xna.Framework.Graphics.PackedVector.HalfVector4;
using ANXHalfVector4 = ANX.Framework.Graphics.PackedVector.HalfVector4;
using XNARg32 = Microsoft.Xna.Framework.Graphics.PackedVector.Rg32;
using ANXRg32 = ANX.Framework.Graphics.PackedVector.Rg32;
using XNARgba1010102 = Microsoft.Xna.Framework.Graphics.PackedVector.Rgba1010102;
using ANXRgba1010102 = ANX.Framework.Graphics.PackedVector.Rgba1010102;
using XNARgba64 = Microsoft.Xna.Framework.Graphics.PackedVector.Rgba64;
using ANXRgba64 = ANX.Framework.Graphics.PackedVector.Rgba64;
using XNANormalizedByte2 = Microsoft.Xna.Framework.Graphics.PackedVector.NormalizedByte2;
using ANXNormalizedByte2 = ANX.Framework.Graphics.PackedVector.NormalizedByte2;
using XNANormalizedByte4 = Microsoft.Xna.Framework.Graphics.PackedVector.NormalizedByte4;
using ANXNormalizedByte4 = ANX.Framework.Graphics.PackedVector.NormalizedByte4;
using XNANormalizedShort2 = Microsoft.Xna.Framework.Graphics.PackedVector.NormalizedShort2;
using ANXNormalizedShort2 = ANX.Framework.Graphics.PackedVector.NormalizedShort2;
using XNANormalizedShort4 = Microsoft.Xna.Framework.Graphics.PackedVector.NormalizedShort4;
using ANXNormalizedShort4 = ANX.Framework.Graphics.PackedVector.NormalizedShort4;
using XNAShort2 = Microsoft.Xna.Framework.Graphics.PackedVector.Short2;
using ANXShort2 = ANX.Framework.Graphics.PackedVector.Short2;
using XNAShort4 = Microsoft.Xna.Framework.Graphics.PackedVector.Short4;
using ANXShort4 = ANX.Framework.Graphics.PackedVector.Short4;
using XNAMatrix = Microsoft.Xna.Framework.Matrix; using XNAMatrix = Microsoft.Xna.Framework.Matrix;
using ANXMatrix = ANX.Framework.Matrix; using ANXMatrix = ANX.Framework.Matrix;
@ -345,208 +291,13 @@ namespace ANX.Framework.TestCenter
} }
} }
public static void ConvertEquals(XNABgr565 lhs, ANXBgr565 rhs, String test) public static void ConvertEqualsPackedVector<T>(Microsoft.Xna.Framework.Graphics.PackedVector.IPackedVector<T> lhs,
ANX.Framework.Graphics.PackedVector.IPackedVector<T> rhs, string test)
{ {
if (lhs.PackedValue == rhs.PackedValue) if (lhs.PackedValue.Equals(rhs.PackedValue))
{
Assert.Pass(test + " passed"); Assert.Pass(test + " passed");
}
else else
{ Assert.Fail("{0} failed: {1} XNA: ({2}) {1} ANX: ({3})", test, lhs.GetType().Name, lhs, rhs);
Assert.Fail(String.Format("{0} failed: Bgr565 XNA: ({1}) Bgr565 ANX: ({2})", test, lhs, rhs));
}
}
public static void ConvertEquals(XNABgra5551 lhs, ANXBgra5551 rhs, String test)
{
if (lhs.PackedValue == rhs.PackedValue)
{
Assert.Pass(test + " passed");
}
else
{
Assert.Fail(String.Format("{0} failed: Bgra5551 XNA: ({1}) Bgra5551 ANX: ({2})", test, lhs, rhs));
}
}
public static void ConvertEquals(XNABgra4444 lhs, ANXBgra4444 rhs, String test)
{
if (lhs.PackedValue == rhs.PackedValue)
{
Assert.Pass(test + " passed");
}
else
{
Assert.Fail(String.Format("{0} failed: Bgra4444 XNA: ({1}) Bgra4444 ANX: ({2})", test, lhs, rhs));
}
}
public static void ConvertEquals(XNAByte4 lhs, ANXByte4 rhs, String test)
{
if (lhs.PackedValue == rhs.PackedValue)
{
Assert.Pass(test + " passed");
}
else
{
Assert.Fail(String.Format("{0} failed: Byte4 XNA: ({1}) Byte4 ANX: ({2})", test, lhs, rhs));
}
}
public static void ConvertEquals(XNAHalfSingle lhs, ANXHalfSingle rhs, String test)
{
if (lhs.PackedValue == rhs.PackedValue)
{
Assert.Pass(test + " passed");
}
else
{
Assert.Fail(String.Format("{0} failed: HalfSingle XNA: ({1}) HalfSingle ANX: ({2})", test, lhs, rhs));
}
}
public static void ConvertEquals(XNAHalfVector2 lhs, ANXHalfVector2 rhs, String test)
{
if (lhs.PackedValue == rhs.PackedValue)
{
Assert.Pass(test + " passed");
}
else
{
Assert.Fail(String.Format("{0} failed: HalfVector2 XNA: ({1}) HalfVector2 ANX: ({2})", test, lhs, rhs));
}
}
public static void ConvertEquals(XNAHalfVector4 lhs, ANXHalfVector4 rhs, String test)
{
if (lhs.PackedValue == rhs.PackedValue)
{
Assert.Pass(test + " passed");
}
else
{
Assert.Fail(String.Format("{0} failed: HalfVector4 XNA: ({1}) HalfVector4 ANX: ({2})", test, lhs, rhs));
}
}
public static void ConvertEquals(XNAAlpha8 lhs, ANXAlpha8 rhs, String test)
{
if (lhs.PackedValue == rhs.PackedValue)
{
Assert.Pass(test + " passed");
}
else
{
Assert.Fail(String.Format("{0} failed: Rg32 XNA: ({1}) Rg32 ANX: ({2})", test, lhs, rhs));
}
}
public static void ConvertEquals(XNARg32 lhs, ANXRg32 rhs, String test)
{
if (lhs.PackedValue == rhs.PackedValue)
{
Assert.Pass(test + " passed");
}
else
{
Assert.Fail(String.Format("{0} failed: Rg32 XNA: ({1}) Rg32 ANX: ({2})", test, lhs, rhs));
}
}
public static void ConvertEquals(XNARgba1010102 lhs, ANXRgba1010102 rhs, String test)
{
if (lhs.PackedValue == rhs.PackedValue)
{
Assert.Pass(test + " passed");
}
else
{
Assert.Fail(String.Format("{0} failed: Rgba1010102 XNA: ({1}) Rgba1010102 ANX: ({2})", test, lhs, rhs));
}
}
public static void ConvertEquals(XNARgba64 lhs, ANXRgba64 rhs, String test)
{
if (lhs.PackedValue == rhs.PackedValue)
{
Assert.Pass(test + " passed");
}
else
{
Assert.Fail(String.Format("{0} failed: Rgba64 XNA: ({1}) Rgba64 ANX: ({2})", test, lhs, rhs));
}
}
public static void ConvertEquals(XNANormalizedByte2 lhs, ANXNormalizedByte2 rhs, String test)
{
if (lhs.PackedValue == rhs.PackedValue)
{
Assert.Pass(test + " passed");
}
else
{
Assert.Fail(String.Format("{0} failed: NormalizedByte2 XNA: ({1}) NormalizedByte2 ANX: ({2})", test, lhs, rhs));
}
}
public static void ConvertEquals(XNANormalizedByte4 lhs, ANXNormalizedByte4 rhs, String test)
{
if (lhs.PackedValue == rhs.PackedValue)
{
Assert.Pass(test + " passed");
}
else
{
Assert.Fail(String.Format("{0} failed: NormalizedByte4 XNA: ({1}) NormalizedByte4 ANX: ({2})", test, lhs, rhs));
}
}
public static void ConvertEquals(XNANormalizedShort2 lhs, ANXNormalizedShort2 rhs, String test)
{
if (lhs.PackedValue == rhs.PackedValue)
{
Assert.Pass(test + " passed");
}
else
{
Assert.Fail(String.Format("{0} failed: NormalizedShort2 XNA: ({1}) NormalizedShort2 ANX: ({2})", test, lhs, rhs));
}
}
public static void ConvertEquals(XNANormalizedShort4 lhs, ANXNormalizedShort4 rhs, String test)
{
if (lhs.PackedValue == rhs.PackedValue)
{
Assert.Pass(test + " passed");
}
else
{
Assert.Fail(String.Format("{0} failed: NormalizedShort4 XNA: ({1}) NormalizedShort4 ANX: ({2})", test, lhs, rhs));
}
}
public static void ConvertEquals(XNAShort2 lhs, ANXShort2 rhs, String test)
{
if (lhs.PackedValue == rhs.PackedValue)
{
Assert.Pass(test + " passed");
}
else
{
Assert.Fail(String.Format("{0} failed: Short2 XNA: ({1}) Short2 ANX: ({2})", test, lhs, rhs));
}
}
public static void ConvertEquals(XNAShort4 lhs, ANXShort4 rhs, String test)
{
if (lhs.PackedValue == rhs.PackedValue)
{
Assert.Pass(test + " passed");
}
else
{
Assert.Fail(String.Format("{0} failed: Short4 XNA: ({1}) Short4 ANX: ({2})", test, lhs, rhs));
}
} }
public static void ConvertEquals(byte a, byte b, String test) public static void ConvertEquals(byte a, byte b, String test)
@ -987,9 +738,5 @@ namespace ANX.Framework.TestCenter
} }
} }
#endregion #endregion
} }
} }

View File

@ -30,7 +30,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNAAlpha8 xnaVal = new XNAAlpha8(alpha); XNAAlpha8 xnaVal = new XNAAlpha8(alpha);
ANXAlpha8 anxVal = new ANXAlpha8(alpha); ANXAlpha8 anxVal = new ANXAlpha8(alpha);
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor");
} }
[Test, TestCaseSource("floats")] [Test, TestCaseSource("floats")]

View File

@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNABgr565 xnaVal = new XNABgr565(r, g, b); XNABgr565 xnaVal = new XNABgr565(r, g, b);
ANXBgr565 anxVal = new ANXBgr565(r, g, b); ANXBgr565 anxVal = new ANXBgr565(r, g, b);
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
} }
[Test, TestCaseSource("threefloats")] [Test, TestCaseSource("threefloats")]
@ -52,7 +52,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNABgr565 xnaVal = new XNABgr565(new XNAVector3(r, g, b)); XNABgr565 xnaVal = new XNABgr565(new XNAVector3(r, g, b));
ANXBgr565 anxVal = new ANXBgr565(new ANXVector3(r, g, b)); ANXBgr565 anxVal = new ANXBgr565(new ANXVector3(r, g, b));
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
} }
[Test, TestCaseSource("threefloats")] [Test, TestCaseSource("threefloats")]

View File

@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNABgra4444 xnaVal = new XNABgra4444(r, g, b, a); XNABgra4444 xnaVal = new XNABgra4444(r, g, b, a);
ANXBgra4444 anxVal = new ANXBgra4444(r, g, b, a); ANXBgra4444 anxVal = new ANXBgra4444(r, g, b, a);
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
} }
[Test, TestCaseSource("fourfloats")] [Test, TestCaseSource("fourfloats")]
@ -52,7 +52,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNABgra4444 xnaVal = new XNABgra4444(new XNAVector4(r, g, b, a)); XNABgra4444 xnaVal = new XNABgra4444(new XNAVector4(r, g, b, a));
ANXBgra4444 anxVal = new ANXBgra4444(new ANXVector4(r, g, b, a)); ANXBgra4444 anxVal = new ANXBgra4444(new ANXVector4(r, g, b, a));
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
} }
[Test, TestCaseSource("fourfloats")] [Test, TestCaseSource("fourfloats")]

View File

@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNABgra5551 xnaVal = new XNABgra5551(r, g, b, a); XNABgra5551 xnaVal = new XNABgra5551(r, g, b, a);
ANXBgra5551 anxVal = new ANXBgra5551(r, g, b, a); ANXBgra5551 anxVal = new ANXBgra5551(r, g, b, a);
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
} }
[Test, TestCaseSource("fourfloats")] [Test, TestCaseSource("fourfloats")]
@ -52,7 +52,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNABgra5551 xnaVal = new XNABgra5551(new XNAVector4(r, g, b, a)); XNABgra5551 xnaVal = new XNABgra5551(new XNAVector4(r, g, b, a));
ANXBgra5551 anxVal = new ANXBgra5551(new ANXVector4(r, g, b, a)); ANXBgra5551 anxVal = new ANXBgra5551(new ANXVector4(r, g, b, a));
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
} }
[Test, TestCaseSource("fourfloats")] [Test, TestCaseSource("fourfloats")]

View File

@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNAByte4 xnaVal = new XNAByte4(r, g, b, a); XNAByte4 xnaVal = new XNAByte4(r, g, b, a);
ANXByte4 anxVal = new ANXByte4(r, g, b, a); ANXByte4 anxVal = new ANXByte4(r, g, b, a);
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
} }
[Test, TestCaseSource("fourfloats")] [Test, TestCaseSource("fourfloats")]
@ -52,7 +52,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNAByte4 xnaVal = new XNAByte4(new XNAVector4(r, g, b, a)); XNAByte4 xnaVal = new XNAByte4(new XNAVector4(r, g, b, a));
ANXByte4 anxVal = new ANXByte4(new ANXVector4(r, g, b, a)); ANXByte4 anxVal = new ANXByte4(new ANXVector4(r, g, b, a));
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
} }
[Test, TestCaseSource("fourfloats")] [Test, TestCaseSource("fourfloats")]

View File

@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNAHalfSingle xnaVal = new XNAHalfSingle(single); XNAHalfSingle xnaVal = new XNAHalfSingle(single);
ANXHalfSingle anxVal = new ANXHalfSingle(single); ANXHalfSingle anxVal = new ANXHalfSingle(single);
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
} }
[Test, TestCaseSource("floats")] [Test, TestCaseSource("floats")]

View File

@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNAHalfVector2 xnaVal = new XNAHalfVector2(x, y); XNAHalfVector2 xnaVal = new XNAHalfVector2(x, y);
ANXHalfVector2 anxVal = new ANXHalfVector2(x, y); ANXHalfVector2 anxVal = new ANXHalfVector2(x, y);
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
} }
[Test, TestCaseSource("twofloats")] [Test, TestCaseSource("twofloats")]
@ -51,7 +51,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNAHalfVector2 xnaVal = new XNAHalfVector2(new XNAVector2(x, y)); XNAHalfVector2 xnaVal = new XNAHalfVector2(new XNAVector2(x, y));
ANXHalfVector2 anxVal = new ANXHalfVector2(new ANXVector2(x, y)); ANXHalfVector2 anxVal = new ANXHalfVector2(new ANXVector2(x, y));
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
} }
[Test, TestCaseSource("twofloats")] [Test, TestCaseSource("twofloats")]

View File

@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNAHalfVector4 xnaVal = new XNAHalfVector4(x, y, z, w); XNAHalfVector4 xnaVal = new XNAHalfVector4(x, y, z, w);
ANXHalfVector4 anxVal = new ANXHalfVector4(x, y, z, w); ANXHalfVector4 anxVal = new ANXHalfVector4(x, y, z, w);
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
} }
[Test, TestCaseSource("fourfloats")] [Test, TestCaseSource("fourfloats")]
@ -51,7 +51,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNAHalfVector4 xnaVal = new XNAHalfVector4(new XNAVector4(x, y, z, w)); XNAHalfVector4 xnaVal = new XNAHalfVector4(new XNAVector4(x, y, z, w));
ANXHalfVector4 anxVal = new ANXHalfVector4(new ANXVector4(x, y, z, w)); ANXHalfVector4 anxVal = new ANXHalfVector4(new ANXVector4(x, y, z, w));
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
} }
[Test, TestCaseSource("fourfloats")] [Test, TestCaseSource("fourfloats")]

View File

@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNANormalizedByte2 xnaVal = new XNANormalizedByte2(x, y); XNANormalizedByte2 xnaVal = new XNANormalizedByte2(x, y);
ANXNormalizedByte2 anxVal = new ANXNormalizedByte2(x, y); ANXNormalizedByte2 anxVal = new ANXNormalizedByte2(x, y);
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
} }
[Test, TestCaseSource("twofloats")] [Test, TestCaseSource("twofloats")]
@ -51,7 +51,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNANormalizedByte2 xnaVal = new XNANormalizedByte2(new XNAVector2(x, y)); XNANormalizedByte2 xnaVal = new XNANormalizedByte2(new XNAVector2(x, y));
ANXNormalizedByte2 anxVal = new ANXNormalizedByte2(new ANXVector2(x, y)); ANXNormalizedByte2 anxVal = new ANXNormalizedByte2(new ANXVector2(x, y));
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
} }
[Test, TestCaseSource("twofloats")] [Test, TestCaseSource("twofloats")]

View File

@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNANormalizedByte4 xnaVal = new XNANormalizedByte4(x, y, z, w); XNANormalizedByte4 xnaVal = new XNANormalizedByte4(x, y, z, w);
ANXNormalizedByte4 anxVal = new ANXNormalizedByte4(x, y, z, w); ANXNormalizedByte4 anxVal = new ANXNormalizedByte4(x, y, z, w);
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
} }
[Test, TestCaseSource("fourfloats")] [Test, TestCaseSource("fourfloats")]
@ -51,7 +51,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNANormalizedByte4 xnaVal = new XNANormalizedByte4(new XNAVector4(x, y, z, w)); XNANormalizedByte4 xnaVal = new XNANormalizedByte4(new XNAVector4(x, y, z, w));
ANXNormalizedByte4 anxVal = new ANXNormalizedByte4(new ANXVector4(x, y, z, w)); ANXNormalizedByte4 anxVal = new ANXNormalizedByte4(new ANXVector4(x, y, z, w));
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
} }
[Test, TestCaseSource("fourfloats")] [Test, TestCaseSource("fourfloats")]

View File

@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNANormalizedShort2 xnaVal = new XNANormalizedShort2(x, y); XNANormalizedShort2 xnaVal = new XNANormalizedShort2(x, y);
ANXNormalizedShort2 anxVal = new ANXNormalizedShort2(x, y); ANXNormalizedShort2 anxVal = new ANXNormalizedShort2(x, y);
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
} }
[Test, TestCaseSource("twofloats")] [Test, TestCaseSource("twofloats")]
@ -51,7 +51,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNANormalizedShort2 xnaVal = new XNANormalizedShort2(new XNAVector2(x, y)); XNANormalizedShort2 xnaVal = new XNANormalizedShort2(new XNAVector2(x, y));
ANXNormalizedShort2 anxVal = new ANXNormalizedShort2(new ANXVector2(x, y)); ANXNormalizedShort2 anxVal = new ANXNormalizedShort2(new ANXVector2(x, y));
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
} }
[Test, TestCaseSource("twofloats")] [Test, TestCaseSource("twofloats")]

View File

@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNANormalizedShort4 xnaVal = new XNANormalizedShort4(x, y, z, w); XNANormalizedShort4 xnaVal = new XNANormalizedShort4(x, y, z, w);
ANXNormalizedShort4 anxVal = new ANXNormalizedShort4(x, y, z, w); ANXNormalizedShort4 anxVal = new ANXNormalizedShort4(x, y, z, w);
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
} }
[Test, TestCaseSource("fourfloats")] [Test, TestCaseSource("fourfloats")]
@ -51,7 +51,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNANormalizedShort4 xnaVal = new XNANormalizedShort4(new XNAVector4(x, y, z, w)); XNANormalizedShort4 xnaVal = new XNANormalizedShort4(new XNAVector4(x, y, z, w));
ANXNormalizedShort4 anxVal = new ANXNormalizedShort4(new ANXVector4(x, y, z, w)); ANXNormalizedShort4 anxVal = new ANXNormalizedShort4(new ANXVector4(x, y, z, w));
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
} }
[Test, TestCaseSource("fourfloats")] [Test, TestCaseSource("fourfloats")]

View File

@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNARg32 xnaVal = new XNARg32(x, y); XNARg32 xnaVal = new XNARg32(x, y);
ANXRg32 anxVal = new ANXRg32(x, y); ANXRg32 anxVal = new ANXRg32(x, y);
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
} }
[Test, TestCaseSource("twofloats")] [Test, TestCaseSource("twofloats")]
@ -52,7 +52,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNARg32 xnaVal = new XNARg32(new XNAVector2(x, y)); XNARg32 xnaVal = new XNARg32(new XNAVector2(x, y));
ANXRg32 anxVal = new ANXRg32(new ANXVector2(x, y)); ANXRg32 anxVal = new ANXRg32(new ANXVector2(x, y));
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
} }
[Test, TestCaseSource("twofloats")] [Test, TestCaseSource("twofloats")]

View File

@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNARgba1010102 xnaVal = new XNARgba1010102(x, y, z, w); XNARgba1010102 xnaVal = new XNARgba1010102(x, y, z, w);
ANXRgba1010102 anxVal = new ANXRgba1010102(x, y, z, w); ANXRgba1010102 anxVal = new ANXRgba1010102(x, y, z, w);
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
} }
[Test, TestCaseSource("fourfloats")] [Test, TestCaseSource("fourfloats")]
@ -52,7 +52,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNARgba1010102 xnaVal = new XNARgba1010102(new XNAVector4(x, y, z, w)); XNARgba1010102 xnaVal = new XNARgba1010102(new XNAVector4(x, y, z, w));
ANXRgba1010102 anxVal = new ANXRgba1010102(new ANXVector4(x, y, z, w)); ANXRgba1010102 anxVal = new ANXRgba1010102(new ANXVector4(x, y, z, w));
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
} }
[Test, TestCaseSource("fourfloats")] [Test, TestCaseSource("fourfloats")]

View File

@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNARgba64 xnaVal = new XNARgba64(x, y, z, w); XNARgba64 xnaVal = new XNARgba64(x, y, z, w);
ANXRgba64 anxVal = new ANXRgba64(x, y, z, w); ANXRgba64 anxVal = new ANXRgba64(x, y, z, w);
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
} }
[Test, TestCaseSource("fourfloats")] [Test, TestCaseSource("fourfloats")]
@ -52,7 +52,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNARgba64 xnaVal = new XNARgba64(new XNAVector4(x, y, z, w)); XNARgba64 xnaVal = new XNARgba64(new XNAVector4(x, y, z, w));
ANXRgba64 anxVal = new ANXRgba64(new ANXVector4(x, y, z, w)); ANXRgba64 anxVal = new ANXRgba64(new ANXVector4(x, y, z, w));
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
} }
[Test, TestCaseSource("fourfloats")] [Test, TestCaseSource("fourfloats")]

View File

@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNAShort2 xnaVal = new XNAShort2(x, y); XNAShort2 xnaVal = new XNAShort2(x, y);
ANXShort2 anxVal = new ANXShort2(x, y); ANXShort2 anxVal = new ANXShort2(x, y);
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
} }
[Test, TestCaseSource("twofloats")] [Test, TestCaseSource("twofloats")]
@ -51,7 +51,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNAShort2 xnaVal = new XNAShort2(new XNAVector2(x, y)); XNAShort2 xnaVal = new XNAShort2(new XNAVector2(x, y));
ANXShort2 anxVal = new ANXShort2(new ANXVector2(x, y)); ANXShort2 anxVal = new ANXShort2(new ANXVector2(x, y));
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
} }
[Test, TestCaseSource("twofloats")] [Test, TestCaseSource("twofloats")]

View File

@ -42,7 +42,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNAShort4 xnaVal = new XNAShort4(x, y, z, w); XNAShort4 xnaVal = new XNAShort4(x, y, z, w);
ANXShort4 anxVal = new ANXShort4(x, y, z, w); ANXShort4 anxVal = new ANXShort4(x, y, z, w);
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor1"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor1");
} }
[Test, TestCaseSource("fourfloats")] [Test, TestCaseSource("fourfloats")]
@ -51,7 +51,7 @@ namespace ANX.Framework.TestCenter.Strukturen.Graphics.PackedVector
XNAShort4 xnaVal = new XNAShort4(new XNAVector4(x, y, z, w)); XNAShort4 xnaVal = new XNAShort4(new XNAVector4(x, y, z, w));
ANXShort4 anxVal = new ANXShort4(new ANXVector4(x, y, z, w)); ANXShort4 anxVal = new ANXShort4(new ANXVector4(x, y, z, w));
AssertHelper.ConvertEquals(xnaVal, anxVal, "Constructor2"); AssertHelper.ConvertEqualsPackedVector(xnaVal, anxVal, "Constructor2");
} }
[Test, TestCaseSource("fourfloats")] [Test, TestCaseSource("fourfloats")]

View File

@ -0,0 +1,98 @@
using System;
using NUnit.Framework;
using ANXMediaLibrary = ANX.Framework.Media.MediaLibrary;
using XNAMediaLibrary = Microsoft.Xna.Framework.Media.MediaLibrary;
namespace ANX.Framework.TestCenter.Strukturen.Media
{
public static class MediaLibraryTests
{
[Test]
public static void TestGetSongs()
{
var anxLibrary = new ANXMediaLibrary();
var xnaLibrary = new XNAMediaLibrary();
var anxCollection = anxLibrary.Songs;
var xnaCollection = xnaLibrary.Songs;
Assert.AreEqual(xnaCollection.Count, anxCollection.Count);
for(int index = 0; index < xnaCollection.Count; index++)
{
Assert.AreEqual(xnaCollection[index].Name, anxCollection[index].Name);
Assert.AreEqual(xnaCollection[index].Rating, anxCollection[index].Rating);
Assert.AreEqual(xnaCollection[index].IsRated, anxCollection[index].IsRated);
Assert.AreEqual(xnaCollection[index].TrackNumber, anxCollection[index].TrackNumber);
Assert.AreEqual(xnaCollection[index].PlayCount, anxCollection[index].PlayCount);
Assert.AreEqual(xnaCollection[index].IsProtected, anxCollection[index].IsProtected);
Assert.True(AreNearlyEqual(xnaCollection[index].Duration, anxCollection[index].Duration));
Assert.AreEqual(xnaCollection[index].Artist.Name, anxCollection[index].Artist.Name);
Assert.AreEqual(xnaCollection[index].Album.Name, anxCollection[index].Album.Name);
Assert.AreEqual(xnaCollection[index].Album.Artist.Name, anxCollection[index].Album.Artist.Name);
Assert.AreEqual(xnaCollection[index].Genre.Name, anxCollection[index].Genre.Name);
}
}
private static bool AreNearlyEqual(TimeSpan first, TimeSpan second)
{
long ticks1 = first.Ticks;
long ticks2 = second.Ticks;
return ticks1 - 10000 <= ticks2 && ticks1 + 10000 >= ticks2;
}
[Test]
public static void TestGetAlbums()
{
var anxLibrary = new ANXMediaLibrary();
var xnaLibrary = new XNAMediaLibrary();
var anxCollection = anxLibrary.Albums;
var xnaCollection = xnaLibrary.Albums;
Assert.AreEqual(xnaCollection.Count, anxCollection.Count);
for (int index = 0; index < xnaCollection.Count; index++)
{
Assert.AreEqual(xnaCollection[index].Name, anxCollection[index].Name);
}
}
[Test]
public static void TestGetPictures()
{
var anxLibrary = new ANXMediaLibrary();
var xnaLibrary = new XNAMediaLibrary();
var anxCollection = anxLibrary.Pictures;
var xnaCollection = xnaLibrary.Pictures;
Assert.AreEqual(xnaCollection.Count, anxCollection.Count);
for (int index = 0; index < xnaCollection.Count; index++)
{
Assert.AreEqual(xnaCollection[index].Name, anxCollection[index].Name);
}
}
[Test]
public static void TestGetArtists()
{
var anxLibrary = new ANXMediaLibrary();
var xnaLibrary = new XNAMediaLibrary();
var anxCollection = anxLibrary.Artists;
var xnaCollection = xnaLibrary.Artists;
Assert.AreEqual(xnaCollection.Count, anxCollection.Count);
for (int index = 0; index < xnaCollection.Count; index++)
{
Assert.AreEqual(xnaCollection[index].Name, anxCollection[index].Name);
}
}
[Test]
public static void TestGetGenres()
{
var anxLibrary = new ANXMediaLibrary();
var xnaLibrary = new XNAMediaLibrary();
var anxCollection = anxLibrary.Genres;
var xnaCollection = xnaLibrary.Genres;
Assert.AreEqual(xnaCollection.Count, anxCollection.Count);
for (int index = 0; index < xnaCollection.Count; index++)
{
Assert.AreEqual(xnaCollection[index].Name, anxCollection[index].Name);
}
}
}
}

View File

@ -1,5 +1,6 @@
using System; using System;
using System.IO; using System.IO;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
@ -7,130 +8,70 @@ using System.IO;
namespace ANX.Framework.Media namespace ANX.Framework.Media
{ {
public sealed class Album : IEquatable<Album>, IDisposable [PercentageComplete(70)]
{ [Developer("AstrorEnales")]
public bool IsDisposed [TestState(TestStateAttribute.TestState.Untested)]
{ public sealed class Album : IEquatable<Album>, IDisposable
get; {
private set; internal string Id { get; private set; }
}
public string Name public bool IsDisposed { get; private set; }
{ public string Name { get; internal set; }
get public TimeSpan Duration { get; internal set; }
{ public bool HasArt { get; internal set; }
throw new NotImplementedException(); public Artist Artist { get; internal set; }
} public SongCollection Songs { get; internal set; }
} public Genre Genre { get; internal set; }
public TimeSpan Duration internal Album(string setId)
{ {
get Id = setId;
{ IsDisposed = false;
throw new NotImplementedException(); }
}
}
public bool HasArt public Stream GetAlbumArt()
{ {
get throw new NotImplementedException();
{ }
throw new NotImplementedException();
}
}
public Artist Artist public Stream GetThumbnail()
{ {
get throw new NotImplementedException();
{ }
throw new NotImplementedException();
}
}
public SongCollection Songs public void Dispose()
{ {
get IsDisposed = true;
{ }
throw new NotImplementedException();
}
}
public Genre Genre public bool Equals(Album other)
{ {
get return Id == other.Id;
{ }
throw new NotImplementedException();
}
}
#region Constructor public override bool Equals(object obj)
private Album() {
{ return obj is Album ? Equals(obj as Album) : base.Equals(obj);
IsDisposed = false; }
}
~Album() public override string ToString()
{ {
Dispose(); return Name;
} }
#endregion
public Stream GetAlbumArt() public override int GetHashCode()
{ {
throw new NotImplementedException(); return Name.GetHashCode();
} }
public Stream GetThumbnail() public static bool operator ==(Album first, Album second)
{ {
throw new NotImplementedException(); return first.Equals(second);
} }
public void Dispose() public static bool operator !=(Album first, Album second)
{ {
if (IsDisposed == false) return first.Equals(second) == false;
{ }
IsDisposed = true; }
throw new NotImplementedException();
}
}
public bool Equals(Album other)
{
throw new NotImplementedException();
}
public override bool Equals(object obj)
{
if (obj is Album)
return Equals(obj as Album);
return base.Equals(obj);
}
#region ToString
public override string ToString()
{
return Name;
}
#endregion
#region GetHashCode
public override int GetHashCode()
{
return Name.GetHashCode();
}
#endregion
#region Operator overloading
public static bool operator ==(Album first, Album second)
{
return first.Equals(second);
}
public static bool operator !=(Album first, Album second)
{
return first.Equals(second) == false;
}
#endregion
}
} }

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
@ -8,35 +9,28 @@ using System.Collections.Generic;
namespace ANX.Framework.Media namespace ANX.Framework.Media
{ {
[PercentageComplete(100)]
[Developer("AstrorEnales")]
[TestState(TestStateAttribute.TestState.InProgress)]
public sealed class AlbumCollection : IEnumerable<Album>, IEnumerable, IDisposable public sealed class AlbumCollection : IEnumerable<Album>, IEnumerable, IDisposable
{ {
private List<Album> albums; private readonly List<Album> albums;
public bool IsDisposed public bool IsDisposed { get; private set; }
{
get;
private set;
}
public int Count public int Count
{ {
get get { return albums.Count; }
{ }
return albums.Count;
}
}
public Album this[int index] public Album this[int index]
{ {
get get { return albums[index]; }
{ }
return albums[index];
}
}
internal AlbumCollection() internal AlbumCollection(IEnumerable<Album> setAlbums)
{ {
albums = new List<Album>(); albums = new List<Album>(setAlbums);
IsDisposed = false; IsDisposed = false;
} }

View File

@ -1,4 +1,5 @@
using System; using System;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
@ -6,96 +7,55 @@ using System;
namespace ANX.Framework.Media namespace ANX.Framework.Media
{ {
public sealed class Artist : IEquatable<Artist>, IDisposable [PercentageComplete(100)]
{ [Developer("AstrorEnales")]
public bool IsDisposed [TestState(TestStateAttribute.TestState.InProgress)]
{ public sealed class Artist : IEquatable<Artist>, IDisposable
get; {
private set; public bool IsDisposed { get; private set; }
} public string Name { get; private set; }
public SongCollection Songs { get; internal set; }
public AlbumCollection Albums { get; internal set; }
public string Name internal Artist(string setName)
{ {
get Name = setName;
{ IsDisposed = false;
throw new NotImplementedException(); }
}
}
public SongCollection Songs public bool Equals(Artist other)
{ {
get return Name == other.Name;
{ }
throw new NotImplementedException();
}
}
public AlbumCollection Albums public override bool Equals(object obj)
{ {
get return obj is Artist ? Equals(obj as Artist) : base.Equals(obj);
{ }
throw new NotImplementedException();
}
}
#region Constructor public void Dispose()
private Artist() {
{ IsDisposed = true;
IsDisposed = false; }
}
~Artist() public override string ToString()
{ {
Dispose(); return Name;
} }
#endregion
public bool Equals(Artist other) public override int GetHashCode()
{ {
throw new NotImplementedException(); return Name.GetHashCode();
} }
public override bool Equals(object obj) public static bool operator ==(Artist first, Artist second)
{ {
if (obj is Artist) return first.Equals(second);
return Equals(obj as Artist); }
return base.Equals(obj); public static bool operator !=(Artist first, Artist second)
} {
return first.Equals(second) == false;
public void Dispose() }
{ }
if (IsDisposed == false)
{
IsDisposed = true;
throw new NotImplementedException();
}
}
#region ToString
public override string ToString()
{
return Name;
}
#endregion
#region GetHashCode
public override int GetHashCode()
{
return Name.GetHashCode();
}
#endregion
#region Operator overloading
public static bool operator ==(Artist first, Artist second)
{
return first.Equals(second);
}
public static bool operator !=(Artist first, Artist second)
{
return first.Equals(second) == false;
}
#endregion
}
} }

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
@ -8,6 +9,9 @@ using System.Collections.Generic;
namespace ANX.Framework.Media namespace ANX.Framework.Media
{ {
[PercentageComplete(100)]
[Developer("AstrorEnales")]
[TestState(TestStateAttribute.TestState.InProgress)]
public sealed class ArtistCollection : IEnumerable<Artist>, IEnumerable, IDisposable public sealed class ArtistCollection : IEnumerable<Artist>, IEnumerable, IDisposable
{ {
private readonly List<Artist> artists; private readonly List<Artist> artists;
@ -24,9 +28,9 @@ namespace ANX.Framework.Media
get { return artists[index]; } get { return artists[index]; }
} }
internal ArtistCollection() internal ArtistCollection(IEnumerable<Artist> setArtists)
{ {
artists = new List<Artist>(); artists = new List<Artist>(setArtists);
IsDisposed = false; IsDisposed = false;
} }

View File

@ -1,4 +1,5 @@
using System; using System;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
@ -6,96 +7,55 @@ using System;
namespace ANX.Framework.Media namespace ANX.Framework.Media
{ {
public sealed class Genre : IEquatable<Genre>, IDisposable [PercentageComplete(100)]
{ [Developer("AstrorEnales")]
public bool IsDisposed [TestState(TestStateAttribute.TestState.InProgress)]
{ public sealed class Genre : IEquatable<Genre>, IDisposable
get; {
private set; public bool IsDisposed { get; private set; }
} public string Name { get; private set; }
public SongCollection Songs { get; internal set; }
public AlbumCollection Albums { get; internal set; }
public string Name internal Genre(string setName)
{ {
get Name = setName;
{ IsDisposed = false;
throw new NotImplementedException(); }
}
}
public SongCollection Songs public bool Equals(Genre other)
{ {
get return Name == other.Name;
{ }
throw new NotImplementedException();
}
}
public AlbumCollection Albums public override bool Equals(object obj)
{ {
get return obj is Genre ? Equals(obj as Genre) : base.Equals(obj);
{ }
throw new NotImplementedException();
}
}
#region Constructor
private Genre()
{
IsDisposed = false;
}
~Genre() public void Dispose()
{ {
Dispose(); IsDisposed = true;
} }
#endregion
public bool Equals(Genre other) public override string ToString()
{ {
throw new NotImplementedException(); return Name;
} }
public override bool Equals(object obj) public override int GetHashCode()
{ {
if (obj is Genre) return Name.GetHashCode();
return Equals(obj as Genre); }
return base.Equals(obj); public static bool operator ==(Genre first, Genre second)
} {
return first.Equals(second);
}
public void Dispose() public static bool operator !=(Genre first, Genre second)
{ {
if (IsDisposed == false) return first.Equals(second) == false;
{ }
IsDisposed = true; }
throw new NotImplementedException();
}
}
#region ToString
public override string ToString()
{
return Name;
}
#endregion
#region GetHashCode
public override int GetHashCode()
{
return Name.GetHashCode();
}
#endregion
#region Operator overloading
public static bool operator ==(Genre first, Genre second)
{
return first.Equals(second);
}
public static bool operator !=(Genre first, Genre second)
{
return first.Equals(second) == false;
}
#endregion
}
} }

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
@ -8,6 +9,9 @@ using System.Collections.Generic;
namespace ANX.Framework.Media namespace ANX.Framework.Media
{ {
[PercentageComplete(100)]
[Developer("AstrorEnales")]
[TestState(TestStateAttribute.TestState.InProgress)]
public sealed class GenreCollection : IEnumerable<Genre>, IEnumerable, IDisposable public sealed class GenreCollection : IEnumerable<Genre>, IEnumerable, IDisposable
{ {
private readonly List<Genre> genres; private readonly List<Genre> genres;
@ -24,9 +28,9 @@ namespace ANX.Framework.Media
get { return genres[index]; } get { return genres[index]; }
} }
internal GenreCollection() internal GenreCollection(IEnumerable<Genre> setGenres)
{ {
genres = new List<Genre>(); genres = new List<Genre>(setGenres);
IsDisposed = false; IsDisposed = false;
} }

View File

@ -9,8 +9,8 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Media namespace ANX.Framework.Media
{ {
[PercentageComplete(100)] [PercentageComplete(100)]
[TestState(TestStateAttribute.TestState.Untested)]
[Developer("AstrorEnales")] [Developer("AstrorEnales")]
[TestState(TestStateAttribute.TestState.Untested)]
public sealed class MediaQueue public sealed class MediaQueue
{ {
private readonly List<Song> queue; private readonly List<Song> queue;

View File

@ -1,4 +1,5 @@
using System; using System;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
@ -6,6 +7,9 @@ using System;
namespace ANX.Framework.Media namespace ANX.Framework.Media
{ {
[PercentageComplete(100)]
[Developer("AstrorEnales")]
[TestState(TestStateAttribute.TestState.Tested)]
[Flags] [Flags]
public enum MediaSourceType public enum MediaSourceType
{ {

View File

@ -1,4 +1,5 @@
using System; using System;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
@ -6,6 +7,9 @@ using System;
namespace ANX.Framework.Media namespace ANX.Framework.Media
{ {
[PercentageComplete(100)]
[Developer("AstrorEnales")]
[TestState(TestStateAttribute.TestState.Tested)]
[Flags] [Flags]
public enum MediaState public enum MediaState
{ {

View File

@ -1,5 +1,6 @@
using System; using System;
using System.IO; using System.IO;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
@ -7,122 +8,69 @@ using System.IO;
namespace ANX.Framework.Media namespace ANX.Framework.Media
{ {
public sealed class Picture : IEquatable<Picture>, IDisposable [PercentageComplete(70)]
{ [Developer("AstrorEnales")]
public bool IsDisposed [TestState(TestStateAttribute.TestState.Untested)]
{ public sealed class Picture : IEquatable<Picture>, IDisposable
get; {
private set; internal string Id { get; private set; }
}
public string Name public bool IsDisposed { get; private set; }
{ public string Name { get; internal set; }
get public PictureAlbum Album { get; internal set; }
{ public int Width { get; internal set; }
throw new NotImplementedException(); public int Height { get; internal set; }
} public DateTime Date { get; internal set; }
}
public PictureAlbum Album internal Picture(string setId)
{ {
get Id = setId;
{ IsDisposed = false;
throw new NotImplementedException(); }
}
}
public int Width public Stream GetImage()
{ {
get throw new NotImplementedException();
{ }
throw new NotImplementedException();
}
}
public int Height public Stream GetThumbnail()
{ {
get throw new NotImplementedException();
{ }
throw new NotImplementedException();
}
}
public DateTime Date public bool Equals(Picture other)
{ {
get return Id == other.Id;
{ }
throw new NotImplementedException();
}
}
#region Constructor public override bool Equals(object obj)
private Picture() {
{ return obj is Picture ? Equals(obj as Picture) : base.Equals(obj);
IsDisposed = false; }
}
~Picture() public void Dispose()
{ {
Dispose(); IsDisposed = true;
} }
#endregion
public Stream GetImage() public override string ToString()
{ {
throw new NotImplementedException(); return Name;
} }
public Stream GetThumbnail() public override int GetHashCode()
{ {
throw new NotImplementedException(); return Name.GetHashCode();
} }
public bool Equals(Picture other) public static bool operator ==(Picture first, Picture second)
{ {
throw new NotImplementedException(); return first.Equals(second);
} }
public override bool Equals(object obj) public static bool operator !=(Picture first, Picture second)
{ {
if (obj is Picture) return first.Equals(second) == false;
return Equals(obj as Picture); }
}
return base.Equals(obj);
}
public void Dispose()
{
if (IsDisposed == false)
{
IsDisposed = true;
throw new NotImplementedException();
}
}
#region ToString
public override string ToString()
{
return Name;
}
#endregion
#region GetHashCode
public override int GetHashCode()
{
return Name.GetHashCode();
}
#endregion
#region Operator overloading
public static bool operator ==(Picture first, Picture second)
{
return first.Equals(second);
}
public static bool operator !=(Picture first, Picture second)
{
return first.Equals(second) == false;
}
#endregion
}
} }

View File

@ -1,4 +1,5 @@
using System; using System;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
@ -6,104 +7,58 @@ using System;
namespace ANX.Framework.Media namespace ANX.Framework.Media
{ {
public sealed class PictureAlbum : IEquatable<PictureAlbum>, IDisposable [PercentageComplete(50)]
{ [Developer("AstrorEnales")]
public bool IsDisposed [TestState(TestStateAttribute.TestState.Untested)]
{ public sealed class PictureAlbum : IEquatable<PictureAlbum>, IDisposable
get; {
private set; internal string Id { get; private set; }
}
public string Name public bool IsDisposed { get; private set; }
{ public string Name { get; private set; }
get public PictureAlbumCollection Albums { get; private set; }
{ public PictureCollection Pictures { get; private set; }
throw new NotImplementedException(); public PictureAlbum Parent { get; private set; }
}
}
public PictureAlbumCollection Albums internal PictureAlbum(string setId)
{ {
get Id = setId;
{ IsDisposed = false;
throw new NotImplementedException(); }
}
}
public PictureCollection Pictures public bool Equals(PictureAlbum other)
{ {
get return Id == other.Id;
{ }
throw new NotImplementedException();
}
}
public PictureAlbum Parent public override bool Equals(object obj)
{ {
get return obj is PictureAlbum ? Equals(obj as PictureAlbum) : base.Equals(obj);
{ }
throw new NotImplementedException();
}
}
#region Constructor public void Dispose()
private PictureAlbum() {
{ IsDisposed = true;
IsDisposed = false; }
}
~PictureAlbum() public override string ToString()
{ {
Dispose(); return Name;
} }
#endregion
public bool Equals(PictureAlbum other) public override int GetHashCode()
{ {
throw new NotImplementedException(); return Name.GetHashCode();
} }
public override bool Equals(object obj) public static bool operator ==(PictureAlbum first, PictureAlbum second)
{ {
if (obj is PictureAlbum) return first.Equals(second);
return Equals(obj as PictureAlbum); }
return base.Equals(obj); public static bool operator !=(PictureAlbum first, PictureAlbum second)
} {
return first.Equals(second) == false;
public void Dispose() }
{ }
if (IsDisposed == false)
{
IsDisposed = true;
throw new NotImplementedException();
}
}
#region ToString
public override string ToString()
{
return Name;
}
#endregion
#region GetHashCode
public override int GetHashCode()
{
return Name.GetHashCode();
}
#endregion
#region Operator overloading
public static bool operator ==(PictureAlbum first, PictureAlbum second)
{
return first.Equals(second);
}
public static bool operator !=(PictureAlbum first, PictureAlbum second)
{
return first.Equals(second) == false;
}
#endregion
}
} }

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
@ -8,33 +9,26 @@ using System.Collections.Generic;
namespace ANX.Framework.Media namespace ANX.Framework.Media
{ {
[PercentageComplete(100)]
[Developer("AstrorEnales")]
[TestState(TestStateAttribute.TestState.InProgress)]
public sealed class PictureAlbumCollection : IEnumerable<PictureAlbum>, IEnumerable, IDisposable public sealed class PictureAlbumCollection : IEnumerable<PictureAlbum>, IEnumerable, IDisposable
{ {
private List<PictureAlbum> pictureAlbums; private readonly List<PictureAlbum> pictureAlbums;
public bool IsDisposed public bool IsDisposed { get; private set; }
{
get;
private set;
}
public int Count public int Count
{ {
get get { return pictureAlbums.Count; }
{ }
return pictureAlbums.Count;
}
}
public PictureAlbum this[int index] public PictureAlbum this[int index]
{ {
get get { return pictureAlbums[index]; }
{ }
return pictureAlbums[index];
}
}
internal PictureAlbumCollection() internal PictureAlbumCollection()
{ {
pictureAlbums = new List<PictureAlbum>(); pictureAlbums = new List<PictureAlbum>();
IsDisposed = false; IsDisposed = false;

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
@ -8,35 +9,28 @@ using System.Collections.Generic;
namespace ANX.Framework.Media namespace ANX.Framework.Media
{ {
[PercentageComplete(100)]
[Developer("AstrorEnales")]
[TestState(TestStateAttribute.TestState.InProgress)]
public sealed class PictureCollection : IEnumerable<Picture>, IEnumerable, IDisposable public sealed class PictureCollection : IEnumerable<Picture>, IEnumerable, IDisposable
{ {
private List<Picture> pictures; private readonly List<Picture> pictures;
public bool IsDisposed public bool IsDisposed { get; private set; }
{
get;
private set;
}
public int Count public int Count
{ {
get get { return pictures.Count; }
{ }
return pictures.Count;
}
}
public Picture this[int index] public Picture this[int index]
{ {
get get { return pictures[index]; }
{ }
return pictures[index];
}
}
internal PictureCollection() internal PictureCollection(IEnumerable<Picture> setPictures)
{ {
pictures = new List<Picture>(); pictures = new List<Picture>(setPictures);
IsDisposed = false; IsDisposed = false;
} }

View File

@ -1,4 +1,5 @@
using System; using System;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
@ -6,87 +7,49 @@ using System;
namespace ANX.Framework.Media namespace ANX.Framework.Media
{ {
[PercentageComplete(100)]
[Developer("AstrorEnales")]
[TestState(TestStateAttribute.TestState.Untested)]
public sealed class Playlist : IEquatable<Playlist>, IDisposable public sealed class Playlist : IEquatable<Playlist>, IDisposable
{ {
public bool IsDisposed internal string Id { get; private set; }
{
get;
private set;
}
public string Name public bool IsDisposed { get; private set; }
{ public string Name { get; internal set; }
get public SongCollection Songs { get; internal set; }
{ public TimeSpan Duration { get; internal set; }
throw new NotImplementedException();
}
}
public SongCollection Songs internal Playlist(string setId)
{
get
{
throw new NotImplementedException();
}
}
public TimeSpan Duration
{
get
{
throw new NotImplementedException();
}
}
#region Constructor
private Playlist()
{ {
Id = setId;
IsDisposed = false; IsDisposed = false;
} }
~Playlist() public bool Equals(Playlist other)
{ {
Dispose(); return Id == other.Id;
}
#endregion
public bool Equals(Playlist other)
{
throw new NotImplementedException();
} }
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
if (obj is Playlist) return obj is Playlist ? Equals(obj as Playlist) : base.Equals(obj);
return Equals(obj as Playlist);
return base.Equals(obj);
} }
public void Dispose() public void Dispose()
{ {
if (IsDisposed == false) IsDisposed = true;
{ }
IsDisposed = true;
throw new NotImplementedException();
}
}
#region ToString
public override string ToString() public override string ToString()
{ {
return Name; return Name;
} }
#endregion
#region GetHashCode
public override int GetHashCode() public override int GetHashCode()
{ {
return Name.GetHashCode(); return Name.GetHashCode();
} }
#endregion
#region Operator overloading
public static bool operator ==(Playlist first, Playlist second) public static bool operator ==(Playlist first, Playlist second)
{ {
return first.Equals(second); return first.Equals(second);
@ -96,6 +59,5 @@ namespace ANX.Framework.Media
{ {
return first.Equals(second) == false; return first.Equals(second) == false;
} }
#endregion
} }
} }

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
@ -8,34 +9,26 @@ using System.Collections.Generic;
namespace ANX.Framework.Media namespace ANX.Framework.Media
{ {
public sealed class PlaylistCollection [PercentageComplete(100)]
: IEnumerable<Playlist>, IEnumerable, IDisposable [Developer("AstrorEnales")]
[TestState(TestStateAttribute.TestState.InProgress)]
public sealed class PlaylistCollection : IEnumerable<Playlist>, IEnumerable, IDisposable
{ {
private List<Playlist> playlists; private readonly List<Playlist> playlists;
public bool IsDisposed public bool IsDisposed { get; private set; }
{
get;
private set;
}
public int Count public int Count
{ {
get get { return playlists.Count; }
{ }
return playlists.Count;
}
}
public Playlist this[int index] public Playlist this[int index]
{ {
get get { return playlists[index]; }
{ }
return playlists[index];
}
}
internal PlaylistCollection() internal PlaylistCollection()
{ {
playlists = new List<Playlist>(); playlists = new List<Playlist>();
IsDisposed = false; IsDisposed = false;

View File

@ -9,116 +9,109 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Media namespace ANX.Framework.Media
{ {
[PercentageComplete(50)] [PercentageComplete(100)]
[Developer("AstrorEnales")] [Developer("AstrorEnales")]
public sealed class Song : IEquatable<Song>, IDisposable [TestState(TestStateAttribute.TestState.InProgress)]
{ public sealed class Song : IEquatable<Song>, IDisposable
{
internal string Id { get; private set; }
internal ISong NativeSong { get; private set; } internal ISong NativeSong { get; private set; }
internal MediaState State { get { return NativeSong.State; } } internal MediaState State
{
get { return NativeSong.State; }
}
#region Public #region Public
public bool IsDisposed { get; private set; } public bool IsDisposed { get; private set; }
public string Name { get; private set; } public string Name { get; private set; }
public int Rating { get; internal set; }
public bool IsRated public int TrackNumber { get; internal set; }
{ public int PlayCount { get; internal set; }
get { return Rating > 0; } public bool IsProtected { get; internal set; }
}
public Artist Artist { get; internal set; } public Artist Artist { get; internal set; }
public Album Album { get; internal set; } public Album Album { get; internal set; }
public Genre Genre { get; internal set; } public Genre Genre { get; internal set; }
public bool IsRated
{
get { return Rating > 0; }
}
public TimeSpan Duration public TimeSpan Duration
{
get { return NativeSong.Duration; }
}
public int Rating
{ {
get { throw new NotImplementedException(); } get { return NativeSong.Duration; }
}
public int PlayCount
{
get { throw new NotImplementedException(); }
}
public int TrackNumber
{
get { throw new NotImplementedException(); }
}
public bool IsProtected
{
get { throw new NotImplementedException(); }
} }
#endregion #endregion
#region Constructor #region Constructor
internal Song(string setName) internal Song(string setName, string setId, string filename, int duration)
{ {
// TODO
var creator = AddInSystemFactory.Instance.GetDefaultCreator<ISoundSystemCreator>(); var creator = AddInSystemFactory.Instance.GetDefaultCreator<ISoundSystemCreator>();
//NativeSong = creator.CreateSong(this, uri); NativeSong = creator.CreateSong(this, filename, duration);
Id = setId;
Name = setName; Name = setName;
IsDisposed = false; IsDisposed = false;
} }
internal Song(string setName, Uri uri) internal Song(string setName, Uri uri)
{ {
var creator = AddInSystemFactory.Instance.GetDefaultCreator<ISoundSystemCreator>(); var creator = AddInSystemFactory.Instance.GetDefaultCreator<ISoundSystemCreator>();
NativeSong = creator.CreateSong(this, uri); NativeSong = creator.CreateSong(this, uri);
Name = setName; Id = "-1";
IsDisposed = false; Name = setName;
} IsDisposed = false;
}
internal Song(string setName, string filename, int duration) internal Song(string setName, string filename, int duration)
{ {
var creator = AddInSystemFactory.Instance.GetDefaultCreator<ISoundSystemCreator>(); var creator = AddInSystemFactory.Instance.GetDefaultCreator<ISoundSystemCreator>();
NativeSong = creator.CreateSong(this, filename, duration); NativeSong = creator.CreateSong(this, filename, duration);
Id = "-1";
Name = setName; Name = setName;
IsDisposed = false; IsDisposed = false;
} }
~Song() ~Song()
{ {
Dispose(); Dispose();
} }
#endregion #endregion
public static Song FromUri(string name, Uri uri) public static Song FromUri(string name, Uri uri)
{ {
return new Song(name, uri); return new Song(name, uri);
} }
#region Equals #region Equals
public bool Equals(Song other) public bool Equals(Song other)
{ {
return other != null && Name == other.Name; if (other == null || Id != other.Id)
} return false;
public override bool Equals(object obj) return Id != "-1" || ReferenceEquals(this, other);
{ }
if (ReferenceEquals(this, obj) == false)
public override bool Equals(object obj)
{
if (obj is Song && ReferenceEquals(this, obj) == false)
return Equals((Song)obj); return Equals((Song)obj);
return base.Equals(obj); return base.Equals(obj);
} }
#endregion #endregion
#region Dispose #region Dispose
public void Dispose() public void Dispose()
{ {
if (IsDisposed) if (IsDisposed)
return; return;
IsDisposed = true; IsDisposed = true;
if(NativeSong != null) if (NativeSong != null)
NativeSong.Dispose(); NativeSong.Dispose();
NativeSong = null; NativeSong = null;
} }
#endregion #endregion
internal void Play() internal void Play()
@ -141,30 +134,30 @@ namespace ANX.Framework.Media
NativeSong.Resume(); NativeSong.Resume();
} }
#region ToString #region ToString
public override string ToString() public override string ToString()
{ {
return Name; return Name;
} }
#endregion #endregion
#region GetHashCode #region GetHashCode
public override int GetHashCode() public override int GetHashCode()
{ {
return Name.GetHashCode(); return Name.GetHashCode();
} }
#endregion #endregion
#region Operator overloading #region Operator overloading
public static bool operator ==(Song first, Song second) public static bool operator ==(Song first, Song second)
{ {
return object.Equals(first, second); return object.Equals(first, second);
} }
public static bool operator !=(Song first, Song second) public static bool operator !=(Song first, Song second)
{ {
return !(first == second); return !(first == second);
} }
#endregion #endregion
} }
} }

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
@ -8,6 +9,9 @@ using System.Collections.Generic;
namespace ANX.Framework.Media namespace ANX.Framework.Media
{ {
[PercentageComplete(100)]
[Developer("AstrorEnales")]
[TestState(TestStateAttribute.TestState.InProgress)]
public sealed class SongCollection : IEnumerable<Song>, IEnumerable, IDisposable public sealed class SongCollection : IEnumerable<Song>, IEnumerable, IDisposable
{ {
private readonly List<Song> songs; private readonly List<Song> songs;

View File

@ -1,4 +1,5 @@
using System; using System;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
@ -6,6 +7,9 @@ using System;
namespace ANX.Framework.Media namespace ANX.Framework.Media
{ {
[PercentageComplete(10)]
[Developer("AstrorEnales")]
[TestState(TestStateAttribute.TestState.Untested)]
public sealed class Video public sealed class Video
{ {
internal TimeSpan PlayPosition internal TimeSpan PlayPosition

View File

@ -1,5 +1,6 @@
using System; using System;
using ANX.Framework.Graphics; using ANX.Framework.Graphics;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
@ -7,6 +8,9 @@ using ANX.Framework.Graphics;
namespace ANX.Framework.Media namespace ANX.Framework.Media
{ {
[PercentageComplete(50)]
[Developer("AstrorEnales")]
[TestState(TestStateAttribute.TestState.Untested)]
public sealed class VideoPlayer : IDisposable public sealed class VideoPlayer : IDisposable
{ {
private float volume; private float volume;

View File

@ -1,4 +1,5 @@
using System; using System;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
@ -6,6 +7,9 @@ using System;
namespace ANX.Framework.Media namespace ANX.Framework.Media
{ {
[PercentageComplete(100)]
[Developer("AstrorEnales")]
[TestState(TestStateAttribute.TestState.Tested)]
[Flags] [Flags]
public enum VideoSoundtrackType public enum VideoSoundtrackType
{ {

View File

@ -1,4 +1,5 @@
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
@ -6,6 +7,9 @@ using System.Collections.ObjectModel;
namespace ANX.Framework.Media namespace ANX.Framework.Media
{ {
[PercentageComplete(100)]
[Developer("AstrorEnales")]
[TestState(TestStateAttribute.TestState.Untested)]
public class VisualizationData public class VisualizationData
{ {
internal readonly float[] FrequencyData; internal readonly float[] FrequencyData;

View File

@ -41,6 +41,7 @@
<Compile Include="SupportedPlatformsImpl.cs" /> <Compile Include="SupportedPlatformsImpl.cs" />
<Compile Include="WindowsContentManager.cs" /> <Compile Include="WindowsContentManager.cs" />
<Compile Include="WindowsGameTimer.cs" /> <Compile Include="WindowsGameTimer.cs" />
<Compile Include="WindowsMediaLibrary.cs" />
<Compile Include="WindowsStorageContainer.cs" /> <Compile Include="WindowsStorageContainer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WindowsGameHost.cs" /> <Compile Include="WindowsGameHost.cs" />
@ -55,6 +56,17 @@
<Name>ANX.Framework</Name> <Name>ANX.Framework</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<COMReference Include="WMPLib">
<Guid>{6BF52A50-394A-11D3-B153-00C04F79FAA6}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -42,6 +42,7 @@
<Compile Include="SupportedPlatformsImpl.cs" /> <Compile Include="SupportedPlatformsImpl.cs" />
<Compile Include="WindowsContentManager.cs" /> <Compile Include="WindowsContentManager.cs" />
<Compile Include="WindowsGameTimer.cs" /> <Compile Include="WindowsGameTimer.cs" />
<Compile Include="WindowsMediaLibrary.cs" />
<Compile Include="WindowsStorageContainer.cs" /> <Compile Include="WindowsStorageContainer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WindowsGameHost.cs" /> <Compile Include="WindowsGameHost.cs" />
@ -56,6 +57,17 @@
<Name>ANX.Framework</Name> <Name>ANX.Framework</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<COMReference Include="WMPLib">
<Guid>{6BF52A50-394A-11D3-B153-00C04F79FAA6}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Sce\Sce.Psm.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Sce\Sce.Psm.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -43,6 +43,7 @@
<Compile Include="SupportedPlatformsImpl.cs" /> <Compile Include="SupportedPlatformsImpl.cs" />
<Compile Include="WindowsContentManager.cs" /> <Compile Include="WindowsContentManager.cs" />
<Compile Include="WindowsGameTimer.cs" /> <Compile Include="WindowsGameTimer.cs" />
<Compile Include="WindowsMediaLibrary.cs" />
<Compile Include="WindowsStorageContainer.cs" /> <Compile Include="WindowsStorageContainer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WindowsGameHost.cs" /> <Compile Include="WindowsGameHost.cs" />
@ -57,6 +58,17 @@
<Name>ANX.Framework</Name> <Name>ANX.Framework</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<COMReference Include="WMPLib">
<Guid>{6BF52A50-394A-11D3-B153-00C04F79FAA6}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -1,20 +1,260 @@
using System; using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq;
using ANX.Framework.Media; using ANX.Framework.Media;
using ANX.Framework.NonXNA.PlatformSystem; using ANX.Framework.NonXNA.PlatformSystem;
using WMPLib; using WMPLib;
namespace ANX.PlatformSystem.Windows namespace ANX.PlatformSystem.Windows
{ {
class WindowsMediaLibrary : INativeMediaLibrary /// <summary>
/// List of media item attributes: http://msdn.microsoft.com/en-us/library/dd562379%28v=vs.85%29.aspx
/// </summary>
public class WindowsMediaLibrary : INativeMediaLibrary
{ {
private enum MediaType
{
Audio,
Other,
Photo,
Playlist,
Radio,
Video
}
private PictureCollection pictureCollection;
private PictureAlbum rootPictureAlbum;
private PictureCollection savedPictures;
private SongCollection songs;
private ArtistCollection artists;
private GenreCollection genres;
private PlaylistCollection playlists;
private AlbumCollection albums;
private WindowsMediaPlayer nativePlayer; private WindowsMediaPlayer nativePlayer;
public WindowsMediaLibrary() public WindowsMediaLibrary()
{ {
nativePlayer = new WindowsMediaPlayer(); nativePlayer = new WindowsMediaPlayer();
CollectAllData();
} }
#region CollectAllData
private void CollectAllData()
{
var allArtists = new List<Artist>();
var allSongs = new List<Song>();
var allAlbums = new List<Album>();
var allPictures = new List<Picture>();
var allGenres = new List<Genre>();
var allPictureAlbums = new List<PictureAlbum>();
var list = nativePlayer.mediaCollection.getAll();
for (int index = 0; index < list.count; index++)
{
var media = list.Item[index];
string id = media.getItemInfo("TrackingID");
if (GetType(media) == MediaType.Audio)
{
string artistName = media.getItemInfo("Author");
var newArtist = GetArtist(artistName, allArtists);
string albumId = media.getItemInfo("AlbumID");
string albumName = media.getItemInfo("WM/AlbumTitle");
string albumArtistName = albumName.Length > 0 ? albumId.Replace(albumName, "") : artistName;
if (albumArtistName.Length == 0)
albumArtistName = artistName;
var newAlbum = GetAlbum(albumId, allAlbums);
newAlbum.Name = albumName;
newAlbum.Artist = GetArtist(albumArtistName, allArtists);
string genreName = media.getItemInfo("WM/Genre");
Genre newGenre = GetGenre(genreName, allGenres);
int duration = GetMediaDuration(media, "Duration");
string name = media.getItemInfo("Title");
var newSong = new Song(name, id, media.sourceURL, duration)
{
Artist = newArtist,
Album = newAlbum,
Genre = newGenre,
Rating = GetMediaIntValue(media, "UserRating", 0),
TrackNumber = GetMediaIntValue(media, "WM/TrackNumber", 0),
PlayCount = GetMediaIntValue(media, "UserPlayCount", 0),
IsProtected = GetMediaBoolValue(media, "Is_Protected", false),
};
allSongs.Add(newSong);
}
else if (GetType(media) == MediaType.Photo)
{
string name = media.getItemInfo("Title");
var newPicture = new Picture(id)
{
Name = name,
};
allPictures.Add(newPicture);
}
}
foreach (Artist artist in allArtists)
{
var allSongsFromArtist = allSongs.Where(song => song.Artist == artist).ToArray();
artist.Songs = new SongCollection(allSongsFromArtist);
var allAlbumsFromArtist = allAlbums.Where(album => album.Artist == artist).ToArray();
artist.Albums = new AlbumCollection(allAlbumsFromArtist);
}
foreach (Album album in allAlbums)
{
var allSongsFromAlbum = allSongs.Where(song => song.Album == album).ToArray();
album.Songs = new SongCollection(allSongsFromAlbum);
}
foreach (Genre genre in allGenres)
{
var allSongsInGenre = allSongs.Where(song => song.Genre == genre).ToArray();
genre.Songs = new SongCollection(allSongsInGenre);
// TODO: albums
}
songs = new SongCollection(allSongs);
pictureCollection = new PictureCollection(allPictures);
artists = new ArtistCollection(allArtists);
albums = new AlbumCollection(allAlbums);
genres = new GenreCollection(allGenres);
// TODO
rootPictureAlbum = null;
playlists = new PlaylistCollection();
savedPictures = new PictureCollection(new Picture[0]);
}
#endregion
private Artist GetArtist(string name, List<Artist> allArtists)
{
foreach (Artist artist in allArtists)
if (artist.Name == name)
return artist;
var newArtist = new Artist(name);
allArtists.Add(newArtist);
return newArtist;
}
private Genre GetGenre(string name, List<Genre> allGenres)
{
foreach (Genre genre in allGenres)
if (genre.Name == name)
return genre;
var newGenre = new Genre(name);
allGenres.Add(newGenre);
return newGenre;
}
private Album GetAlbum(string id, List<Album> allAlbums)
{
foreach (Album album in allAlbums)
if (album.Name == id)
return album;
var newAlbum = new Album(id);
allAlbums.Add(newAlbum);
return newAlbum;
}
#region GetMethods
public PictureCollection GetPictures()
{
return pictureCollection;
}
public PictureAlbum GetRootPictureAlbum()
{
return rootPictureAlbum;
}
public PictureCollection GetSavedPictures()
{
return savedPictures;
}
public SongCollection GetSongs()
{
return songs;
}
public ArtistCollection GetArtists()
{
return artists;
}
public AlbumCollection GetAlbums()
{
return albums;
}
public PlaylistCollection GetPlaylists()
{
return playlists;
}
public GenreCollection GetGenres()
{
return genres;
}
#endregion
#region GetMediaBoolValue
private bool GetMediaBoolValue(IWMPMedia media, string name, bool defaultValue)
{
string value = media.getItemInfo(name);
bool result;
return bool.TryParse(value, out result) == false ? defaultValue : result;
}
#endregion
#region GetMediaDuration
private int GetMediaDuration(IWMPMedia media, string name)
{
string value = media.getItemInfo(name).Replace(',', '.');
float seconds;
if (float.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out seconds) == false)
return 0;
return (int)(seconds * 1000f);
}
#endregion
#region GetMediaIntValue
private int GetMediaIntValue(IWMPMedia media, string name, int defaultValue)
{
string value = media.getItemInfo(name);
int result;
return int.TryParse(value, out result) == false ? defaultValue : result;
}
#endregion
#region GetType
private static MediaType GetType(IWMPMedia media)
{
switch (media.getItemInfo("MediaType"))
{
case "audio":
return MediaType.Audio;
default:
return MediaType.Other;
case "photo":
return MediaType.Photo;
case "playlist":
return MediaType.Playlist;
case "radio":
return MediaType.Radio;
case "video":
return MediaType.Video;
}
}
#endregion
public Picture SavePicture(string file, Stream data) public Picture SavePicture(string file, Stream data)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
@ -30,60 +270,24 @@ namespace ANX.PlatformSystem.Windows
throw new NotImplementedException(); throw new NotImplementedException();
} }
public PictureCollection GetPictures() #region Dispose
{
throw new NotImplementedException();
}
public PictureAlbum GetRootPictureAlbum()
{
throw new NotImplementedException();
}
public PictureCollection GetSavedPictures()
{
throw new NotImplementedException();
}
public SongCollection GetSongs()
{
var collection = nativePlayer.mediaCollection;
var list = collection.getAll();
var songs = new Song[list.count];
// TODO: sort out songs!
for (int index = 0; index < songs.Length; index++)
{
var newSong = new Song(list.Item[index].name);
songs[index] = newSong;
}
return new SongCollection(songs);
}
public ArtistCollection GetArtists()
{
throw new NotImplementedException();
}
public AlbumCollection GetAlbums()
{
throw new NotImplementedException();
}
public PlaylistCollection GetPlaylists()
{
throw new NotImplementedException();
}
public GenreCollection GetGenres()
{
throw new NotImplementedException();
}
public void Dispose() public void Dispose()
{ {
pictureCollection = null;
rootPictureAlbum = null;
savedPictures = null;
songs = null;
artists = null;
genres = null;
playlists = null;
albums = null;
if (nativePlayer != null) if (nativePlayer != null)
{
nativePlayer.close(); nativePlayer.close();
nativePlayer = null; nativePlayer = null;
}
} }
#endregion
} }
} }

View File

@ -169,13 +169,13 @@ namespace ANX.SoundSystem.OpenAL
public ISong CreateSong(Song parentSong, Uri uri) public ISong CreateSong(Song parentSong, Uri uri)
{ {
PreventSystemChange(); PreventSystemChange();
return new OpenALSong(parentSong, uri); return new OpenALSong(uri);
} }
public ISong CreateSong(Song parentSong, string filepath, int duration) public ISong CreateSong(Song parentSong, string filepath, int duration)
{ {
PreventSystemChange(); PreventSystemChange();
return new OpenALSong(parentSong, filepath, duration); return new OpenALSong(filepath, duration);
} }
#endregion #endregion

View File

@ -16,35 +16,37 @@ namespace ANX.SoundSystem.OpenAL
[Developer("AstrorEnales")] [Developer("AstrorEnales")]
public class OpenALSong : ISong public class OpenALSong : ISong
{ {
private Song parent;
private FileStream oggFileStream; private FileStream oggFileStream;
private OggInputStream oggStream; private OggInputStream oggStream;
private int[] bufferHandles; private int[] bufferHandles;
private int sourceHandle = InvalidHandle; private int sourceHandle = InvalidHandle;
private const int InvalidHandle = -1; private const int InvalidHandle = -1;
private static readonly byte[] streamReadBuffer = new byte[4096 * 8]; private static readonly byte[] StreamReadBuffer = new byte[4096 * 8];
private string filepath;
private bool isInitialized;
public TimeSpan Duration { get; private set; } public TimeSpan Duration { get; private set; }
public TimeSpan PlayPosition { get; private set; } public TimeSpan PlayPosition { get; private set; }
public MediaState State { get; private set; } public MediaState State { get; private set; }
public OpenALSong(Song setParent, Uri uri) public OpenALSong(Uri uri)
{ {
string path = uri.AbsolutePath.Replace("%20", ""); filepath = uri.AbsolutePath.Replace("%20", "");
parent = setParent;
Init(path);
// TODO: duration // TODO: duration
} }
public OpenALSong(Song setParent, string filepath, int duration) public OpenALSong(string filepath, int duration)
{ {
parent = setParent; this.filepath = filepath;
Init(filepath);
Duration = new TimeSpan(0, 0, 0, 0, duration); Duration = new TimeSpan(0, 0, 0, 0, duration);
} }
private void Init(string filepath) private void Init()
{ {
if (Path.GetExtension(filepath).ToLower() != ".ogg")
throw new NotImplementedException("Currently only ogg playback is implemented!");
isInitialized = true;
PlayPosition = TimeSpan.Zero; PlayPosition = TimeSpan.Zero;
State = MediaState.Stopped; State = MediaState.Stopped;
@ -56,6 +58,9 @@ namespace ANX.SoundSystem.OpenAL
public void Play() public void Play()
{ {
if (isInitialized == false)
Init();
if (State == MediaState.Playing) if (State == MediaState.Playing)
return; return;
@ -141,14 +146,14 @@ namespace ANX.SoundSystem.OpenAL
internal bool Stream(int bufferHandle) internal bool Stream(int bufferHandle)
{ {
int size = oggStream.Read(streamReadBuffer); int size = oggStream.Read(StreamReadBuffer);
bool dataAvailable = size > 0; bool dataAvailable = size > 0;
if (dataAvailable) if (dataAvailable)
{ {
var channels = (AudioChannels)oggStream.Channels; var channels = (AudioChannels)oggStream.Channels;
PlayPosition = PlayPosition.Add(SoundEffect.GetSampleDuration(size, oggStream.SampleRate, channels)); PlayPosition = PlayPosition.Add(SoundEffect.GetSampleDuration(size, oggStream.SampleRate, channels));
ALFormat format = oggStream.Channels > 1 ? ALFormat.Stereo16 : ALFormat.Mono16; ALFormat format = oggStream.Channels > 1 ? ALFormat.Stereo16 : ALFormat.Mono16;
AL.BufferData(bufferHandle, format, streamReadBuffer, size, oggStream.SampleRate); AL.BufferData(bufferHandle, format, StreamReadBuffer, size, oggStream.SampleRate);
} }
return dataAvailable; return dataAvailable;

View File

@ -22,6 +22,9 @@ namespace ANX.SoundSystem.Windows.XAudio
private SourceVoice source; private SourceVoice source;
private readonly AudioBuffer[] buffers = new AudioBuffer[2]; private readonly AudioBuffer[] buffers = new AudioBuffer[2];
private int nextBufferIndex; private int nextBufferIndex;
private XAudio2 device;
private string filepath;
private bool isInitialized;
public TimeSpan Duration { get; private set; } public TimeSpan Duration { get; private set; }
public TimeSpan PlayPosition { get; private set; } public TimeSpan PlayPosition { get; private set; }
@ -29,19 +32,24 @@ namespace ANX.SoundSystem.Windows.XAudio
public XAudioSong(XAudio2 device, Uri uri) public XAudioSong(XAudio2 device, Uri uri)
{ {
string path = uri.AbsolutePath.Replace("%20", ""); filepath = uri.AbsolutePath.Replace("%20", "");
Init(device, path); this.device = device;
// TODO: duration // TODO: duration
} }
public XAudioSong(XAudio2 device, string filepath, int duration) public XAudioSong(XAudio2 device, string filepath, int duration)
{ {
Init(device, filepath); this.filepath = filepath;
this.device = device;
Duration = new TimeSpan(0, 0, 0, 0, duration); Duration = new TimeSpan(0, 0, 0, 0, duration);
} }
private void Init(XAudio2 device, string filepath) private void Init()
{ {
if (Path.GetExtension(filepath).ToLower() != ".ogg")
throw new NotImplementedException("Currently only ogg playback is implemented!");
isInitialized = true;
PlayPosition = TimeSpan.Zero; PlayPosition = TimeSpan.Zero;
State = MediaState.Stopped; State = MediaState.Stopped;
@ -63,6 +71,9 @@ namespace ANX.SoundSystem.Windows.XAudio
public void Play() public void Play()
{ {
if (isInitialized == false)
Init();
if (State == MediaState.Playing) if (State == MediaState.Playing)
return; return;