- added some missing files from last commit

- fixed a bug in XNB-Header
This commit is contained in:
Glatzemann 2012-08-22 10:58:46 +00:00
parent 3764074514
commit c74b3c5767
3 changed files with 20 additions and 36 deletions

View File

@ -26,6 +26,9 @@ namespace ANX.Framework.Content.Pipeline.Serialization.Compiler
private string rootDirectory; private string rootDirectory;
private string referenceRelocationPath; private string referenceRelocationPath;
const byte xnbFormatVersion = (byte)5;
char[] xnbMagicWord = new char[] { 'X', 'N', 'B' };
internal ContentWriter(ContentCompiler compiler, Stream output, TargetPlatform targetPlatform, GraphicsProfile targetProfile, bool compressContent, string rootDirectory, string referenceRelocationPath) internal ContentWriter(ContentCompiler compiler, Stream output, TargetPlatform targetPlatform, GraphicsProfile targetProfile, bool compressContent, string rootDirectory, string referenceRelocationPath)
{ {
this.compiler = compiler; this.compiler = compiler;
@ -178,52 +181,33 @@ namespace ANX.Framework.Content.Pipeline.Serialization.Compiler
private void WriteFinalOutput() private void WriteFinalOutput()
{ {
this.OutStream = this.finalOutput; this.OutStream = this.finalOutput;
this.Write('X'); this.Write(xnbMagicWord);
this.Write('N');
this.Write('B');
this.Write((byte)this.targetPlatform); this.Write((byte)this.targetPlatform);
//if (this.targetPlatform == TargetPlatform.Windows)
//{
// this.Write((byte)119);
//}
//else
//{
// if (this.targetPlatform == TargetPlatform.XBox360)
// {
// this.Write((byte)120);
// }
// else
// {
// if (this.targetPlatform != TargetPlatform.WindowsPhone)
// {
// throw new NotSupportedException();
// }
// this.Write((byte)109);
// }
//}
if (this.compressContent) if (this.compressContent)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
//this.WriteCompressedOutput(); //this.WriteCompressedOutput();
return;
} }
this.WriteUncompressedOutput(); else
{
this.WriteUncompressedOutput();
}
} }
private void WriteUncompressedOutput() private void WriteUncompressedOutput()
{ {
this.WriteVersionNumber(5); this.Write(xnbFormatVersion); // Version
int num = (int)this.headerData.Length;
int num2 = (int)this.contentData.Length;
this.Write(10 + num + num2);
this.OutStream.Write(this.headerData.GetBuffer(), 0, num);
this.OutStream.Write(this.contentData.GetBuffer(), 0, num2);
}
private void WriteVersionNumber(ushort version) byte flags = 0;
{ if (TargetProfile == GraphicsProfile.HiDef)
version |= (ushort)((int)this.targetProfile << 8); {
this.Write(version); flags |= 0x01;
}
this.Write(flags);
this.Write(10 + this.headerData.Length + this.contentData.Length);
this.OutStream.Write(this.headerData.GetBuffer(), 0, (int)this.headerData.Length);
this.OutStream.Write(this.contentData.GetBuffer(), 0, (int)this.contentData.Length);
} }
public TargetPlatform TargetPlatform public TargetPlatform TargetPlatform
@ -238,7 +222,7 @@ namespace ANX.Framework.Content.Pipeline.Serialization.Compiler
{ {
get get
{ {
return TargetProfile; return targetProfile;
} }
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

BIN
Tools/XNBInspector/anx.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB