fixed compile issue in Metro/ModernUI build

This commit is contained in:
Glatzemann 2012-10-04 11:42:21 +00:00 committed by Konstantin Koch
parent 52b87d1459
commit 298aad1a1c
3 changed files with 27 additions and 10 deletions

View File

@ -47,30 +47,37 @@ namespace ANX.Framework.Content.Pipeline.Serialization.Compiler
{ {
throw new ArgumentNullException("output"); throw new ArgumentNullException("output");
} }
if (value == null) if (value == null)
{ {
throw new ArgumentNullException("value"); throw new ArgumentNullException("value");
} }
if (!Enum.IsDefined(typeof(TargetPlatform), targetPlatform)) if (!Enum.IsDefined(typeof(TargetPlatform), targetPlatform))
{ {
throw new ArgumentOutOfRangeException("targetPlatform"); throw new ArgumentOutOfRangeException("targetPlatform");
} }
if (!Enum.IsDefined(typeof(GraphicsProfile), targetProfile)) if (!Enum.IsDefined(typeof(GraphicsProfile), targetProfile))
{ {
throw new ArgumentOutOfRangeException("targetProfile"); throw new ArgumentOutOfRangeException("targetProfile");
} }
if (string.IsNullOrEmpty(rootDirectory)) if (string.IsNullOrEmpty(rootDirectory))
{ {
throw new ArgumentNullException("rootDirectory"); throw new ArgumentNullException("rootDirectory");
} }
if (string.IsNullOrEmpty(referenceRelocationPath)) if (string.IsNullOrEmpty(referenceRelocationPath))
{ {
throw new ArgumentNullException("referenceRelocationPath"); throw new ArgumentNullException("referenceRelocationPath");
} }
if (compressContent) if (compressContent)
{ {
compressContent = this.ShouldCompressContent(targetPlatform, value); compressContent = this.ShouldCompressContent(targetPlatform, value);
} }
using (ContentWriter contentWriter = new ContentWriter(this, output, compressContent, rootDirectory, referenceRelocationPath) { TargetPlatform = targetPlatform, TargetProfile = targetProfile }) using (ContentWriter contentWriter = new ContentWriter(this, output, compressContent, rootDirectory, referenceRelocationPath) { TargetPlatform = targetPlatform, TargetProfile = targetProfile })
{ {
contentWriter.WriteObject<object>(value); contentWriter.WriteObject<object>(value);
@ -83,6 +90,7 @@ namespace ANX.Framework.Content.Pipeline.Serialization.Compiler
{ {
throw new ArgumentNullException("type"); throw new ArgumentNullException("type");
} }
ContentTypeWriter typeWriterInternal = this.GetTypeWriterInternal(type); ContentTypeWriter typeWriterInternal = this.GetTypeWriterInternal(type);
//TODO: this.RecordDependency(typeWriterInternal.TargetType); //TODO: this.RecordDependency(typeWriterInternal.TargetType);
return typeWriterInternal; return typeWriterInternal;
@ -97,6 +105,7 @@ namespace ANX.Framework.Content.Pipeline.Serialization.Compiler
//this.AddTypeWriter(contentTypeWriter); //this.AddTypeWriter(contentTypeWriter);
//this.InitializeTypeWriter(contentTypeWriter); //this.InitializeTypeWriter(contentTypeWriter);
} }
return contentTypeWriter; return contentTypeWriter;
} }
@ -106,7 +115,9 @@ namespace ANX.Framework.Content.Pipeline.Serialization.Compiler
{ {
return false; return false;
} }
ContentTypeWriter typeWriterInternal = this.GetTypeWriterInternal(value.GetType()); ContentTypeWriter typeWriterInternal = this.GetTypeWriterInternal(value.GetType());
return typeWriterInternal.ShouldCompressContent(targetPlatform, value); return typeWriterInternal.ShouldCompressContent(targetPlatform, value);
} }
} }

View File

@ -470,21 +470,29 @@ namespace ANX.Framework.Content
referenceName = GetPathToReference(referenceName); referenceName = GetPathToReference(referenceName);
referenceName = Path.Combine(ContentManager.RootDirectory, referenceName); referenceName = Path.Combine(ContentManager.RootDirectory, referenceName);
Assembly assembly = Assembly.GetEntryAssembly(); Assembly assembly = null;
string titleLocationPath = null;
#if !WINDOWSMETRO
assembly = Assembly.GetEntryAssembly();
if (assembly == null) if (assembly == null)
{
assembly = Assembly.GetCallingAssembly(); assembly = Assembly.GetCallingAssembly();
string titleLocationPath = Path.GetDirectoryName(assembly.Location); }
titleLocationPath = Path.GetDirectoryName(assembly.Location);
#else
throw new NotImplementedException();
//TODO: find solution for metro
#endif
referenceName = Path.Combine(titleLocationPath, referenceName); referenceName = Path.Combine(titleLocationPath, referenceName);
return TitleContainer.GetCleanPath(referenceName); return TitleContainer.GetCleanPath(referenceName);
} }
private string GetPathToReference(string referenceName) private string GetPathToReference(string referenceName)
{ {
int num = AssetName.LastIndexOfAny(new[] { '\\', '/', Path.DirectorySeparatorChar }); return Path.Combine(Path.GetDirectoryName(AssetName), referenceName);
string path = "";
if (num != -1)
path = AssetName.Substring(0, num);
return Path.Combine(path, referenceName);
} }
} }
} }

View File

@ -67,9 +67,7 @@
<Reference Include="System.Net" /> <Reference Include="System.Net" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AddInSelector.cs"> <Compile Include="AddInSelector.cs" />
<SubType>Form</SubType>
</Compile>
<Compile Include="AddInSelector.Designer.cs"> <Compile Include="AddInSelector.Designer.cs">
<DependentUpon>AddInSelector.cs</DependentUpon> <DependentUpon>AddInSelector.cs</DependentUpon>
</Compile> </Compile>