Placed the importers into different categories for the "importing existing files" dialog in Visual Studio.

Fixed a performance problem in the Visual Studio extension where no importer or processor was selected for an asset.
Fixed that the asset names for Uri encoded in the build output.
Fixed that errors when serializing assets get logged.
Sped up ImporterManager.GuessImporterByFileExtension, which caused performance problems if many assemblies are loaded into the current AppDomain.
Made the AssimpImporter library deploy the binary files again (hopefully just a temporary solution until we've found a better way.)
Provide a extension for TargetPlatform enum for getting the DisplayName of an entry.
Changed that ProcessorManager.GetProcessorDisplayName doesn't throw an exception if no processor with the given name exists, which now mimicks the same behavior as in importerManager.GetImporterDisplayName.
This commit is contained in:
Konstantin Koch 2015-04-26 19:47:26 +02:00
parent 8287c54432
commit 17d0771b03
33 changed files with 570 additions and 508 deletions

3
.gitignore vendored
View File

@ -7,4 +7,5 @@ obj
*.cachefile *.cachefile
/packages/** /packages/**
/package /package
/UpgradeLog.htm /UpgradeLog.htm
log.txt

View File

@ -38,6 +38,7 @@
<Reference Include="System.Core" /> <Reference Include="System.Core" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AssimpDeploy.cs" />
<Compile Include="Graphics\AssimpMaterialContent.cs" /> <Compile Include="Graphics\AssimpMaterialContent.cs" />
<Compile Include="Importer\AssimpExtensions.cs" /> <Compile Include="Importer\AssimpExtensions.cs" />
<Compile Include="Importer\AssimpImporter.cs" /> <Compile Include="Importer\AssimpImporter.cs" />
@ -58,6 +59,14 @@
<Name>ANX.Framework</Name> <Name>ANX.Framework</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\packages\AssimpNet.3.3.1\lib\Assimp32.dll">
<Link>Assimp32.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="..\packages\AssimpNet.3.3.1\lib\Assimp64.dll">
<Link>Assimp64.dll</Link>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\AssimpNet.3.3.1\build\AssimpNet.targets" Condition="Exists('..\packages\AssimpNet.3.3.1\build\AssimpNet.targets')" /> <Import Project="..\packages\AssimpNet.3.3.1\build\AssimpNet.targets" Condition="Exists('..\packages\AssimpNet.3.3.1\build\AssimpNet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

View File

@ -46,7 +46,7 @@ namespace ANX.Framework.Content.Pipeline
this.identity = new ContentIdentity(filename, this.GetType().Name); this.identity = new ContentIdentity(filename, this.GetType().Name);
//AssimpDeploy.DeployLibraries(); AssimpDeploy.DeployLibraries();
Assimp.AssimpContext assimpContext = new AssimpContext(); Assimp.AssimpContext assimpContext = new AssimpContext();

View File

@ -12,7 +12,7 @@ namespace ANX.Framework.Content.Pipeline
{ {
try try
{ {
//AssimpDeploy.DeployLibraries(); AssimpDeploy.DeployLibraries();
Assimp.AssimpContext context = new Assimp.AssimpContext(); Assimp.AssimpContext context = new Assimp.AssimpContext();

View File

@ -32,8 +32,8 @@ namespace ANX.Framework.Content.Pipeline.Graphics
//Data in a DXT texture is compressed in blocks of 4x4 pixels, the block size is the resolution for this blocks. //Data in a DXT texture is compressed in blocks of 4x4 pixels, the block size is the resolution for this blocks.
//The block size is also the reason why width and height must be a multiple of four. //The block size is also the reason why width and height must be a multiple of four.
width = (width + 3) / 4; width = (width + 3) / 4;
height = (height + 3) / 4; height = (height + 3) / 4;
_pixelData = new byte[width * height * blockSize]; _pixelData = new byte[width * height * blockSize];
} }
public override byte[] GetPixelData() public override byte[] GetPixelData()

View File

@ -11,7 +11,7 @@ using ANX.Framework.NonXNA;
namespace ANX.Framework.Content.Pipeline namespace ANX.Framework.Content.Pipeline
{ {
[ContentImporter(new string[] { ".fx", ".fxg", ".hlsl", ".glsl" })] [ContentImporter(new string[] { ".fx", ".fxg", ".hlsl", ".glsl" }, Category = "Effect Files")]
public class EffectImporter : ContentImporter<EffectContent> public class EffectImporter : ContentImporter<EffectContent>
{ {
public override EffectContent Import(string filename, ContentImporterContext context) public override EffectContent Import(string filename, ContentImporterContext context)

View File

@ -23,7 +23,7 @@ namespace ANX.Framework.Content.Pipeline.Importer
[PercentageComplete(90)] [PercentageComplete(90)]
[Developer("SilentWarrior/Eagle Eye Studios, KorsarNek")] [Developer("SilentWarrior/Eagle Eye Studios, KorsarNek")]
[TestState(TestStateAttribute.TestState.InProgress)] //Works but there should be a check whether the characters are supported [TestState(TestStateAttribute.TestState.InProgress)] //Works but there should be a check whether the characters are supported
[ContentImporter("Spritefont", ".spritefont", DefaultProcessor = "FontDescriptionProcessor", DisplayName = "FontDescription Importer - ANX Framework")] [ContentImporter("Spritefont", ".spritefont", DefaultProcessor = "FontDescriptionProcessor", DisplayName = "FontDescription Importer - ANX Framework", Category = "Font Files")]
public class FontDescriptionImporter : ContentImporter<FontDescription> public class FontDescriptionImporter : ContentImporter<FontDescription>
{ {
/// <summary> /// <summary>

View File

@ -7,6 +7,8 @@ using ANX.Framework.Content.Pipeline.Graphics;
using ANX.Framework.Content; using ANX.Framework.Content;
using System.IO; using System.IO;
using System.Drawing; using System.Drawing;
using ANX.Framework.Content.Pipeline.Helpers;
using System.Runtime.InteropServices;
#endregion #endregion
@ -16,16 +18,30 @@ using System.Drawing;
namespace ANX.Framework.Content.Pipeline.Importer namespace ANX.Framework.Content.Pipeline.Importer
{ {
[ContentImporter(new string[] { ".bmp", ".jpg", ".jpeg", ".png", ".wdp", ".gif", ".tif" }, DefaultProcessor = "SpriteTextureProcessor")] [ContentImporter(new string[] { ".bmp", ".jpg", ".jpeg", ".png", ".wdp", ".gif", ".tif", ".tga", ".dds" }, DefaultProcessor = "TextureProcessor", Category = "Texture Files", DisplayName = "TextureImporter - ANX Framework")]
public class TextureImporter : ContentImporter<TextureContent> public class TextureImporter : ContentImporter<TextureContent>
{ {
public override TextureContent Import(string filename, ContentImporterContext context) public override TextureContent Import(string filename, ContentImporterContext context)
{ {
string fileExtension = Path.GetExtension(filename).ToLowerInvariant(); string fileExtension = Path.GetExtension(filename).ToLowerInvariant();
Image image = Bitmap.FromFile(filename); BitmapContent bitmapContent;
if (fileExtension == ".tga" || fileExtension == ".dds")
bitmapContent = LoadByRendersystem(filename);
else
bitmapContent = LoadByGdi(filename);
TextureContent textureContent = new Texture2DContent();
textureContent.Faces[0] = new MipmapChain(bitmapContent);
return textureContent;
}
private BitmapContent LoadByGdi(string fileName)
{
Image image = Bitmap.FromFile(fileName);
Bitmap bitmap = new Bitmap(image); Bitmap bitmap = new Bitmap(image);
PixelBitmapContent<Color> bitmapContent = new PixelBitmapContent<Color>(image.Width, image.Height); var bitmapContent = new PixelBitmapContent<Color>(image.Width, image.Height);
System.Drawing.Color sourceColor; System.Drawing.Color sourceColor;
ANX.Framework.Color destColor = new Color(); ANX.Framework.Color destColor = new Color();
@ -44,10 +60,31 @@ namespace ANX.Framework.Content.Pipeline.Importer
} }
} }
TextureContent textureContent = new Texture2DContent(); return bitmapContent;
textureContent.Faces[0] = new MipmapChain(bitmapContent); }
return textureContent; private BitmapContent LoadByRendersystem(string fileName)
{
using (FileStream stream = new FileStream(fileName, FileMode.Open, FileAccess.Read))
{
var texture = ANX.Framework.Graphics.Texture2D.FromStream(GraphicsHelper.ReferenceDevice, stream);
Type vectorType;
if (VectorConverter.TryGetVectorType(texture.Format, out vectorType))
{
var content = (BitmapContent)Activator.CreateInstance(typeof(PixelBitmapContent<>).MakeGenericType(vectorType), texture.Width, texture.Height);
byte[] data = new byte[texture.Width * texture.Height * Marshal.SizeOf(vectorType)];
texture.GetData<byte>(data);
content.SetPixelData(data);
return content;
}
else
{
throw new InvalidContentException("Unable to convert file format.");
}
}
} }
} }
} }

View File

@ -9,7 +9,7 @@ using WaveUtils;
namespace ANX.Framework.Content.Pipeline.Importer namespace ANX.Framework.Content.Pipeline.Importer
{ {
[ContentImporter(new string[] { ".wav" }, DefaultProcessor = "SoundEffectProcessor")] [ContentImporter(new string[] { ".wav" }, DefaultProcessor = "SoundEffectProcessor", Category="Sound Files")]
public class WavImporter : ContentImporter<AudioContent> public class WavImporter : ContentImporter<AudioContent>
{ {
public override AudioContent Import(string filename, ContentImporterContext context) public override AudioContent Import(string filename, ContentImporterContext context)

View File

@ -10,6 +10,7 @@ using System.Xml.Linq;
using ANX.Framework.NonXNA.Development; using ANX.Framework.NonXNA.Development;
using ANX.Framework.NonXNA.Reflection; using ANX.Framework.NonXNA.Reflection;
using ANX.Framework.Content.Pipeline.Serialization.Intermediate; using ANX.Framework.Content.Pipeline.Serialization.Intermediate;
using System.ComponentModel;
#endregion #endregion
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
@ -18,13 +19,12 @@ using ANX.Framework.Content.Pipeline.Serialization.Intermediate;
namespace ANX.Framework.Content.Pipeline.Importer namespace ANX.Framework.Content.Pipeline.Importer
{ {
[ContentImporter(new[] { ".xml" })] [ContentImporter(new[] { ".xml" }, Category="XML Files")]
[Developer("KorsarNek")] [Developer("KorsarNek")]
[PercentageComplete(100)] [PercentageComplete(100)]
[TestState(TestStateAttribute.TestState.InProgress)] [TestState(TestStateAttribute.TestState.InProgress)]
public class XmlImporter : ContentImporter<object> public class XmlImporter : ContentImporter<object>
{ {
private XDocument _doc;
public override object Import(string filename, ContentImporterContext context) public override object Import(string filename, ContentImporterContext context)
{ {
using (XmlReader xmlReader = XmlReader.Create(filename)) using (XmlReader xmlReader = XmlReader.Create(filename))

View File

@ -27,7 +27,7 @@ namespace ANX.Framework.Content.Pipeline.Serialization.Compiler
{ {
if (output.TargetPlatform != TargetPlatform.Windows) if (output.TargetPlatform != TargetPlatform.Windows)
{ {
throw new InvalidOperationException("currently only HLSL windows effects are supported by EffectWriter"); throw new InvalidOperationException("Currently only HLSL effects for windows are supported by EffectWriter.");
} }
byte[] effectCode = value.GetEffectCode(); byte[] effectCode = value.GetEffectCode();

View File

@ -24,4 +24,28 @@ namespace ANX.Framework.Content.Pipeline
WindowsMetro = (byte)'8', WindowsMetro = (byte)'8',
} }
public static class TargetPlatformExtension
{
public static string ToDisplayName(this TargetPlatform targetPlatform)
{
switch (targetPlatform)
{
case TargetPlatform.IOS:
return "iOS";
case TargetPlatform.MacOs:
return "Mac OS";
case TargetPlatform.PsVita:
return "PS Vita";
case TargetPlatform.WindowsMetro:
return "Windows Metro";
case TargetPlatform.WindowsPhone:
return "Windows Phone";
case TargetPlatform.XBox360:
return "XBox 360";
default:
return targetPlatform.ToString();
}
}
}
} }

View File

@ -246,9 +246,16 @@ namespace ANX.Framework.Content.Pipeline.Tasks
if (compiledItem != null) if (compiledItem != null)
{ {
SerializeAsset(buildItem, compiledItem, outputFilename.LocalPath); try
{
SerializeAsset(buildItem, compiledItem, outputFilename.LocalPath);
compiled = new CompiledBuildItem(compiledItem, buildItem, outputFilename.LocalPath, true); compiled = new CompiledBuildItem(compiledItem, buildItem, outputFilename.LocalPath, true);
}
catch (Exception exc)
{
LogException(exc, absoluteFilename);
}
} }
} }
@ -323,7 +330,7 @@ namespace ANX.Framework.Content.Pipeline.Tasks
} }
IContentImporter importer = this.ImporterManager.GetInstance(importerName); IContentImporter importer = this.ImporterManager.GetInstance(importerName);
buildLogger.LogMessage("importing {0} with importer {1}", Uri.EscapeUriString(item.SourceFilename.ToString()), importer.GetType()); buildLogger.LogMessage("importing {0} with importer {1}", item.SourceFilename.ToString(), importer.GetType());
object result = importer.Import(absoluteFilename, context); object result = importer.Import(absoluteFilename, context);

View File

@ -32,7 +32,7 @@ namespace ANX.Framework.Content.Pipeline.Tasks
#if LINUX #if LINUX
Console.WriteLine("ImporterManager: Checking " + assembly.FullName); Console.WriteLine("ImporterManager: Checking " + assembly.FullName);
#endif #endif
foreach (Type type in ANX.Framework.NonXNA.Reflection.TypeHelper.SafelyExtractTypesFrom(assembly)) foreach (Type type in ANX.Framework.NonXNA.Reflection.TypeHelper.SafelyExtractTypesFrom(assembly))
{ {
if (type == null) if (type == null)
continue; continue;
@ -110,23 +110,20 @@ namespace ANX.Framework.Content.Pipeline.Tasks
} }
public static String GuessImporterByFileExtension(string filename) public String GuessImporterByFileExtension(string filename)
{ {
String extension = System.IO.Path.GetExtension(filename); String extension = System.IO.Path.GetExtension(filename);
foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) foreach (var type in this.importerTypes.Values)
{ {
foreach (Type type in assembly.GetTypes()) ContentImporterAttribute[] value = (ContentImporterAttribute[])type.GetCustomAttributes(typeof(ContentImporterAttribute), true);
foreach (ContentImporterAttribute cia in value)
{ {
ContentImporterAttribute[] value = (ContentImporterAttribute[])type.GetCustomAttributes(typeof(ContentImporterAttribute), true); foreach (string fe in cia.FileExtensions)
foreach (ContentImporterAttribute cia in value)
{ {
foreach (string fe in cia.FileExtensions) if (string.Equals(fe, extension, StringComparison.InvariantCultureIgnoreCase))
{ {
if (string.Equals(fe, extension, StringComparison.InvariantCultureIgnoreCase)) return type.Name;
{
return type.Name;
}
} }
} }
} }

View File

@ -78,11 +78,13 @@ namespace ANX.Framework.Content.Pipeline.Tasks
public string GetProcessorDisplayName(string proccessorName) public string GetProcessorDisplayName(string proccessorName)
{ {
var attribute = this.GetInstance(proccessorName).GetType().GetCustomAttributes(typeof(ContentProcessorAttribute), true).Cast<ContentProcessorAttribute>().FirstOrDefault(); if (this.processors.ContainsKey(proccessorName))
if (attribute != null && !string.IsNullOrEmpty(attribute.DisplayName)) {
return attribute.DisplayName; var attribute = this.GetInstance(proccessorName).GetType().GetCustomAttributes(typeof(ContentProcessorAttribute), true).Cast<ContentProcessorAttribute>().FirstOrDefault();
else if (attribute != null && !string.IsNullOrEmpty(attribute.DisplayName))
return proccessorName; return attribute.DisplayName;
}
return proccessorName;
} }
public String GetProcessorForType(Type inputType) public String GetProcessorForType(Type inputType)

View File

@ -10,153 +10,153 @@ namespace ANX.Framework.Audio
[PercentageComplete(5)] [PercentageComplete(5)]
[Developer("AstrorEnales")] [Developer("AstrorEnales")]
[TestState(TestStateAttribute.TestState.Untested)] [TestState(TestStateAttribute.TestState.Untested)]
public sealed class Cue : IDisposable public sealed class Cue : IDisposable
{ {
#region Events #region Events
public event EventHandler<EventArgs> Disposing; public event EventHandler<EventArgs> Disposing;
#endregion #endregion
#region Public #region Public
public bool IsCreated public bool IsCreated
{ {
get get
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
} }
public bool IsDisposed public bool IsDisposed
{ {
get; get;
private set; private set;
} }
public bool IsPaused public bool IsPaused
{ {
get get
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
} }
public bool IsPlaying public bool IsPlaying
{ {
get get
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
} }
public bool IsPrepared public bool IsPrepared
{ {
get get
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
} }
public bool IsPreparing public bool IsPreparing
{ {
get get
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
} }
public bool IsStopped public bool IsStopped
{ {
get get
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
} }
public bool IsStopping public bool IsStopping
{ {
get get
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
} }
public string Name public string Name
{ {
get get
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
} }
#endregion #endregion
#region Constructor #region Constructor
internal Cue() internal Cue()
{ {
} }
~Cue() ~Cue()
{ {
Dispose(); Dispose();
} }
#endregion #endregion
#region Apply3D #region Apply3D
public void Apply3D(AudioListener listener, AudioEmitter emitter) public void Apply3D(AudioListener listener, AudioEmitter emitter)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
#endregion #endregion
#region SetVariable #region SetVariable
public void SetVariable(string name, float value) public void SetVariable(string name, float value)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
#endregion #endregion
#region GetVariable #region GetVariable
public float GetVariable(string name) public float GetVariable(string name)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
#endregion #endregion
#region Pause #region Pause
public void Pause() public void Pause()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
#endregion #endregion
#region Play #region Play
public void Play() public void Play()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
#endregion #endregion
#region Resume #region Resume
public void Resume() public void Resume()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
#endregion #endregion
#region Stop #region Stop
public void Stop(AudioStopOptions options) public void Stop(AudioStopOptions options)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
#endregion #endregion
#region Dispose #region Dispose
public void Dispose() public void Dispose()
{ {
if (IsDisposed == false) if (IsDisposed == false)
{ {
IsDisposed = true; IsDisposed = true;
throw new NotImplementedException(); throw new NotImplementedException();
} }
} }
#endregion #endregion
} }
} }

View File

@ -8,22 +8,22 @@ namespace ANX.Framework.Graphics.PackedVector
[PercentageComplete(100)] [PercentageComplete(100)]
[Developer("Glatzemann")] [Developer("Glatzemann")]
[TestState(TestStateAttribute.TestState.Tested)] [TestState(TestStateAttribute.TestState.Tested)]
public interface IPackedVector public interface IPackedVector
{ {
void PackFromVector4(Vector4 vector); void PackFromVector4(Vector4 vector);
Vector4 ToVector4(); Vector4 ToVector4();
} }
[PercentageComplete(100)] [PercentageComplete(100)]
[Developer("Glatzemann")] [Developer("Glatzemann")]
[TestState(TestStateAttribute.TestState.Tested)] [TestState(TestStateAttribute.TestState.Tested)]
public interface IPackedVector<TPacked> : IPackedVector public interface IPackedVector<TPacked> : IPackedVector
{ {
TPacked PackedValue TPacked PackedValue
{ {
get; get;
set; set;
} }
} }
} }

View File

@ -17,192 +17,192 @@ namespace ANX.Framework.Graphics
[PercentageComplete(70)] [PercentageComplete(70)]
[Developer("Glatzemann")] [Developer("Glatzemann")]
[TestState(TestStateAttribute.TestState.Untested)] [TestState(TestStateAttribute.TestState.Untested)]
public class Texture2D : Texture, IGraphicsResource public class Texture2D : Texture, IGraphicsResource
{ {
#region Private #region Private
protected internal int width; protected internal int width;
protected internal int height; protected internal int height;
internal float OneOverWidth; internal float OneOverWidth;
internal float OneOverHeight; internal float OneOverHeight;
private INativeTexture2D nativeTexture2D; private INativeTexture2D nativeTexture2D;
private INativeTexture2D NativeTexture2D private INativeTexture2D NativeTexture2D
{ {
get get
{ {
if (nativeTexture2D == null) if (nativeTexture2D == null)
CreateNativeTextureSurface(); CreateNativeTextureSurface();
return nativeTexture2D; return nativeTexture2D;
} }
} }
#endregion #endregion
#region Public #region Public
public Rectangle Bounds public Rectangle Bounds
{ {
get get
{ {
return new Rectangle(0, 0, this.width, this.height); return new Rectangle(0, 0, this.width, this.height);
} }
} }
public int Width public int Width
{ {
get get
{ {
return this.width; return this.width;
} }
} }
public int Height public int Height
{ {
get get
{ {
return this.height; return this.height;
} }
} }
#endregion #endregion
#region Constructor (TODO) #region Constructor (TODO)
internal Texture2D(GraphicsDevice graphicsDevice) internal Texture2D(GraphicsDevice graphicsDevice)
: base(graphicsDevice) : base(graphicsDevice)
{ {
} }
public Texture2D(GraphicsDevice graphicsDevice, int width, int height) public Texture2D(GraphicsDevice graphicsDevice, int width, int height)
: base(graphicsDevice) : base(graphicsDevice)
{ {
this.width = width; this.width = width;
this.height = height; this.height = height;
OneOverWidth = 1f / width; OneOverWidth = 1f / width;
OneOverHeight = 1f / height; OneOverHeight = 1f / height;
base.LevelCount = 1; base.LevelCount = 1;
base.Format = SurfaceFormat.Color; base.Format = SurfaceFormat.Color;
CreateNativeTextureSurface(); CreateNativeTextureSurface();
} }
public Texture2D(GraphicsDevice graphicsDevice, int width, int height, [MarshalAsAttribute(UnmanagedType.U1)] bool mipMap, public Texture2D(GraphicsDevice graphicsDevice, int width, int height, [MarshalAsAttribute(UnmanagedType.U1)] bool mipMap,
SurfaceFormat format) SurfaceFormat format)
: base(graphicsDevice) : base(graphicsDevice)
{ {
this.width = width; this.width = width;
this.height = height; this.height = height;
OneOverWidth = 1f / width; OneOverWidth = 1f / width;
OneOverHeight = 1f / height; OneOverHeight = 1f / height;
// TODO: pass the mipmap parameter to the creation of the texture to let the graphics card generate mipmaps! // TODO: pass the mipmap parameter to the creation of the texture to let the graphics card generate mipmaps!
base.LevelCount = 1; base.LevelCount = 1;
base.Format = format; base.Format = format;
CreateNativeTextureSurface(); CreateNativeTextureSurface();
} }
internal Texture2D(GraphicsDevice graphicsDevice, int width, int height, int mipCount, SurfaceFormat format) internal Texture2D(GraphicsDevice graphicsDevice, int width, int height, int mipCount, SurfaceFormat format)
: base(graphicsDevice) : base(graphicsDevice)
{ {
this.width = width; this.width = width;
this.height = height; this.height = height;
OneOverWidth = 1f / width; OneOverWidth = 1f / width;
OneOverHeight = 1f / height; OneOverHeight = 1f / height;
base.LevelCount = mipCount; base.LevelCount = mipCount;
base.Format = format; base.Format = format;
CreateNativeTextureSurface(); CreateNativeTextureSurface();
} }
#endregion #endregion
#region FromStream (TODO) #region FromStream (TODO)
public static Texture2D FromStream(GraphicsDevice graphicsDevice, Stream stream) public static Texture2D FromStream(GraphicsDevice graphicsDevice, Stream stream)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public static Texture2D FromStream(GraphicsDevice graphicsDevice, Stream stream, int width, int height, public static Texture2D FromStream(GraphicsDevice graphicsDevice, Stream stream, int width, int height,
[MarshalAsAttribute(UnmanagedType.U1)] bool zoom) [MarshalAsAttribute(UnmanagedType.U1)] bool zoom)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
#endregion #endregion
#region GetData #region GetData
public void GetData<T>(int level, Nullable<Rectangle> rect, T[] data, int startIndex, int elementCount) where T : struct public void GetData<T>(int level, Nullable<Rectangle> rect, T[] data, int startIndex, int elementCount) where T : struct
{ {
NativeTexture2D.GetData(level, rect, data, startIndex, elementCount); NativeTexture2D.GetData(level, rect, data, startIndex, elementCount);
} }
public void GetData<T>(T[] data) where T : struct public void GetData<T>(T[] data) where T : struct
{ {
NativeTexture.GetData(data); NativeTexture.GetData(data);
} }
public void GetData<T>(T[] data, int startIndex, int elementCount) where T : struct public void GetData<T>(T[] data, int startIndex, int elementCount) where T : struct
{ {
NativeTexture.GetData(data, startIndex, elementCount); NativeTexture.GetData(data, startIndex, elementCount);
} }
#endregion #endregion
#region SetData #region SetData
public void SetData<T>(int level, Nullable<Rectangle> rect, T[] data, int startIndex, int elementCount) where T : struct public void SetData<T>(int level, Nullable<Rectangle> rect, T[] data, int startIndex, int elementCount) where T : struct
{ {
NativeTexture2D.SetData(level, rect, data, startIndex, elementCount); NativeTexture2D.SetData(level, rect, data, startIndex, elementCount);
} }
public void SetData<T>(T[] data) where T : struct public void SetData<T>(T[] data) where T : struct
{ {
NativeTexture.SetData<T>(GraphicsDevice, data); NativeTexture.SetData<T>(GraphicsDevice, data);
} }
public void SetData<T>(T[] data, int startIndex, int elementCount) where T : struct public void SetData<T>(T[] data, int startIndex, int elementCount) where T : struct
{ {
NativeTexture.SetData<T>(GraphicsDevice, data, startIndex, elementCount); NativeTexture.SetData<T>(GraphicsDevice, data, startIndex, elementCount);
} }
#endregion #endregion
#region SaveAsJpeg #region SaveAsJpeg
public void SaveAsJpeg(Stream stream, int width, int height) public void SaveAsJpeg(Stream stream, int width, int height)
{ {
NativeTexture2D.SaveAsJpeg(stream, width, height); NativeTexture2D.SaveAsJpeg(stream, width, height);
} }
#endregion #endregion
#region SaveAsPng #region SaveAsPng
public void SaveAsPng(Stream stream, int width, int height) public void SaveAsPng(Stream stream, int width, int height)
{ {
NativeTexture2D.SaveAsPng(stream, width, height); NativeTexture2D.SaveAsPng(stream, width, height);
} }
#endregion #endregion
#region Dispose #region Dispose
public override void Dispose() public override void Dispose()
{ {
base.Dispose(true); base.Dispose(true);
} }
protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged) protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged)
{ {
base.Dispose(disposeManaged); base.Dispose(disposeManaged);
} }
#endregion #endregion
#region ReCreateNativeTextureSurface #region ReCreateNativeTextureSurface
internal override void ReCreateNativeTextureSurface() internal override void ReCreateNativeTextureSurface()
{ {
CreateNativeTextureSurface(); CreateNativeTextureSurface();
} }
#endregion #endregion
#region CreateNativeTextureSurface #region CreateNativeTextureSurface
private void CreateNativeTextureSurface() private void CreateNativeTextureSurface()
{ {
var creator = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>(); var creator = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>();
nativeTexture2D = creator.CreateTexture(GraphicsDevice, Format, width, height, LevelCount); nativeTexture2D = creator.CreateTexture(GraphicsDevice, Format, width, height, LevelCount);
base.nativeTexture = nativeTexture2D; base.nativeTexture = nativeTexture2D;
} }
#endregion #endregion
} }
} }

View File

@ -1,4 +1,5 @@
using System.Reflection; using System;
using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -21,6 +22,7 @@ using System.Runtime.InteropServices;
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("67548701-e7e2-4c56-be3f-18c5fdf5c0fb")] [assembly: Guid("67548701-e7e2-4c56-be3f-18c5fdf5c0fb")]
[assembly: CLSCompliant(true)]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
// //

View File

@ -2367,22 +2367,17 @@ Global
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|iOS.Build.0 = Debug|iOS {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|iOS.Build.0 = Debug|iOS
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Linux.ActiveCfg = Debug|Linux {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Linux.ActiveCfg = Debug|Linux
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Linux.Build.0 = Debug|Linux {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Linux.Build.0 = Debug|Linux
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Mac OS.ActiveCfg = Debug|Mac OS {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Mac OS.ActiveCfg = Debug|MacOs
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Mac OS.Build.0 = Debug|Mac OS
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Mixed Platforms.ActiveCfg = Debug|Windows {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Mixed Platforms.ActiveCfg = Debug|Windows
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Mixed Platforms.Build.0 = Debug|Windows {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Mixed Platforms.Build.0 = Debug|Windows
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|PS Vita.ActiveCfg = Debug|PS Vita {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|PS Vita.ActiveCfg = Debug|PsVita
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|PS Vita.Build.0 = Debug|PS Vita
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Windows.ActiveCfg = Debug|Windows {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Windows.ActiveCfg = Debug|Windows
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Windows.Build.0 = Debug|Windows {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Windows.Build.0 = Debug|Windows
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Windows Metro.ActiveCfg = Debug|Windows Metro {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Windows Metro.ActiveCfg = Debug|WindowsPhone
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Windows Metro.Build.0 = Debug|Windows Metro {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Windows Phone.ActiveCfg = Debug|WindowsPhone
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Windows Phone.ActiveCfg = Debug|Windows Phone {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|x64.ActiveCfg = Debug|XBox360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Windows Phone.Build.0 = Debug|Windows Phone {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|x86.ActiveCfg = Debug|XBox360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|x64.ActiveCfg = Debug|Xbox 360 {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Xbox 360.ActiveCfg = Debug|XBox360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|x86.ActiveCfg = Debug|Xbox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Xbox 360.Build.0 = Debug|Xbox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Android.ActiveCfg = Release|Android {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Android.ActiveCfg = Release|Android
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Android.Build.0 = Release|Android {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Android.Build.0 = Release|Android
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Any CPU.ActiveCfg = Release|Android {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Any CPU.ActiveCfg = Release|Android
@ -2391,22 +2386,17 @@ Global
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|iOS.Build.0 = Release|iOS {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|iOS.Build.0 = Release|iOS
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Linux.ActiveCfg = Release|Linux {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Linux.ActiveCfg = Release|Linux
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Linux.Build.0 = Release|Linux {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Linux.Build.0 = Release|Linux
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Mac OS.ActiveCfg = Release|Mac OS {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Mac OS.ActiveCfg = Release|MacOs
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Mac OS.Build.0 = Release|Mac OS {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Mixed Platforms.ActiveCfg = Release|XBox360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Mixed Platforms.ActiveCfg = Release|Xbox 360 {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Mixed Platforms.Build.0 = Release|XBox360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Mixed Platforms.Build.0 = Release|Xbox 360 {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|PS Vita.ActiveCfg = Release|PsVita
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|PS Vita.ActiveCfg = Release|PS Vita
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|PS Vita.Build.0 = Release|PS Vita
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Windows.ActiveCfg = Release|Windows {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Windows.ActiveCfg = Release|Windows
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Windows.Build.0 = Release|Windows {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Windows.Build.0 = Release|Windows
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Windows Metro.ActiveCfg = Release|Windows Metro {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Windows Metro.ActiveCfg = Release|WindowsPhone
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Windows Metro.Build.0 = Release|Windows Metro {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Windows Phone.ActiveCfg = Release|WindowsPhone
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Windows Phone.ActiveCfg = Release|Windows Phone {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|x64.ActiveCfg = Release|XBox360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Windows Phone.Build.0 = Release|Windows Phone {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|x86.ActiveCfg = Release|XBox360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|x64.ActiveCfg = Release|Xbox 360 {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Xbox 360.ActiveCfg = Release|XBox360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|x86.ActiveCfg = Release|Xbox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Xbox 360.ActiveCfg = Release|Xbox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Xbox 360.Build.0 = Release|Xbox 360
{8B0D9390-6F41-4CDB-810B-46A9EE3C3F1B}.Debug|Android.ActiveCfg = Debug|Any CPU {8B0D9390-6F41-4CDB-810B-46A9EE3C3F1B}.Debug|Android.ActiveCfg = Debug|Any CPU
{8B0D9390-6F41-4CDB-810B-46A9EE3C3F1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8B0D9390-6F41-4CDB-810B-46A9EE3C3F1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8B0D9390-6F41-4CDB-810B-46A9EE3C3F1B}.Debug|Any CPU.Build.0 = Debug|Any CPU {8B0D9390-6F41-4CDB-810B-46A9EE3C3F1B}.Debug|Any CPU.Build.0 = Debug|Any CPU

View File

@ -1,58 +1,36 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012 # Visual Studio 2013
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleContent", "SampleContent\SampleContent.contentproj", "{FA6E229D-4504-47B1-8A23-2D3FCC13F778}" VisualStudioVersion = 12.0.31101.0
EndProject MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AlphaTestEffectSample", "AlphaTestEffectSample\AlphaTestEffectSample.csproj", "{0005BDAA-F232-45C3-8D37-7E4FF7A1F605}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AlphaTestEffectSample", "AlphaTestEffectSample\AlphaTestEffectSample.csproj", "{0005BDAA-F232-45C3-8D37-7E4FF7A1F605}"
EndProject EndProject
Project("{75EFAE60-726E-430F-8661-4CF9ABD1306C}") = "SampleContent", "SampleContent\SampleContent.cproj", "{75EFAE60-726E-430F-8661-4CF9ABD1306C}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|x86 = Debug|x86 Debug|x86 = Debug|x86
DebugWin8|Any CPU = DebugWin8|Any CPU
DebugWin8|Mixed Platforms = DebugWin8|Mixed Platforms
DebugWin8|x86 = DebugWin8|x86
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms Release|Mixed Platforms = Release|Mixed Platforms
Release|x86 = Release|x86 Release|x86 = Release|x86
ReleaseWin8|Any CPU = ReleaseWin8|Any CPU
ReleaseWin8|Mixed Platforms = ReleaseWin8|Mixed Platforms
ReleaseWin8|x86 = ReleaseWin8|x86
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FA6E229D-4504-47B1-8A23-2D3FCC13F778}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA6E229D-4504-47B1-8A23-2D3FCC13F778}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{FA6E229D-4504-47B1-8A23-2D3FCC13F778}.Debug|x86.ActiveCfg = Debug|Any CPU
{FA6E229D-4504-47B1-8A23-2D3FCC13F778}.DebugWin8|Any CPU.ActiveCfg = Debug|Any CPU
{FA6E229D-4504-47B1-8A23-2D3FCC13F778}.DebugWin8|Mixed Platforms.ActiveCfg = Debug|Any CPU
{FA6E229D-4504-47B1-8A23-2D3FCC13F778}.DebugWin8|x86.ActiveCfg = Debug|Any CPU
{FA6E229D-4504-47B1-8A23-2D3FCC13F778}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{FA6E229D-4504-47B1-8A23-2D3FCC13F778}.Release|Mixed Platforms.ActiveCfg = Debug|Any CPU
{FA6E229D-4504-47B1-8A23-2D3FCC13F778}.Release|x86.ActiveCfg = Debug|Any CPU
{FA6E229D-4504-47B1-8A23-2D3FCC13F778}.ReleaseWin8|Any CPU.ActiveCfg = Debug|Any CPU
{FA6E229D-4504-47B1-8A23-2D3FCC13F778}.ReleaseWin8|Mixed Platforms.ActiveCfg = Debug|Any CPU
{FA6E229D-4504-47B1-8A23-2D3FCC13F778}.ReleaseWin8|x86.ActiveCfg = Debug|Any CPU
{0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.Debug|Any CPU.ActiveCfg = Debug|x86 {0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.Debug|Any CPU.ActiveCfg = Debug|x86
{0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 {0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.Debug|Mixed Platforms.Build.0 = Debug|x86
{0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.Debug|x86.ActiveCfg = Debug|x86 {0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.Debug|x86.ActiveCfg = Debug|x86
{0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.Debug|x86.Build.0 = Debug|x86
{0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.DebugWin8|Any CPU.ActiveCfg = Debug|x86
{0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.DebugWin8|Mixed Platforms.ActiveCfg = Debug|x86
{0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.DebugWin8|Mixed Platforms.Build.0 = Debug|x86
{0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.DebugWin8|x86.ActiveCfg = Debug|x86
{0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.DebugWin8|x86.Build.0 = Debug|x86
{0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.Release|Any CPU.ActiveCfg = Release|x86 {0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.Release|Any CPU.ActiveCfg = Release|x86
{0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.Release|Mixed Platforms.ActiveCfg = Release|x86 {0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.Release|Mixed Platforms.ActiveCfg = Release|x86
{0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.Release|Mixed Platforms.Build.0 = Release|x86
{0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.Release|x86.ActiveCfg = Release|x86 {0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.Release|x86.ActiveCfg = Release|x86
{0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.Release|x86.Build.0 = Release|x86 {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Any CPU.ActiveCfg = Debug|Windows
{0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.ReleaseWin8|Any CPU.ActiveCfg = Release|x86 {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Mixed Platforms.ActiveCfg = Debug|Windows
{0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.ReleaseWin8|Mixed Platforms.ActiveCfg = Release|x86 {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|Mixed Platforms.Build.0 = Debug|Windows
{0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.ReleaseWin8|Mixed Platforms.Build.0 = Release|x86 {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Debug|x86.ActiveCfg = Debug|Windows
{0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.ReleaseWin8|x86.ActiveCfg = Release|x86 {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Any CPU.ActiveCfg = Release|Android
{0005BDAA-F232-45C3-8D37-7E4FF7A1F605}.ReleaseWin8|x86.Build.0 = Release|x86 {75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Mixed Platforms.ActiveCfg = Release|XBox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|Mixed Platforms.Build.0 = Release|XBox 360
{75EFAE60-726E-430F-8661-4CF9ABD1306C}.Release|x86.ActiveCfg = Release|XBox 360
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -49,40 +49,38 @@
<Content Include="GameThumbnail.png" /> <Content Include="GameThumbnail.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\ANX.Framework\ANX.Framework.csproj"> <Reference Include="ANX.Framework, Version=0.6.0.39776, Culture=neutral, processorArchitecture=MSIL">
<Project>{6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35}</Project> <SpecificVersion>False</SpecificVersion>
<Name>ANX.Framework</Name> <HintPath>..\..\bin\Debug\ANX.Framework.dll</HintPath>
</ProjectReference> </Reference>
<ProjectReference Include="..\..\InputSystems\ANX.InputDevices.Windows.XInput\ANX.InputDevices.Windows.XInput.csproj"> <Reference Include="ANX.InputDevices.Windows.XInput, Version=0.6.5.0, Culture=neutral, processorArchitecture=MSIL">
<Project>{60D08399-244F-46A3-91F1-4CFD26D961A3}</Project> <SpecificVersion>False</SpecificVersion>
<Name>ANX.InputDevices.Windows.XInput</Name> <HintPath>..\..\bin\Debug\ANX.InputDevices.Windows.XInput.dll</HintPath>
</ProjectReference> </Reference>
<ProjectReference Include="..\..\InputSystems\ANX.InputSystem.Standard\ANX.InputSystem.Standard.csproj"> <Reference Include="ANX.InputSystem.Standard, Version=0.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<Project>{49066074-3B7B-4A55-B122-6BD33AB73558}</Project> <SpecificVersion>False</SpecificVersion>
<Name>ANX.InputSystem.Standard</Name> <HintPath>..\..\bin\Debug\ANX.InputSystem.Standard.dll</HintPath>
</ProjectReference> </Reference>
<ProjectReference Include="..\..\PlatformSystems\ANX.PlatformSystem.Windows\ANX.PlatformSystem.Windows.csproj"> <Reference Include="ANX.PlatformSystem.Windows, Version=0.75.1.30844, Culture=neutral, processorArchitecture=MSIL">
<Project>{068EB2E9-963C-4E1B-8831-E25011F11FFE}</Project> <SpecificVersion>False</SpecificVersion>
<Name>ANX.PlatformSystem.Windows</Name> <HintPath>..\..\bin\Debug\ANX.PlatformSystem.Windows.dll</HintPath>
</ProjectReference> </Reference>
<ProjectReference Include="..\..\RenderSystems\ANX.Framework.GL3\ANX.RenderSystem.GL3.csproj"> <Reference Include="ANX.RenderSystem.GL3, Version=0.5.16.30887, Culture=neutral, processorArchitecture=MSIL">
<Project>{EB8258E0-6741-4DB9-B756-1EBDF67B1ED6}</Project> <SpecificVersion>False</SpecificVersion>
<Name>ANX.RenderSystem.GL3</Name> <HintPath>..\..\bin\Debug\ANX.RenderSystem.GL3.dll</HintPath>
</ProjectReference> </Reference>
<ProjectReference Include="..\..\RenderSystems\ANX.RenderSystem.Windows.DX10\ANX.RenderSystem.Windows.DX10.csproj"> <Reference Include="ANX.RenderSystem.Windows.DX10, Version=0.7.28.30888, Culture=neutral, processorArchitecture=MSIL">
<Project>{5BE49183-2F6F-4527-AC90-D816911FCF90}</Project> <SpecificVersion>False</SpecificVersion>
<Name>ANX.RenderSystem.Windows.DX10</Name> <HintPath>..\..\bin\Debug\ANX.RenderSystem.Windows.DX10.dll</HintPath>
</ProjectReference> </Reference>
<ProjectReference Include="..\..\RenderSystems\ANX.RenderSystem.Windows.DX11\ANX.RenderSystem.Windows.DX11.csproj"> <Reference Include="ANX.RenderSystem.Windows.DX11, Version=0.7.19.30887, Culture=neutral, processorArchitecture=MSIL">
<Project>{B30DE9C2-0926-46B6-8351-9AF276C472D5}</Project> <SpecificVersion>False</SpecificVersion>
<Name>ANX.RenderSystem.Windows.DX11</Name> <HintPath>..\..\bin\Debug\ANX.RenderSystem.Windows.DX11.dll</HintPath>
</ProjectReference> </Reference>
<ProjectReference Include="..\..\SoundSystems\ANX.SoundSystem.Windows.XAudio\ANX.SoundSystem.Windows.XAudio.csproj"> <Reference Include="ANX.SoundSystem.Windows.XAudio, Version=0.4.2.30844, Culture=neutral, processorArchitecture=MSIL">
<Project>{6A582788-C4D2-410C-96CD-177F75712D65}</Project> <SpecificVersion>False</SpecificVersion>
<Name>ANX.SoundSystem.Windows.XAudio</Name> <HintPath>..\..\bin\Debug\ANX.SoundSystem.Windows.XAudio.dll</HintPath>
</ProjectReference> </Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

View File

@ -5,7 +5,7 @@ Framework Inhalts-Pipeline gelesen. Befolgen Sie die Kommentare zur Anpassung de
der Schriftart in Ihrem Spiel und zum Ändern der Zeichen, die für das Zeichnen verfügbar der Schriftart in Ihrem Spiel und zum Ändern der Zeichen, die für das Zeichnen verfügbar
sind. sind.
--> -->
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics"> <AnxContent xmlns:Graphics="ANX.Framework.Content.Pipeline.Graphics">
<Asset Type="Graphics:FontDescription"> <Asset Type="Graphics:FontDescription">
<!-- <!--
@ -57,4 +57,4 @@ sind.
</CharacterRegion> </CharacterRegion>
</CharacterRegions> </CharacterRegions>
</Asset> </Asset>
</XnaContent> </AnxContent>

View File

@ -92,15 +92,15 @@
<OutputPath>bin\Xbox 360\Release</OutputPath> <OutputPath>bin\Xbox 360\Release</OutputPath>
<CompressContent>false</CompressContent> <CompressContent>false</CompressContent>
</Configuration> </Configuration>
<Configuration Name="Debug" Platform="0">
<Profile>Reach</Profile>
<OutputPath>bin\Debug</OutputPath>
<CompressContent>false</CompressContent>
</Configuration>
</Configurations> </Configurations>
<References> <References>
<ProjectReference Include="..\..\ANX.Framework.Content.Pipeline.Assimp\ANX.Framework.Content.Pipeline.Assimp.csproj" Guid="{8b0d9390-6f41-4cdb-810b-46a9ee3c3f1b}" Name="ANX.Framework.Content.Pipeline.Assimp">../../bin/Debug/ANX.Framework.Content.Pipeline.Assimp.dll</ProjectReference> <AssemblyReference Name="ANX.Framework.Content.Pipeline.Assimp">C:\Users\Konstantin\Documents\Visual Studio 2013\Projects\anx.framework\bin\Debug\ANX.Framework.Content.Pipeline.Assimp.dll</AssemblyReference>
<ProjectReference Include="..\..\ANX.Framework.ContentPipeline\ANX.Framework.ContentPipeline.Extensions.csproj" Guid="{ecbf60cb-1cf0-4f92-8963-e73115b04b43}" Name="ANX.Framework.ContentPipeline.Extensions">../../bin/Debug/ANX.Framework.ContentPipeline.dll</ProjectReference> <AssemblyReference Name="ANX.Framework.ContentPipeline">C:\Users\Konstantin\Documents\Visual Studio 2013\Projects\anx.framework\bin\Debug\ANX.Framework.ContentPipeline.dll</AssemblyReference>
<AssemblyReference Name="ANX.InputSystem.Standard">C:\Users\Konstantin\Documents\Visual Studio 2013\Projects\anx.framework\bin\Debug\ANX.InputSystem.Standard.dll</AssemblyReference>
<AssemblyReference Name="ANX.PlatformSystem.Windows">C:\Users\Konstantin\Documents\Visual Studio 2013\Projects\anx.framework\bin\Debug\ANX.PlatformSystem.Windows.dll</AssemblyReference>
<AssemblyReference Name="ANX.RenderSystem.Windows.DX10">C:\Users\Konstantin\Documents\Visual Studio 2013\Projects\anx.framework\bin\Debug\ANX.RenderSystem.Windows.DX10.dll</AssemblyReference>
<AssemblyReference Name="ANX.RenderSystem.Windows.DX11">C:\Users\Konstantin\Documents\Visual Studio 2013\Projects\anx.framework\bin\Debug\ANX.RenderSystem.Windows.DX11.dll</AssemblyReference>
<AssemblyReference Name="AssimpNet">C:\Users\Konstantin\Documents\Visual Studio 2013\Projects\anx.framework\bin\Debug\AssimpNet.dll</AssemblyReference>
</References> </References>
<BuildItems> <BuildItems>
<BuildItem AssetName="HardwareInstancing" Importer="EffectImporter" Processor="EffectProcessor"> <BuildItem AssetName="HardwareInstancing" Importer="EffectImporter" Processor="EffectProcessor">
@ -123,19 +123,19 @@
<SourceFile>Fonts\Debug.spritefont</SourceFile> <SourceFile>Fonts\Debug.spritefont</SourceFile>
<ProcessorParams /> <ProcessorParams />
</BuildItem> </BuildItem>
<BuildItem AssetName="ANX_vertex_color" Importer="" Processor=""> <BuildItem AssetName="ANX_vertex_color" Importer="AssimpImporter" Processor="ModelProcessor">
<SourceFile>Models\ANX_vertex_color.fbx</SourceFile> <SourceFile>Models\ANX_vertex_color.fbx</SourceFile>
<ProcessorParams /> <ProcessorParams />
</BuildItem> </BuildItem>
<BuildItem AssetName="Cube" Importer="" Processor=""> <BuildItem AssetName="Cube" Importer="AssimpImporter" Processor="ModelProcessor">
<SourceFile>Models\Cube.fbx</SourceFile> <SourceFile>Models\Cube.fbx</SourceFile>
<ProcessorParams /> <ProcessorParams />
</BuildItem> </BuildItem>
<BuildItem AssetName="Sphere" Importer="" Processor=""> <BuildItem AssetName="Sphere" Importer="AssimpImporter" Processor="ModelProcessor">
<SourceFile>Models\Sphere.fbx</SourceFile> <SourceFile>Models\Sphere.fbx</SourceFile>
<ProcessorParams /> <ProcessorParams />
</BuildItem> </BuildItem>
<BuildItem AssetName="SphereAndCube" Importer="" Processor=""> <BuildItem AssetName="SphereAndCube" Importer="AssimpImporter" Processor="ModelProcessor">
<SourceFile>Models\SphereAndCube.fbx</SourceFile> <SourceFile>Models\SphereAndCube.fbx</SourceFile>
<ProcessorParams /> <ProcessorParams />
</BuildItem> </BuildItem>
@ -143,7 +143,7 @@
<SourceFile>Models\TestGrid1024.png</SourceFile> <SourceFile>Models\TestGrid1024.png</SourceFile>
<ProcessorParams /> <ProcessorParams />
</BuildItem> </BuildItem>
<BuildItem AssetName="TwoCubes" Importer="" Processor=""> <BuildItem AssetName="TwoCubes" Importer="AssimpImporter" Processor="ModelProcessor">
<SourceFile>Models\TwoCubes.fbx</SourceFile> <SourceFile>Models\TwoCubes.fbx</SourceFile>
<ProcessorParams /> <ProcessorParams />
</BuildItem> </BuildItem>
@ -167,7 +167,7 @@
<SourceFile>Textures\chest.png</SourceFile> <SourceFile>Textures\chest.png</SourceFile>
<ProcessorParams /> <ProcessorParams />
</BuildItem> </BuildItem>
<BuildItem AssetName="dds-test" Importer="" Processor=""> <BuildItem AssetName="dds-test" Importer="TextureImporter" Processor="TextureProcessor">
<SourceFile>Textures\dds-test.dds</SourceFile> <SourceFile>Textures\dds-test.dds</SourceFile>
<ProcessorParams /> <ProcessorParams />
</BuildItem> </BuildItem>

View File

@ -235,8 +235,7 @@ namespace ContentBuilder
if (string.IsNullOrWhiteSpace(intermediateDirectory)) if (string.IsNullOrWhiteSpace(intermediateDirectory))
{ {
intermediateDirectory = new string(config.Name.Select((x) => !Path.GetInvalidPathChars().Contains(x) ? x : '_').ToArray()); intermediateDirectory = Path.Combine(Path.GetDirectoryName(projectFile), "obj", CreateSafeFileName(config.Platform.ToDisplayName()), CreateSafeFileName(config.Name));
intermediateDirectory = Path.Combine(Path.GetDirectoryName(projectFile), "obj", intermediateDirectory);
} }
} }
else else
@ -285,11 +284,11 @@ namespace ContentBuilder
{ {
if (string.IsNullOrEmpty(x.ImporterName)) if (string.IsNullOrEmpty(x.ImporterName))
{ {
x.ImporterName = ImporterManager.GuessImporterByFileExtension(x.SourceFilename); x.ImporterName = buildContentTask.ImporterManager.GuessImporterByFileExtension(x.SourceFilename);
buildContentTask.BuildLogger.LogMessage(string.Format(Resources.MissedImporterUsingDefault, x.AssetName, x.ImporterName)); buildContentTask.BuildLogger.LogMessage(string.Format(Resources.MissedImporterUsingDefault, x.AssetName, x.ImporterName));
} }
if (string.IsNullOrEmpty(x.ProcessorName)) if (string.IsNullOrEmpty(x.ProcessorName) && !string.IsNullOrEmpty(x.ImporterName))
{ {
x.ProcessorName = buildContentTask.ImporterManager.GetDefaultProcessor(x.ImporterName); x.ProcessorName = buildContentTask.ImporterManager.GetDefaultProcessor(x.ImporterName);
buildContentTask.BuildLogger.LogMessage(string.Format(Resources.MissedProcessorUsingDefault, x.AssetName, x.ProcessorName)); buildContentTask.BuildLogger.LogMessage(string.Format(Resources.MissedProcessorUsingDefault, x.AssetName, x.ProcessorName));
@ -523,6 +522,14 @@ namespace ContentBuilder
intermediateDirectoryUri = new Uri(intermediateDirectory, UriKind.Absolute); intermediateDirectoryUri = new Uri(intermediateDirectory, UriKind.Absolute);
} }
private static string CreateSafeFileName(string text)
{
foreach (var invalidChar in Path.GetInvalidFileNameChars())
text = text.Replace(invalidChar, '_');
return text;
}
static Uri anxFrameworkPath; static Uri anxFrameworkPath;
public static Uri GetAnxFrameworkPath() public static Uri GetAnxFrameworkPath()

View File

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// Dieser Code wurde von einem Tool generiert. // Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:4.0.30319.34011 // Laufzeitversion:4.0.30319.34014
// //
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird. // der Code erneut generiert wird.
@ -106,7 +106,7 @@ namespace ContentBuilder {
} }
/// <summary> /// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die &quot;{0}&quot; missed a content processor, using &quot;{2}&quot;. ähnelt. /// Sucht eine lokalisierte Zeichenfolge, die &quot;{0}&quot; missed a content processor, using &quot;{1}&quot;. ähnelt.
/// </summary> /// </summary>
internal static string MissedProcessorUsingDefault { internal static string MissedProcessorUsingDefault {
get { get {

View File

@ -133,7 +133,7 @@
<value>"{0}" missed a content importer, using "{1}".</value> <value>"{0}" missed a content importer, using "{1}".</value>
</data> </data>
<data name="MissedProcessorUsingDefault" xml:space="preserve"> <data name="MissedProcessorUsingDefault" xml:space="preserve">
<value>"{0}" missed a content processor, using "{2}".</value> <value>"{0}" missed a content processor, using "{1}".</value>
</data> </data>
<data name="NoItemsSpecified" xml:space="preserve"> <data name="NoItemsSpecified" xml:space="preserve">
<value>No items specified. Closing application.</value> <value>No items specified. Closing application.</value>

View File

@ -332,7 +332,12 @@ namespace ANX.Framework.Build
public string GuessImporterByFileExtension(string fileName) public string GuessImporterByFileExtension(string fileName)
{ {
return ImporterManager.GuessImporterByFileExtension(fileName); if (importerManager == null)
{
importerManager = new ImporterManager();
}
return importerManager.GuessImporterByFileExtension(fileName);
} }
public string GetDefaultProcessorForImporter(string importer) public string GetDefaultProcessorForImporter(string importer)
@ -495,8 +500,7 @@ namespace ANX.Framework.Build
task.BuildCache = buildCache; task.BuildCache = buildCache;
string intermediateDirectory = new string(activeConfiguration.Name.Select((x) => !Path.GetInvalidPathChars().Contains(x) ? x : '_').ToArray()); string intermediateDirectory = Path.Combine(projectHome, "obj", CreateSafeFileName(activeConfiguration.Platform.ToDisplayName()), CreateSafeFileName(activeConfiguration.Name)) + Path.DirectorySeparatorChar;
intermediateDirectory = Path.Combine(projectHome, "obj", intermediateDirectory) + Path.DirectorySeparatorChar;
var buildCacheUri = new Uri(new Uri(intermediateDirectory, UriKind.Absolute), new Uri("build.cache", UriKind.Relative)); var buildCacheUri = new Uri(new Uri(intermediateDirectory, UriKind.Absolute), new Uri("build.cache", UriKind.Relative));
@ -517,6 +521,14 @@ namespace ANX.Framework.Build
return true; return true;
} }
private string CreateSafeFileName(string text)
{
foreach (var unsafeChar in Path.GetInvalidFileNameChars())
text = text.Replace(unsafeChar, '_');
return text;
}
} }
//pretty much the same as if one would use lock(appDomain) but as a public api. //pretty much the same as if one would use lock(appDomain) but as a public api.

View File

@ -186,7 +186,7 @@ namespace ANX.Framework.VisualStudio
var activeContentConfig = this.config.ProjectMgr.ActiveContentConfiguration; var activeContentConfig = this.config.ProjectMgr.ActiveContentConfiguration;
IVsCfg cfg; IVsCfg cfg;
ErrorHandler.ThrowOnFailure(this.config.ProjectMgr.ConfigProvider.GetCfgOfName(activeContentConfig.Name, activeContentConfig.Platform.ToString(), out cfg)); ErrorHandler.ThrowOnFailure(this.config.ProjectMgr.ConfigProvider.GetCfgOfName(activeContentConfig.Name, activeContentConfig.Platform.ToDisplayName(), out cfg));
Config activeConfig = (Config)cfg; Config activeConfig = (Config)cfg;
if (config.ProjectMgr.PendingBuild != null && config.ProjectMgr.PendingBuild.IsFileBuild) if (config.ProjectMgr.PendingBuild != null && config.ProjectMgr.PendingBuild.IsFileBuild)

View File

@ -72,7 +72,7 @@ namespace ANX.Framework.VisualStudio
/// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns> /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
public override int GetSupportedPlatformNames(uint celt, string[] names, uint[] actual) public override int GetSupportedPlatformNames(uint celt, string[] names, uint[] actual)
{ {
return GetPlatforms(celt, names, actual, contentProjectNode.ContentProject.Configurations.GetUniquePlatforms().Select((x) => x.ToString()).ToArray()); return GetPlatforms(celt, names, actual, GetPlatformNames());
} }
protected override Config GetProjectConfiguration(string configName, string platformName) protected override Config GetProjectConfiguration(string configName, string platformName)
@ -261,10 +261,5 @@ namespace ANX.Framework.VisualStudio
return VSConstants.S_OK; return VSConstants.S_OK;
} }
public override IEnumerator<Config> GetEnumerator()
{
return this.configurationsList.GetEnumerator();
}
} }
} }

View File

@ -191,11 +191,12 @@ namespace ANX.Framework.VisualStudio.Nodes
{ {
get get
{ {
var activeConfig = ((OAProject)this.GetAutomationObject()).ConfigurationManager.ActiveConfiguration; var activeConfig = this.GetProjectProperty(ProjectFileConstants.Configuration);
var activePlatform = this.GetProjectProperty(ProjectFileConstants.Platform);
var config = this.ConfigProvider.FirstOrDefault((x) => x.ConfigName == activeConfig.ConfigurationName && x.PlatformName == activeConfig.PlatformName) as ContentConfig;
var config = this.ConfigProvider.FirstOrDefault((x) => x.ConfigName == activeConfig && x.PlatformName == activePlatform) as ContentConfig;
if (config == null) if (config == null)
throw new KeyNotFoundException(string.Format("Error when searching for configuration with name \"{0}\" and platform \"{1}\".", activeConfig.ConfigurationName, activeConfig.PlatformName)); throw new KeyNotFoundException(string.Format("Error when searching for configuration with name \"{0}\" and platform \"{1}\".", activeConfig, activePlatform));
return config.Configuration; return config.Configuration;
} }

View File

@ -18,6 +18,8 @@ namespace ANX.Framework.VisualStudio
{ {
private static EnvDTE.DTE _dte; private static EnvDTE.DTE _dte;
private static Dictionary<string, TargetPlatform> _displayNames;
public static void Initialize(EnvDTE.DTE dte) public static void Initialize(EnvDTE.DTE dte)
{ {
if (dte == null) if (dte == null)
@ -55,59 +57,49 @@ namespace ANX.Framework.VisualStudio
return null; return null;
} }
private static void InitializeTargetPlatforms()
{
if (_displayNames == null)
{
_displayNames = new Dictionary<string, TargetPlatform>();
foreach (var enumValue in typeof(TargetPlatform).GetEnumValues())
{
var enumInstance = (TargetPlatform)Enum.ToObject(typeof(TargetPlatform), enumValue);
_displayNames.Add(enumInstance.ToDisplayName(), enumInstance);
}
}
}
public static TargetPlatform ParseTargetPlatform(string displayName) public static TargetPlatform ParseTargetPlatform(string displayName)
{ {
string[] names = Enum.GetNames(typeof(TargetPlatform)); InitializeTargetPlatforms();
for (int i = 0; i < names.Length; i++)
{ TargetPlatform targetPlatform;
if (displayName == names[i]) if (_displayNames.TryGetValue(displayName, out targetPlatform))
return (TargetPlatform)Enum.Parse(typeof(TargetPlatform), names[i]); return targetPlatform;
var attribute = typeof(TargetPlatform).GetMember(names[i]).FirstOrDefault().GetCustomAttribute<DescriptionAttribute>(false);
if (attribute != null && displayName == attribute.Description)
return (TargetPlatform)Enum.Parse(typeof(TargetPlatform), names[i]);
}
return default(TargetPlatform); return default(TargetPlatform);
} }
public static string[] GetTargetPlatformDisplayNames() public static string[] GetTargetPlatformDisplayNames()
{ {
string[] names = Enum.GetNames(typeof(TargetPlatform)); InitializeTargetPlatforms();
string[] displayNames = new string[names.Length];
for (int i = 0; i < names.Length; i++)
{
var attribute = typeof(TargetPlatform).GetMember(names[i]).FirstOrDefault().GetCustomAttribute<DescriptionAttribute>(false);
if (attribute != null)
displayNames[i] = attribute.Description;
else
displayNames[i] = names[i];
}
return displayNames; return _displayNames.Keys.ToArray();
} }
public static string GetDisplayName(TargetPlatform platform) public static string GetDisplayName(TargetPlatform platform)
{ {
string name = Enum.GetName(typeof(TargetPlatform), platform); return platform.ToDisplayName();
if (string.IsNullOrEmpty(name))
return name;
var attribute = typeof(TargetPlatform).GetMember(name).FirstOrDefault().GetCustomAttribute<DescriptionAttribute>(false);
if (attribute != null)
return attribute.Description;
else
return name;
} }
public static string GetTargetPlatformName(string displayName) public static string GetTargetPlatformName(string displayName)
{ {
string[] names = Enum.GetNames(typeof(TargetPlatform)); InitializeTargetPlatforms();
for (int i = 0; i < names.Length; i++)
{ TargetPlatform targetPlatform;
var attribute = typeof(TargetPlatform).GetMember(names[i]).FirstOrDefault().GetCustomAttribute<DescriptionAttribute>(false); if (_displayNames.TryGetValue(displayName, out targetPlatform))
if (attribute != null && displayName == attribute.Description) return targetPlatform.ToString();
return names[i];
}
return displayName; return displayName;
} }

View File

@ -595,11 +595,21 @@ namespace Microsoft.VisualStudio.Project
return (configurations == null) ? new string[] { } : configurations.ToArray(); return (configurations == null) ? new string[] { } : configurations.ToArray();
} }
public virtual IEnumerator<Config> GetEnumerator() public IEnumerator<Config> GetEnumerator()
{ {
foreach (var value in this.configurationsList.Values) uint[] elementsCountHolder = new uint[1] { 0 };
if (this.GetCfgs(0, null, elementsCountHolder, null) == VSConstants.S_OK)
{ {
yield return value; var elementsCount = elementsCountHolder[0];
IVsCfg[] configs = new IVsCfg[elementsCount];
if (this.GetCfgs(elementsCount, configs, null, null) == VSConstants.S_OK)
{
foreach (Config config in configs)
{
yield return config;
}
}
} }
} }