anx.framework/ANX.Framework/Net/PacketWriter.cs
SND\AstrorEnales_cp 5505f7dcbf - Added PlatformSystem Plugins layer
- Started Windows, Metro and Linux Platform-Plugins
- Moved the RecordingSample to the Samples folder
- Started two samples for using the graphics device in a WinForms and Wpf Editor
- Refactorings in the AddIn-System
- Moved the Window initialization-code to the Platform modules
- Changed the License text in all code files which is now way smaller
- Started ProjectConverter tool which converts all the projects and solution to the target configuration
- Changed the SupportedPlatform names in the Resource files
- Changed the WIN8 define to WINDOWSMETRO which is actually meant
- Removed NLog and started our own Logger class
- Many more stuff...
2012-08-09 09:45:04 +00:00

107 lines
1.7 KiB
C#

using System;
using System.IO;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.Framework.Net
{
public class PacketWriter : BinaryWriter
{
public int Length
{
get
{
return (int)BaseStream.Length;
}
}
public int Position
{
get
{
return (int)BaseStream.Position;
}
set
{
BaseStream.Position = (long)value;
}
}
public PacketWriter()
: this(0)
{
}
public PacketWriter(int capacity)
: base(new MemoryStream(capacity))
{
}
public override void Write(float value)
{
Write(value);
}
public override void Write(double value)
{
Write(value);
}
public void Write(Vector2 value)
{
Write(value.X);
Write(value.Y);
}
public void Write(Vector3 value)
{
Write(value.X);
Write(value.Y);
Write(value.Z);
}
public void Write(Vector4 value)
{
Write(value.X);
Write(value.Y);
Write(value.Z);
Write(value.W);
}
public void Write(Matrix value)
{
Write(value.M11);
Write(value.M12);
Write(value.M13);
Write(value.M14);
Write(value.M21);
Write(value.M22);
Write(value.M23);
Write(value.M24);
Write(value.M31);
Write(value.M32);
Write(value.M33);
Write(value.M34);
Write(value.M41);
Write(value.M42);
Write(value.M43);
Write(value.M44);
}
public void Write(Quaternion value)
{
Write(value.X);
Write(value.Y);
Write(value.Z);
Write(value.W);
}
public void Write(Color value)
{
Write(value.PackedValue);
}
}
}