mirror of
https://github.com/Halofreak1990/XFXFramework
synced 2024-12-26 13:49:34 +01:00
List class now works.
TextureCollection is broken because it can somehow not resolve Texture as template argument for the List it uses. Added missing BinaryWriter and TextWriter classes to System::IO namespace Modified BinaryReader Added PacketReader and PacketWriter classes to XFX::Net namespace
This commit is contained in:
parent
c4a46bae5d
commit
1bf933432b
@ -36,11 +36,11 @@ namespace XFX
|
||||
static bool IsVisible();
|
||||
static NotificationPosition_t notificationPosition;
|
||||
|
||||
static IAsyncResult* BeginShowKeyboardInput(PlayerIndex_t player, char* title, char* description, char* defaultText, ASyncCallback callback, Object* state);
|
||||
static IAsyncResult* BeginShowStorageDeviceSelector(int sizeInBytes, int directoryCount, ASyncCallback callback, Object* state);
|
||||
static IAsyncResult* BeginShowStorageDeviceSelector(ASyncCallback callback, Object* state);
|
||||
static IAsyncResult* BeginShowStorageDeviceSelector(PlayerIndex_t player, int sizeInBytes, int directoryCount, ASyncCallback callback, object state);
|
||||
static IAsyncResult* BeginShowStorageDeviceSelector(PlayerIndex_t player, ASyncCallback callback, Object* state);
|
||||
static IAsyncResult* BeginShowKeyboardInput(PlayerIndex_t player, char* title, char* description, char* defaultText, AsyncCallback callback, Object* state);
|
||||
static IAsyncResult* BeginShowStorageDeviceSelector(int sizeInBytes, int directoryCount, AsyncCallback callback, Object* state);
|
||||
static IAsyncResult* BeginShowStorageDeviceSelector(AsyncCallback callback, Object* state);
|
||||
static IAsyncResult* BeginShowStorageDeviceSelector(PlayerIndex_t player, int sizeInBytes, int directoryCount, AsyncCallback callback, object state);
|
||||
static IAsyncResult* BeginShowStorageDeviceSelector(PlayerIndex_t player, AsyncCallback callback, Object* state);
|
||||
static char* EndShowKeyboardInput(IAsyncResult* result);
|
||||
static StorageDevice EndShowStorageDeviceSelector(IAsyncResult* result);
|
||||
};
|
||||
|
@ -498,7 +498,7 @@ namespace XFX
|
||||
Deferred = 1,
|
||||
FrontToBack = 4,
|
||||
Immediate = 0,
|
||||
Texture = 2
|
||||
Texture_ = 2
|
||||
};
|
||||
};
|
||||
/// <summary>
|
||||
|
@ -23,7 +23,7 @@ namespace XFX
|
||||
/// <summary>
|
||||
/// Represents a texture resource.
|
||||
/// </summary>
|
||||
class Texture : public GraphicsResource
|
||||
class Texture : public GraphicsResource, virtual Object
|
||||
{
|
||||
private:
|
||||
static ImageFileFormat_t ILimageformat2XNAimageformat(int ILFormat);
|
||||
@ -34,22 +34,25 @@ namespace XFX
|
||||
public:
|
||||
int LevelCount();
|
||||
int LevelOfDetail;
|
||||
|
||||
Texture();
|
||||
~Texture();
|
||||
|
||||
static Texture FromFile(GraphicsDevice graphicsDevice, Stream textureStream);
|
||||
static Texture FromFile(GraphicsDevice graphicsDevice, Stream* textureStream);
|
||||
static Texture FromFile(GraphicsDevice graphicsDevice, char* filename);
|
||||
static Texture FromFile(GraphicsDevice graphicsDevice, Stream textureStream, int numberBytes);
|
||||
static Texture FromFile(GraphicsDevice graphicsDevice, Stream textureStream, TextureCreationParameters creationParameters);
|
||||
static Texture FromFile(GraphicsDevice graphicsDevice, Stream* textureStream, int numberBytes);
|
||||
static Texture FromFile(GraphicsDevice graphicsDevice, Stream* textureStream, TextureCreationParameters creationParameters);
|
||||
static Texture FromFile(GraphicsDevice graphicsDevice, char* filename, TextureCreationParameters creationParameters);
|
||||
static Texture FromFile(GraphicsDevice graphicsDevice, Stream textureStream, int numberBytes, TextureCreationParameters creationParameters);
|
||||
static Texture FromFile(GraphicsDevice graphicsDevice, Stream* textureStream, int numberBytes, TextureCreationParameters creationParameters);
|
||||
static Texture FromFile(GraphicsDevice graphicsDevice, char* filename, int width, int height, int depth);
|
||||
|
||||
void GenerateMipMaps(TextureFilter_t filterType);
|
||||
static TextureCreationParameters GetCreationParameters(GraphicsDevice graphicsDevice, Stream textureStream);
|
||||
static TextureCreationParameters GetCreationParameters(GraphicsDevice graphicsDevice, Stream* textureStream);
|
||||
static TextureCreationParameters GetCreationParameters(GraphicsDevice graphicsDevice, char* filename);
|
||||
static TextureCreationParameters GetCreationParameters(GraphicsDevice graphicsDevice, Stream textureStream, int numberBytes);
|
||||
static TextureInformation GetTextureInformation(Stream textureStream);
|
||||
static TextureCreationParameters GetCreationParameters(GraphicsDevice graphicsDevice, Stream* textureStream, int numberBytes);
|
||||
static TextureInformation GetTextureInformation(Stream* textureStream);
|
||||
static TextureInformation GetTextureInformation(char* filename);
|
||||
static TextureInformation GetTextureInformation(Stream textureStream, int numberBytes);
|
||||
static TextureInformation GetTextureInformation(Stream* textureStream, int numberBytes);
|
||||
void Save(char* filename, ImageFileFormat_t format);
|
||||
};
|
||||
}
|
||||
|
@ -32,8 +32,8 @@ namespace XFX
|
||||
int textureId; // The reference ID of the texture in OpenGL memory
|
||||
int imageId;
|
||||
|
||||
Texture2D(GraphicsDevice graphicsDevice);
|
||||
void Load(byte buffer[]);
|
||||
Texture2D(GraphicsDevice graphicsDevice);
|
||||
|
||||
protected:
|
||||
void Dispose(bool disposing);
|
||||
@ -49,10 +49,10 @@ namespace XFX
|
||||
Texture2D(GraphicsDevice graphicsDevice, int width, int height, int numberLevels, TextureUsage_t usage, SurfaceFormat_t format);
|
||||
Texture2D(const Texture2D &obj);
|
||||
|
||||
static Texture2D FromFile(GraphicsDevice graphicsDevice, Stream textureStream);
|
||||
static Texture2D FromFile(GraphicsDevice graphicsDevice, Stream textureStream, TextureCreationParameters creationParameters);
|
||||
static Texture2D FromFile(GraphicsDevice graphicsDevice, Stream textureStream, int numberBytes);
|
||||
static Texture2D FromFile(GraphicsDevice graphicsDevice, Stream textureStream, int numberBytes, TextureCreationParameters creationParameters);
|
||||
static Texture2D FromFile(GraphicsDevice graphicsDevice, Stream* textureStream);
|
||||
static Texture2D FromFile(GraphicsDevice graphicsDevice, Stream* textureStream, TextureCreationParameters creationParameters);
|
||||
static Texture2D FromFile(GraphicsDevice graphicsDevice, Stream* textureStream, int numberBytes);
|
||||
static Texture2D FromFile(GraphicsDevice graphicsDevice, Stream* textureStream, int numberBytes, TextureCreationParameters creationParameters);
|
||||
static Texture2D FromFile(GraphicsDevice graphicsDevice, char* filename);
|
||||
static Texture2D FromFile(GraphicsDevice graphicsDevice, char* filename, TextureCreationParameters creationParameters);
|
||||
static Texture2D FromFile(GraphicsDevice graphicsDevice, char* filename, int width, int height);
|
||||
|
40
include/Net/PacketReader.h
Normal file
40
include/Net/PacketReader.h
Normal file
@ -0,0 +1,40 @@
|
||||
#ifndef _XFX_NET_PACKETREADER_
|
||||
#define _XFX_NET_PACKETREADER_
|
||||
|
||||
#include <System/IO/BinaryReader.h>
|
||||
|
||||
using namespace System::IO;
|
||||
|
||||
namespace XFX
|
||||
{
|
||||
struct Matrix;
|
||||
struct Quaternion;
|
||||
struct Vector2;
|
||||
struct Vector3;
|
||||
struct Vector4;
|
||||
|
||||
namespace Net
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides common functionality for efficiently reading incoming network packets.
|
||||
/// </summary>
|
||||
class PacketReader : public BinaryReader
|
||||
{
|
||||
public:
|
||||
int Length();
|
||||
int Position();
|
||||
void Position(int newValue);
|
||||
|
||||
PacketReader();
|
||||
PacketReader(int capacity);
|
||||
|
||||
Matrix ReadMatrix();
|
||||
Quaternion ReadQuaternion();
|
||||
Vector2 ReadVector2();
|
||||
Vector3 ReadVector3();
|
||||
Vector4 ReadVEctor4();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif //_XFX_NET_PACKETREADER_
|
40
include/Net/PacketWriter.h
Normal file
40
include/Net/PacketWriter.h
Normal file
@ -0,0 +1,40 @@
|
||||
#ifndef _XFX_NET_PACKETWRITER_
|
||||
#define _XFX_NET_PACKETWRITER_
|
||||
|
||||
#include <System/IO/BinaryWriter.h>
|
||||
|
||||
using namespace System::IO;
|
||||
|
||||
namespace XFX
|
||||
{
|
||||
struct Matrix;
|
||||
struct Quaternion;
|
||||
struct Vector2;
|
||||
struct Vector3;
|
||||
struct Vector4;
|
||||
|
||||
namespace Net
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides common functionality for efficiently formatting outgoing network packets.
|
||||
/// </summary>
|
||||
class PacketWriter : public BinaryWriter
|
||||
{
|
||||
public:
|
||||
int Length();
|
||||
int Position();
|
||||
void Position(int newValue);
|
||||
|
||||
PacketWriter();
|
||||
PacketWriter(int capacity);
|
||||
|
||||
void Write(Matrix value);
|
||||
void Write(Quaternion value);
|
||||
void Write(Vector2 value);
|
||||
void Write(Vector3 value);
|
||||
void Write(Vector4 value);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif //_XFX_NET_PACKETWRITER_
|
@ -211,7 +211,7 @@ namespace System
|
||||
{
|
||||
Array::Copy(_items, index +1, _items, index, _size - index);
|
||||
}
|
||||
_items[_size] = new T();
|
||||
_items[_size] = T();
|
||||
_version++;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ namespace System
|
||||
/// <summary>
|
||||
/// References a method to be called when a corresponding asynchronous operation completes.
|
||||
/// </summary>
|
||||
typedef void (*ASyncCallback)(IAsyncResult* ar);
|
||||
typedef void (*AsyncCallback)(IAsyncResult* ar);
|
||||
|
||||
/// <summary>
|
||||
/// Represents the method that will handle an event that has no event data.
|
||||
|
@ -15,7 +15,7 @@ namespace System
|
||||
/// <summary>
|
||||
/// Reads primitive data types as binary values in a specific encoding.
|
||||
/// </summary>
|
||||
class BinaryReader : public IDisposable, public Object
|
||||
class BinaryReader : public IDisposable, virtual Object
|
||||
{
|
||||
private:
|
||||
bool m_2BytesPerChar;
|
||||
@ -23,7 +23,7 @@ namespace System
|
||||
char* m_charBuffer;
|
||||
byte* m_charBytes;
|
||||
char* m_singleChar;
|
||||
Stream m_stream;
|
||||
Stream* m_stream;
|
||||
Encoding m_encoding;
|
||||
bool m_isMemoryStream;
|
||||
Decoder m_decoder;
|
||||
@ -41,10 +41,10 @@ namespace System
|
||||
virtual void FillBuffer(int numBytes);
|
||||
|
||||
public:
|
||||
virtual Stream BaseStream();
|
||||
virtual Stream* BaseStream();
|
||||
|
||||
BinaryReader(Stream input);
|
||||
BinaryReader(Stream input, Encoding encoding);
|
||||
BinaryReader(Stream* input);
|
||||
BinaryReader(Stream* input, Encoding encoding);
|
||||
virtual ~BinaryReader();
|
||||
|
||||
virtual void Close();
|
||||
|
67
include/System/IO/BinaryWriter.h
Normal file
67
include/System/IO/BinaryWriter.h
Normal file
@ -0,0 +1,67 @@
|
||||
#ifndef _SYSTEM_IO_BINARYWRITER_
|
||||
#define _SYSTEM_IO_BINARYWRITER_
|
||||
|
||||
#include <System/Types.h>
|
||||
#include <System/Interfaces.h>
|
||||
#include <System/Text/Encoding.h>
|
||||
#include "Stream.h"
|
||||
|
||||
using namespace System::Text;
|
||||
|
||||
namespace System
|
||||
{
|
||||
namespace IO
|
||||
{
|
||||
/// <summary>
|
||||
/// Writes primitive types in binary to a stream and supports writing strings in a specific encoding.
|
||||
/// </summary>
|
||||
class BinaryWriter : public IDisposable, virtual Object
|
||||
{
|
||||
private:
|
||||
byte* _buffer;
|
||||
Encoder _encoder;
|
||||
Encoding _encoding;
|
||||
byte* _largeByteBuffer;
|
||||
int _maxChars;
|
||||
char* _tmpOneCharBuffer;
|
||||
static const int LargeByteBufferSize;
|
||||
|
||||
protected:
|
||||
Stream* OutStream;
|
||||
BinaryWriter();
|
||||
|
||||
virtual void Dispose(bool disposing);
|
||||
void Write7BiteEncodedInt(int value);
|
||||
|
||||
public:
|
||||
static const BinaryWriter Null;
|
||||
virtual Stream* BaseStream();
|
||||
|
||||
BinaryWriter(Stream* output);
|
||||
BinaryWriter(Stream* output, Encoding encoding);
|
||||
|
||||
virtual void Close();
|
||||
void Dispose();
|
||||
virtual void Flush();
|
||||
virtual Int64 Seek(int offset, SeekOrigin_t origin);
|
||||
virtual void Write(bool value);
|
||||
virtual void Write(byte value);
|
||||
virtual void Write(byte* value);
|
||||
virtual void Write(sbyte value);
|
||||
virtual void Write(char ch);
|
||||
virtual void Write(double value);
|
||||
virtual void Write(short value);
|
||||
virtual void Write(int value);
|
||||
virtual void Write(Int64 value);
|
||||
virtual void Write(float value);
|
||||
virtual void Write(char* value);
|
||||
virtual void Write(ushort value);
|
||||
virtual void Write(uint value);
|
||||
virtual void Write(ulong value);
|
||||
virtual void Write(byte* buffer, int index, int count);
|
||||
virtual void Write(char chars[], int index, int count);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif //_SYSTEM_IO_BINARYWRITER_
|
@ -58,6 +58,23 @@ namespace System
|
||||
};
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Represents additional options for creating a FileStream object.
|
||||
/// </summary>
|
||||
struct FileOptions
|
||||
{
|
||||
enum type
|
||||
{
|
||||
Asynchronous = 0x40000000,
|
||||
DeleteOnClose = 0x4000000,
|
||||
Encrypted = 0x4000,
|
||||
None = 0,
|
||||
RandomAccess = 0x10000000,
|
||||
SequentialScan = 0x8000000,
|
||||
WriteThrough = -2147483648
|
||||
};
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Contains constants for controlling the kind of access other System.IO.FileStream objects can have to the same
|
||||
/// file.
|
||||
@ -89,6 +106,7 @@ namespace System
|
||||
typedef FileAccess::type FileAccess_t;
|
||||
typedef FileAttributes::type FileAttributes_t;
|
||||
typedef FileMode::type FileMode_t;
|
||||
typedef FileOptions::type FileOptions_t;
|
||||
typedef FileShare::type FileShare_t;
|
||||
typedef SeekOrigin::type SeekOrigin_t;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ namespace System
|
||||
virtual byte* ToArray();
|
||||
void Write(byte buffer[], int offset, int count);
|
||||
void WriteByte(byte value);
|
||||
virtual void WriteTo(Stream stream);
|
||||
virtual void WriteTo(Stream* stream);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -7,10 +7,10 @@
|
||||
#ifndef _SYSTEM_IO_STREAM_
|
||||
#define _SYSTEM_IO_STREAM_
|
||||
|
||||
#include "../Types.h"
|
||||
#include <System/Types.h>
|
||||
#include "Enums.h"
|
||||
#include "../Delegates.h"
|
||||
#include "../Interfaces.h"
|
||||
#include <System/Delegates.h>
|
||||
#include <System/Interfaces.h>
|
||||
|
||||
namespace System
|
||||
{
|
||||
@ -27,12 +27,9 @@ namespace System
|
||||
int _asyncActiveCount;
|
||||
|
||||
protected:
|
||||
virtual WaitHandle CreateWaitHandle();
|
||||
virtual void Dispose(bool disposing);
|
||||
|
||||
public:
|
||||
Stream();
|
||||
|
||||
virtual bool CanRead();
|
||||
virtual bool CanSeek();
|
||||
virtual bool CanTimeOut();
|
||||
@ -41,10 +38,17 @@ namespace System
|
||||
Int64 Position;
|
||||
int ReadTimeOut;
|
||||
int WriteTimeOut;
|
||||
static const Stream Null;
|
||||
static const Stream* Null;
|
||||
|
||||
Stream();
|
||||
virtual ~Stream();
|
||||
|
||||
virtual IAsyncResult* BeginRead(byte buffer[], int offset, int count, AsyncCallback callback, Object* state);
|
||||
virtual IAsyncResult* BeginWrite(byte buffer[], int offset, int count, AsyncCallback callback, Object* state);
|
||||
virtual void Close();
|
||||
void Dispose();
|
||||
virtual int EndRead(IAsyncResult* asyncResult);
|
||||
virtual void EndWrite(IAsyncResult* asyncResult);
|
||||
virtual void Flush();
|
||||
virtual int Read(byte buffer[], int offset, int count);
|
||||
virtual int ReadByte();
|
||||
|
@ -7,18 +7,16 @@
|
||||
#ifndef _SYSTEM_IO_STREAMWRITER_
|
||||
#define _SYSTEM_IO_STREAMWRITER_
|
||||
|
||||
#include "../Text/Encoding.h"
|
||||
#include "../Text/Encoder.h"
|
||||
#include <System/Text/Encoding.h>
|
||||
#include <System/Text/Encoder.h>
|
||||
#include "Stream.h"
|
||||
#include "TextWriter.h"
|
||||
#include "../Types.h"
|
||||
#include <System/Types.h>
|
||||
|
||||
using namespace System::Text;
|
||||
|
||||
namespace System
|
||||
{
|
||||
class String;
|
||||
|
||||
namespace IO
|
||||
{
|
||||
/// <summary>
|
||||
@ -27,16 +25,21 @@ namespace System
|
||||
class StreamWriter : public TextWriter
|
||||
{
|
||||
private:
|
||||
byte byteBuffer;
|
||||
char charBuffer[];
|
||||
static Encoding _UTF8NoBOM;
|
||||
bool autoFlush;
|
||||
byte* byteBuffer;
|
||||
char* charBuffer;
|
||||
int charLen;
|
||||
int charPos;
|
||||
bool closable;
|
||||
static const int DefaultBufferSize;
|
||||
Encoder encoder;
|
||||
Encoding encoding;
|
||||
bool haveWrittenPreamble;
|
||||
Stream stream;
|
||||
Stream* stream;
|
||||
|
||||
static Stream* CreateFile(char* path, bool append);
|
||||
void Init(Stream* stream, Encoding encoding, int bufferSize);
|
||||
void Flush(bool flushStream, bool flushEncoder);
|
||||
|
||||
protected:
|
||||
@ -48,13 +51,14 @@ namespace System
|
||||
Encoding Encoding_();
|
||||
static const StreamWriter Null;
|
||||
|
||||
StreamWriter(const char* path);
|
||||
StreamWriter(const char* path, bool append);
|
||||
StreamWriter(const char* path, bool append, Encoding encoding);
|
||||
StreamWriter(const char* path, bool append, Encoding encoding, int bufferSize);
|
||||
StreamWriter(Stream stream);
|
||||
StreamWriter(Stream stream, Encoding encoding);
|
||||
StreamWriter(Stream stream, Encoding encoding, int bufferSize);
|
||||
StreamWriter(Stream* stream);
|
||||
StreamWriter(char* path);
|
||||
StreamWriter(Stream* stream, Encoding encoding);
|
||||
StreamWriter(char* path, bool append);
|
||||
StreamWriter(Stream* stream, Encoding encoding, int bufferSize);
|
||||
StreamWriter(char* path, bool append, Encoding encoding);
|
||||
StreamWriter(char* path, bool append, Encoding encoding, int bufferSize);
|
||||
virtual ~StreamWriter();
|
||||
|
||||
void Close();
|
||||
void Flush();
|
||||
|
@ -7,9 +7,8 @@
|
||||
#ifndef _SYSTEM_IO_TEXTWRITER_
|
||||
#define _SYSTEM_IO_TEXTWRITER_
|
||||
|
||||
#include "../Interfaces.h"
|
||||
#include "../String.h"
|
||||
#include "../Text/Encoding.h"
|
||||
#include <System/Interfaces.h>
|
||||
#include <System/Text/Encoding.h>
|
||||
|
||||
namespace System
|
||||
{
|
||||
@ -20,10 +19,16 @@ namespace System
|
||||
/// </summary>
|
||||
class TextWriter : public IDisposable
|
||||
{
|
||||
private:
|
||||
IFormatProvider* InternalFormatProvider;
|
||||
static const char* InitialNewLine;
|
||||
|
||||
protected:
|
||||
char CoreNewLine[];
|
||||
|
||||
TextWriter();
|
||||
TextWriter(IFormatProvider* provider);
|
||||
TextWriter(const TextWriter &obj);
|
||||
|
||||
virtual void Dispose(bool disposing);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef _TEXT_ENCODER_
|
||||
#define _TEXT_ENCODER_
|
||||
|
||||
#include "../Types.h"
|
||||
#include <System/Types.h>
|
||||
|
||||
namespace System
|
||||
{
|
||||
@ -12,10 +12,9 @@ namespace System
|
||||
/// </summary>
|
||||
class Encoder
|
||||
{
|
||||
protected:
|
||||
public:
|
||||
Encoder();
|
||||
|
||||
public:
|
||||
virtual void Convert(char* chars, int charCount, byte* bytes, int byteCount, bool flush, int charsUsed, int bytesUsed, bool completed);
|
||||
virtual void Convert(char chars[], int charIndex, int charCount, byte bytes[], int byteIndex, int byteCount, bool flush, int charsUsed, int bytesUsed, bool completed);
|
||||
virtual int GetByteCount(char* chars, int count, bool flush);
|
||||
|
@ -59,8 +59,8 @@ namespace System
|
||||
int GetHashCode();
|
||||
virtual int GetMaxByteCount(int charCount);
|
||||
virtual int GetMaxCharCount(int byteCount);
|
||||
virtual byte *GetPreamble();
|
||||
virtual String GetString(byte bytes[], int index, int count);
|
||||
virtual byte* GetPreamble();
|
||||
virtual char* GetString(byte bytes[], int index, int count);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
50
include/System/Text/UTF8Encoding.h
Normal file
50
include/System/Text/UTF8Encoding.h
Normal file
@ -0,0 +1,50 @@
|
||||
#ifndef _SYSTEM_TEXT_UTF8ENCODING_
|
||||
#define _SYSTEM_TEXT_UTF8ENCODING_
|
||||
|
||||
#include "Encoding.h"
|
||||
|
||||
namespace System
|
||||
{
|
||||
namespace Text
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a UTF-8 encoding of Unicode characters.
|
||||
/// </summary>
|
||||
class UTF8Encoding : public Encoding
|
||||
{
|
||||
private:
|
||||
bool emitUTF8Identifier;
|
||||
static const int FinalByte = 0x20000000;
|
||||
bool isThrowException;
|
||||
static const int SupplimentarySeq = 0x10000000;
|
||||
static const int ThreeByteSeq = 0x8000000;
|
||||
static const int UTF8_CODEPAGE = 0xfde9;
|
||||
|
||||
byte* GetBytesUnknown(byte* pSrc, int ch);
|
||||
|
||||
public:
|
||||
UTF8Encoding();
|
||||
UTF8Encoding(bool encoderShouldEmitUTF8Identifier);
|
||||
UTF8Encoding(bool encoderShouldEmitUTF8Identifier, bool throwOnInvalidBytes);
|
||||
bool Equals(Object* value);
|
||||
int GetByteCount(char* chars);
|
||||
int GetByteCount(char* chars, int count);
|
||||
int GetByteCount(char chars[], int index, int count);
|
||||
int GetBytes(char* chars, int charCount, byte* bytes, int byteCount);
|
||||
int GetBytes(char chars[], int charIndex, int charCount, byte bytes[], int byteIndex);
|
||||
int GetCharCount(byte* bytes, int count);
|
||||
int GetCharCount(byte bytes[], int index, int count);
|
||||
int GetChars(byte* bytes, int byteCount, char* chars, int charCount);
|
||||
int GetChars(byte bytes[], int byteIndex, int byteCount, char chars[], int charIndex);
|
||||
Decoder GetDecoder();
|
||||
Encoder GetEncoder();
|
||||
int GetHashCode();
|
||||
int GetMaxByteCount(int charCount);
|
||||
int GetMaxCharCount(int byteCount);
|
||||
byte* GetPreamble();
|
||||
char* GetString(byte bytes[], int index, int count);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif //_SYSTEM_TEXT_UTF8ENCODING_
|
@ -4,7 +4,7 @@ namespace XFX
|
||||
{
|
||||
namespace Graphics
|
||||
{
|
||||
DepthStencilBuffer()
|
||||
DepthStencilBuffer::DepthStencilBuffer()
|
||||
{
|
||||
_graphicsDevice = null;
|
||||
_width = 0;
|
||||
@ -16,7 +16,7 @@ namespace XFX
|
||||
|
||||
DepthStencilBuffer::DepthStencilBuffer(GraphicsDevice* graphicsDevice, int width, int height, DepthFormat_t format)
|
||||
{
|
||||
_graphicsDevice = graphiceDevice;
|
||||
_graphicsDevice = graphicsDevice;
|
||||
_width = width;
|
||||
_height = height;
|
||||
_format = format;
|
||||
@ -26,7 +26,7 @@ namespace XFX
|
||||
|
||||
DepthStencilBuffer::DepthStencilBuffer(GraphicsDevice* graphicsDevice, int width, int height, DepthFormat_t format, MultiSampleType_t multiSampleType, int multiSampleQuality)
|
||||
{
|
||||
_graphicsDevice = graphiceDevice;
|
||||
_graphicsDevice = graphicsDevice;
|
||||
_width = width;
|
||||
_height = height;
|
||||
_format = format;
|
||||
@ -61,7 +61,7 @@ namespace XFX
|
||||
|
||||
bool DepthStencilBuffer::IsDisposed()
|
||||
{
|
||||
return isDisposed();
|
||||
return isDisposed;
|
||||
}
|
||||
|
||||
int DepthStencilBuffer::Height()
|
||||
|
@ -37,40 +37,40 @@ namespace XFX
|
||||
return _isVisible;
|
||||
}
|
||||
|
||||
IAsyncResult* Guide::BeginShowKeyboardInput(PlayerIndex_t player, char *title, char *description, char *defaultText, ASyncCallback callback, Object* state)
|
||||
IAsyncResult* Guide::BeginShowKeyboardInput(PlayerIndex_t player, char *title, char *description, char *defaultText, AsyncCallback callback, Object* state)
|
||||
{
|
||||
if (title == null)
|
||||
if (!title)
|
||||
title = "";
|
||||
|
||||
if (description == null)
|
||||
if (!description)
|
||||
description = "";
|
||||
|
||||
if (defaultText == null)
|
||||
if (!defaultText)
|
||||
defaultText = "";
|
||||
|
||||
// just return null to stop warning until this thing's coded
|
||||
return null;
|
||||
}
|
||||
|
||||
IAsyncResult* Guide::BeginShowStorageDeviceSelector(int sizeInBytes, int directoryCount, ASyncCallback callback, Object* state)
|
||||
IAsyncResult* Guide::BeginShowStorageDeviceSelector(int sizeInBytes, int directoryCount, AsyncCallback callback, Object* state)
|
||||
{
|
||||
// just return null to stop warning until this thing's coded
|
||||
return null;
|
||||
}
|
||||
|
||||
IAsyncResult* Guide::BeginShowStorageDeviceSelector(ASyncCallback callback, Object* state)
|
||||
IAsyncResult* Guide::BeginShowStorageDeviceSelector(AsyncCallback callback, Object* state)
|
||||
{
|
||||
// just return null to stop warning until this thing's coded
|
||||
return null;
|
||||
}
|
||||
|
||||
IAsyncResult* Guide::BeginShowStorageDeviceSelector(PlayerIndex_t player, int sizeInBytes, int directoryCount, ASyncCallback callback, object state)
|
||||
IAsyncResult* Guide::BeginShowStorageDeviceSelector(PlayerIndex_t player, int sizeInBytes, int directoryCount, AsyncCallback callback, object state)
|
||||
{
|
||||
// just return null to stop warning until this thing's coded
|
||||
return null;
|
||||
}
|
||||
|
||||
IAsyncResult* Guide::BeginShowStorageDeviceSelector(PlayerIndex_t player, ASyncCallback callback, Object* state)
|
||||
IAsyncResult* Guide::BeginShowStorageDeviceSelector(PlayerIndex_t player, AsyncCallback callback, Object* state)
|
||||
{
|
||||
// just return null to stop warning until this thing's coded
|
||||
return null;
|
||||
|
123
src/libXFX/PacketReader.cpp
Normal file
123
src/libXFX/PacketReader.cpp
Normal file
@ -0,0 +1,123 @@
|
||||
// Copyright (C) 2010-2012, XFX Team
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of the copyright holder nor the names of any
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <Net/PacketReader.h>
|
||||
#include <Matrix.h>
|
||||
#include <Quaternion.h>
|
||||
#include <Vector2.h>
|
||||
#include <Vector3.h>
|
||||
#include <Vector4.h>
|
||||
|
||||
namespace XFX
|
||||
{
|
||||
namespace Net
|
||||
{
|
||||
int PacketReader::Length()
|
||||
{
|
||||
return (int)BaseStream().Length();
|
||||
}
|
||||
|
||||
int PacketReader::Position()
|
||||
{
|
||||
return (int)BaseStream().Position;
|
||||
}
|
||||
|
||||
int PacketReader::Position(int newValue)
|
||||
{
|
||||
BaseStream().Position = newValue;
|
||||
}
|
||||
|
||||
PacketReader::PacketReader()
|
||||
: BinaryReader(MemoryStream(0))
|
||||
{
|
||||
}
|
||||
|
||||
PacketReader::PacketReader(int capacity)
|
||||
: BinaryReader(MemoryStream(capacity))
|
||||
{
|
||||
}
|
||||
|
||||
Matrix PacketReader::ReadMatrix()
|
||||
{
|
||||
Matrix matrix;
|
||||
matrix.M11 = ReadSingle();
|
||||
matrix.M12 = ReadSingle();
|
||||
matrix.M13 = ReadSingle();
|
||||
matrix.M14 = ReadSingle();
|
||||
matrix.M21 = ReadSingle();
|
||||
matrix.M22 = ReadSingle();
|
||||
matrix.M23 = ReadSingle();
|
||||
matrix.M24 = ReadSingle();
|
||||
matrix.M31 = ReadSingle();
|
||||
matrix.M32 = ReadSingle();
|
||||
matrix.M33 = ReadSingle();
|
||||
matrix.M34 = ReadSingle();
|
||||
matrix.M41 = ReadSingle();
|
||||
matrix.M42 = ReadSingle();
|
||||
matrix.M43 = ReadSingle();
|
||||
matrix.M44 = ReadSingle();
|
||||
return matrix;
|
||||
}
|
||||
|
||||
Quaternion PacketReader::ReadQuaternion()
|
||||
{
|
||||
Quaternion quaternion;
|
||||
quaternion.X = ReadSingle();
|
||||
quaternion.Y = ReadSingle();
|
||||
quaternion.Z = ReadSingle();
|
||||
quaternion.W = ReadSingle();
|
||||
return quaternion;
|
||||
}
|
||||
|
||||
Vector2 PacketReader::ReadVector2()
|
||||
{
|
||||
Vector2 vector2;
|
||||
vector2.X = ReadSingle();
|
||||
vector2.Y = ReadSingle();
|
||||
return vector2;
|
||||
}
|
||||
|
||||
Vector3 PacketReader::ReadVector3()
|
||||
{
|
||||
Vector3 vector3;
|
||||
vector3.X = ReadSingle();
|
||||
vector3.Y = ReadSingle();
|
||||
vector3.Z = ReadSingle();
|
||||
return vector3;
|
||||
}
|
||||
|
||||
Vector4 PacketReader::ReadVector4()
|
||||
{
|
||||
Vector4 vector4;
|
||||
vector4.X = ReadSingle();
|
||||
vector4.Y = ReadSingle();
|
||||
vector4.Z = ReadSingle();
|
||||
vector4.W = ReadSingle();
|
||||
return vector4;
|
||||
}
|
||||
}
|
||||
}
|
115
src/libXFX/PacketWriter.cpp
Normal file
115
src/libXFX/PacketWriter.cpp
Normal file
@ -0,0 +1,115 @@
|
||||
// Copyright (C) 2010-2012, XFX Team
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of the copyright holder nor the names of any
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <Net/PacketWriter.h>
|
||||
#include <System/IO/MemoryStream.h>
|
||||
|
||||
#include <Matrix.h>
|
||||
#include <Quaternion.h>
|
||||
#include <Vector2.h>
|
||||
#include <Vector3.h>
|
||||
#include <Vector4.h>
|
||||
|
||||
namespace XFX
|
||||
{
|
||||
namespace Net
|
||||
{
|
||||
int PacketWriter::Length()
|
||||
{
|
||||
return (int)BaseStream.Length;
|
||||
}
|
||||
|
||||
int PacketWriter::Position()
|
||||
{
|
||||
return (int)BaseStream.Position;
|
||||
}
|
||||
|
||||
void PacketWriter::Position(int newValue)
|
||||
{
|
||||
BaseStream.Position = newValue);
|
||||
}
|
||||
|
||||
PacketWriter::PacketWriter()
|
||||
: BinaryWriter(MemoryStream(0))
|
||||
{
|
||||
}
|
||||
|
||||
PacketWriter::PacketWriter(int capacity)
|
||||
: BinaryWriter(MemoryStream(capacity))
|
||||
{
|
||||
}
|
||||
|
||||
void PacketWriter::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);
|
||||
}
|
||||
|
||||
void PacketWriter::Write(Quaternion value)
|
||||
{
|
||||
Write(value.X);
|
||||
Write(value.Y);
|
||||
Write(value.Z);
|
||||
Write(value.W);
|
||||
}
|
||||
|
||||
void PacketWriter::Write(Vector2 value)
|
||||
{
|
||||
Write(value.X);
|
||||
Write(value.Y);
|
||||
}
|
||||
|
||||
void PacketWriter::Write(Vector3 value)
|
||||
{
|
||||
Write(value.X);
|
||||
Write(value.Y);
|
||||
Write(value.Z);
|
||||
}
|
||||
|
||||
void PacketWriter::Write(Vector4 value)
|
||||
{
|
||||
Write(value.X);
|
||||
Write(value.Y);
|
||||
Write(value.Z);
|
||||
Write(value.W);
|
||||
}
|
||||
}
|
||||
}
|
@ -46,10 +46,10 @@ namespace XFX
|
||||
if (creationParameters.Width == 0) creationParameters.Width = texinfo.Width;
|
||||
if (creationParameters.Height == 0) creationParameters.Height = texinfo.Height;
|
||||
if (creationParameters.Depth == 0) creationParameters.Depth = texinfo.Depth;
|
||||
/*if (texinfo.ResourceType == ResourceType::Texture2D)
|
||||
if (texinfo.ResourceType == ResourceType::Texture2D)
|
||||
{
|
||||
int ImgID;
|
||||
Il::ilGenImages(1, out ImgID);
|
||||
/*Il::ilGenImages(1, out ImgID);
|
||||
Il::ilBindImage(ImgID);
|
||||
Il::ilLoadImage(filename);
|
||||
int width = Il::ilGetInteger(Il::IL_IMAGE_WIDTH);
|
||||
@ -64,10 +64,10 @@ namespace XFX
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, Il::ilGetInteger(Il::IL_IMAGE_BYTES_PER_PIXEL), creationParameters.Width, creationParameters.Height, 0, GL_RGBA, GL_UNSIGNED_BYTE, Il::ilGetData());
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
Il::ilBindImage(0);
|
||||
Il::ilBindImage(0); */
|
||||
//Il::ilDeleteImage(0);
|
||||
return tex;
|
||||
} */
|
||||
}
|
||||
else if (texinfo.ResourceType_ == ResourceType::Texture3D) { }
|
||||
else if (texinfo.ResourceType_ == ResourceType::Texture3DVolume) { } //FIXME: Should we handle this here too?
|
||||
else if (texinfo.ResourceType_ == ResourceType::TextureCube) { }
|
||||
|
@ -37,6 +37,11 @@ namespace XFX
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
void TextureCollection::Dispose(bool disposing)
|
||||
{
|
||||
textures.Clear();
|
||||
}
|
||||
|
||||
TextureCollection::TextureCollection()
|
||||
{
|
||||
// Nothing
|
||||
|
@ -331,6 +331,14 @@
|
||||
<Filter
|
||||
Name="Net"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\PacketReader.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PacketWriter.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
@ -649,6 +657,14 @@
|
||||
RelativePath="..\..\include\Net\NetworkException.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\Net\PacketReader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\Net\PacketWriter.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<File
|
||||
|
@ -35,10 +35,10 @@ OBJS = BoundingBox.o BoundingFrustrum.o BoundingSphere.o MathHelper.o Matrix.o P
|
||||
AUDIO_OBJS =
|
||||
CONTENT_OBJS = ContentManager.o ContentReader.o
|
||||
GAMERSERVICES_OBJS = Guide.o
|
||||
GRAPHICS_OBJS = Color.o DisplayMode.o DisplayModeCollection.o GraphicsAdapter.o GraphicsDevice.o pbKit.o Sprite.o SpriteBatch.o SpriteFont.o Texture.o Texture2D.o TextureCollection.o TextureCreationParameters.o VertexElement.o VertexPositionColor.o VertexPositionNormalTexture.o VertexPositionTexture.o Viewport.o
|
||||
GRAPHICS_OBJS = Color.o DepthStencilBuffer.o DisplayMode.o DisplayModeCollection.o GraphicsAdapter.o GraphicsDevice.o pbKit.o Sprite.o SpriteBatch.o SpriteFont.o Texture.o Texture2D.o TextureCollection.o TextureCreationParameters.o VertexElement.o VertexPositionColor.o VertexPositionNormalTexture.o VertexPositionTexture.o Viewport.o
|
||||
INPUT_OBJS = GamePad.o Keyboard.o Mouse.o
|
||||
MEDIA_OBJS = VideoPlayer.o
|
||||
NET_OBJS =
|
||||
NET_OBJS = PacketReader.o PacketWriter.o
|
||||
STORAGE_OBJS = StorageContainer.o StorageDevice.o StorageDeviceNotConnectedException.o
|
||||
|
||||
OBJS1 = $(OBJS) $(GAMERSERVICES_OBJS) $(GRAPHICS_OBJS) $(INPUT_OBJS) $(MEDIA_OBJS) $(STORAGE_OBJS)
|
||||
|
@ -35,19 +35,26 @@ namespace System
|
||||
{
|
||||
namespace IO
|
||||
{
|
||||
Stream BinaryReader::BaseStream()
|
||||
Stream* BinaryReader::BaseStream()
|
||||
{
|
||||
return m_stream;
|
||||
}
|
||||
|
||||
BinaryReader::BinaryReader(Stream input)
|
||||
BinaryReader::BinaryReader(Stream* input)
|
||||
{
|
||||
BinaryReader(input, Encoding::UTF8());
|
||||
if (!input->CanRead())
|
||||
throw ArgumentException("The stream doesn't support reading.");
|
||||
|
||||
m_disposed = false;
|
||||
m_stream = input;
|
||||
m_encoding = Encoding::UTF8();
|
||||
m_decoder = m_encoding.GetDecoder();
|
||||
m_buffer = new byte[32];
|
||||
}
|
||||
|
||||
BinaryReader::BinaryReader(Stream input, Encoding encoding)
|
||||
BinaryReader::BinaryReader(Stream* input, Encoding encoding)
|
||||
{
|
||||
if (!input.CanRead())
|
||||
if (!input->CanRead())
|
||||
throw ArgumentException("The stream doesn't support reading.");
|
||||
|
||||
m_disposed = false;
|
||||
@ -74,14 +81,16 @@ namespace System
|
||||
|
||||
void BinaryReader::Dispose(bool disposing)
|
||||
{
|
||||
m_stream.Close();
|
||||
m_stream->Close();
|
||||
|
||||
m_disposed = true;
|
||||
delete m_buffer;
|
||||
m_encoding = NULL;
|
||||
m_stream.Close();
|
||||
m_stream = Stream::Null;
|
||||
m_buffer = null;
|
||||
m_encoding = null;
|
||||
m_stream->Close();
|
||||
m_stream = null;
|
||||
delete[] m_charBuffer;
|
||||
m_charBuffer = null;
|
||||
}
|
||||
|
||||
void BinaryReader::FillBuffer(int numBytes)
|
||||
@ -93,7 +102,7 @@ namespace System
|
||||
int num2 = 0;
|
||||
if (numBytes == 1)
|
||||
{
|
||||
num2 = m_stream.ReadByte();
|
||||
num2 = m_stream->ReadByte();
|
||||
if (num2 == -1)
|
||||
{
|
||||
throw EndOfStreamException("Attempted to read beyond End OF File.");
|
||||
@ -104,7 +113,7 @@ namespace System
|
||||
{
|
||||
do
|
||||
{
|
||||
num2 = m_stream.Read(m_buffer, offset, numBytes - offset);
|
||||
num2 = m_stream->Read(m_buffer, offset, numBytes - offset);
|
||||
if (num2 == 0)
|
||||
{
|
||||
throw EndOfStreamException("Attempted to read beyond End OF File.");
|
||||
@ -117,7 +126,48 @@ namespace System
|
||||
|
||||
int BinaryReader::InternalReadChars(char buffer[], int index, int count)
|
||||
{
|
||||
|
||||
int num = 0;
|
||||
int num2 = 0;
|
||||
int num3 = count;
|
||||
if (!m_charBytes)
|
||||
{
|
||||
m_charBytes = new byte[0x80];
|
||||
}
|
||||
while (num3 > 0)
|
||||
{
|
||||
num2 = num3;
|
||||
if (m_2BytesPerChar)
|
||||
{
|
||||
num2 = num2 << 1;
|
||||
}
|
||||
if (num2 > 0x80)
|
||||
{
|
||||
num2 = 0x80;
|
||||
}
|
||||
if (m_isMemoryStream)
|
||||
{
|
||||
/*MemoryStream stream = (MemoryStream)*m_stream;
|
||||
int position = stream.InternalGetPosition();
|
||||
num2 = stream.InternalEmulateRead(num2);
|
||||
if (num2 == 0)
|
||||
{
|
||||
return (count - num3);
|
||||
}
|
||||
num = m_decoder.GetChars(stream.InternalGetBuffer(), position, num2, buffer, index);*/
|
||||
}
|
||||
else
|
||||
{
|
||||
num2 = m_stream->Read(m_charBytes, 0, num2);
|
||||
if (num2 == 0)
|
||||
{
|
||||
return (count - num3);
|
||||
}
|
||||
num = m_decoder.GetChars(m_charBytes, 0, num2, buffer, index);
|
||||
}
|
||||
num3 -= num;
|
||||
index += num;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
int BinaryReader::InternalReadOneChar()
|
||||
@ -125,10 +175,10 @@ namespace System
|
||||
Int64 position;
|
||||
int num = 0;
|
||||
int byteCount = 0;
|
||||
position = position = 0LL;
|
||||
if (m_stream.CanSeek())
|
||||
position = 0LL;
|
||||
if (m_stream->CanSeek())
|
||||
{
|
||||
position = m_stream.Position;
|
||||
position = m_stream->Position;
|
||||
}
|
||||
if (m_charBytes == null)
|
||||
{
|
||||
@ -141,7 +191,7 @@ namespace System
|
||||
while (num == 0)
|
||||
{
|
||||
byteCount = m_2BytesPerChar ? 2 : 1;
|
||||
int num4 = m_stream.ReadByte();
|
||||
int num4 = m_stream->ReadByte();
|
||||
m_charBytes[0] = (byte) num4;
|
||||
if (num4 == -1)
|
||||
{
|
||||
@ -149,7 +199,7 @@ namespace System
|
||||
}
|
||||
if (byteCount == 2)
|
||||
{
|
||||
num4 = m_stream.ReadByte();
|
||||
num4 = m_stream->ReadByte();
|
||||
m_charBytes[1] = (byte) num4;
|
||||
if (num4 == -1)
|
||||
{
|
||||
@ -167,9 +217,9 @@ namespace System
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
if (m_stream.CanSeek())
|
||||
if (m_stream->CanSeek())
|
||||
{
|
||||
m_stream.Seek(position - m_stream.Position, SeekOrigin::Current);
|
||||
m_stream->Seek(position - m_stream->Position, SeekOrigin::Current);
|
||||
}
|
||||
throw;
|
||||
}
|
||||
@ -183,13 +233,13 @@ namespace System
|
||||
|
||||
int BinaryReader::PeekChar()
|
||||
{
|
||||
if (!m_stream.CanSeek())
|
||||
if (!m_stream->CanSeek())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
long position = m_stream.Position;
|
||||
Int64 position = m_stream->Position;
|
||||
int num2 = this->Read();
|
||||
m_stream.Position = position;
|
||||
m_stream->Position = position;
|
||||
return num2;
|
||||
}
|
||||
|
||||
@ -200,7 +250,7 @@ namespace System
|
||||
|
||||
int BinaryReader::Read(byte buffer[], int index, int count)
|
||||
{
|
||||
if(&m_stream == null)
|
||||
if(!m_stream)
|
||||
{
|
||||
if (m_disposed)
|
||||
throw ObjectDisposedException("BinaryReader", "Cannot read from a closed BinaryReader.");
|
||||
@ -220,7 +270,7 @@ namespace System
|
||||
if (Array::Length(buffer) < index + count)
|
||||
throw ArgumentException("buffer is too small");
|
||||
|
||||
int bytes_read = m_stream.Read(buffer, index, count);
|
||||
int bytes_read = m_stream->Read(buffer, index, count);
|
||||
|
||||
return(bytes_read);
|
||||
}
|
||||
|
50
src/libmscorlib/BinaryWriter.cpp
Normal file
50
src/libmscorlib/BinaryWriter.cpp
Normal file
@ -0,0 +1,50 @@
|
||||
#include <System/IO/BinaryWriter.h>
|
||||
#include <System/Exception.h>
|
||||
#include <System/Text/UTF8Encoding.h>
|
||||
|
||||
namespace System
|
||||
{
|
||||
namespace IO
|
||||
{
|
||||
const int BinaryWriter::LargeByteBufferSize = 0x100;
|
||||
|
||||
BinaryWriter::BinaryWriter()
|
||||
{
|
||||
_tmpOneCharBuffer = new char[1];
|
||||
OutStream = new Stream();
|
||||
_buffer = new byte[0x10];
|
||||
_encoding = UTF8Encoding(false, true);
|
||||
_encoder = _encoding.GetEncoder();
|
||||
}
|
||||
|
||||
BinaryWriter::BinaryWriter(Stream* output)
|
||||
{
|
||||
_tmpOneCharBuffer = new char[1];
|
||||
|
||||
if (!output)
|
||||
{
|
||||
throw ArgumentNullException("output");
|
||||
}
|
||||
|
||||
OutStream = output;
|
||||
_buffer = new byte[0x10];
|
||||
_encoding = UTF8Encoding(false, true);
|
||||
_encoder = _encoding.GetEncoder();
|
||||
}
|
||||
|
||||
BinaryWriter::BinaryWriter(Stream* output, Encoding encoding)
|
||||
{
|
||||
_tmpOneCharBuffer = new char[1];
|
||||
|
||||
if (!output)
|
||||
{
|
||||
throw ArgumentNullException("output");
|
||||
}
|
||||
|
||||
OutStream = output;
|
||||
_buffer = new byte[0x10];
|
||||
_encoding = encoding;
|
||||
_encoder = _encoding.GetEncoder();
|
||||
}
|
||||
}
|
||||
}
|
@ -289,7 +289,7 @@ namespace System
|
||||
|
||||
void FileStream::Write(byte array[], int offset, int count)
|
||||
{
|
||||
XWriteFile(handle, &array[offset], count, null);
|
||||
XWriteFile(handle, &array[offset], count, null);
|
||||
}
|
||||
|
||||
void FileStream::WriteByte(byte value)
|
||||
|
@ -35,8 +35,7 @@ namespace System
|
||||
{
|
||||
namespace IO
|
||||
{
|
||||
// The XBOX Limits us to 64MB; we do not take XDK/Debug units into account
|
||||
const int MemoryStream::MemStreamMaxLength = 0x40000000;
|
||||
const int MemoryStream::MemStreamMaxLength = 0x7fffffff;
|
||||
|
||||
bool MemoryStream::CanRead()
|
||||
{
|
||||
@ -123,7 +122,7 @@ namespace System
|
||||
|
||||
MemoryStream::MemoryStream(byte buffer[])
|
||||
{
|
||||
if (buffer == null)
|
||||
if (!buffer)
|
||||
{
|
||||
throw ArgumentNullException("buffer", "Buffer was NULL.");
|
||||
}
|
||||
@ -138,7 +137,7 @@ namespace System
|
||||
|
||||
MemoryStream::MemoryStream(byte buffer[], bool writable)
|
||||
{
|
||||
if (buffer == null)
|
||||
if (!buffer)
|
||||
{
|
||||
throw ArgumentNullException("buffer", "Buffer was NULL.");
|
||||
}
|
||||
@ -152,7 +151,7 @@ namespace System
|
||||
|
||||
MemoryStream::MemoryStream(byte buffer[], int index, int count)
|
||||
{
|
||||
if (buffer == null)
|
||||
if (!buffer)
|
||||
{
|
||||
throw ArgumentNullException("buffer", "Buffer was NULL.");
|
||||
}
|
||||
@ -168,12 +167,13 @@ namespace System
|
||||
{
|
||||
throw ArgumentException("Invalid offset or length.");
|
||||
}
|
||||
_buffer = buffer;
|
||||
_origin = _position = index;
|
||||
_length = _capacity = index + count;
|
||||
_buffer = new byte[count];
|
||||
Array::Copy(buffer, index, _buffer, 0, count);
|
||||
_origin = 0;
|
||||
_length = _capacity = count;
|
||||
_writable = true;
|
||||
_exposable = false;
|
||||
_expandable = true;
|
||||
_expandable = false;
|
||||
_isOpen = true;
|
||||
}
|
||||
|
||||
@ -195,9 +195,10 @@ namespace System
|
||||
{
|
||||
throw ArgumentException("Invalid offset or length.");
|
||||
}
|
||||
_buffer = buffer;
|
||||
_origin = _position = index;
|
||||
_length = _capacity = index + count;
|
||||
_buffer = new byte[count];
|
||||
Array::Copy(buffer, index, _buffer, 0, count);
|
||||
_origin = 0;
|
||||
_length = _capacity = count;
|
||||
_writable = writable;
|
||||
_exposable = false;
|
||||
_expandable = true;
|
||||
@ -222,12 +223,13 @@ namespace System
|
||||
{
|
||||
throw ArgumentException("Invalid offset or length.");
|
||||
}
|
||||
_buffer = buffer;
|
||||
_origin = _position = index;
|
||||
_length = _capacity = index + count;
|
||||
_buffer = new byte[count];
|
||||
Array::Copy(buffer, index, _buffer, 0, count);
|
||||
_origin = 0;
|
||||
_length = _capacity = count;
|
||||
_writable = writable;
|
||||
_exposable = publiclyVisible;
|
||||
_expandable = true;
|
||||
_expandable = false;
|
||||
_isOpen = true;
|
||||
}
|
||||
|
||||
@ -423,7 +425,7 @@ namespace System
|
||||
{
|
||||
throw NotSupportedException("This Stream does not support writing.");
|
||||
}
|
||||
if (_buffer == null)
|
||||
if (!buffer)
|
||||
{
|
||||
throw ArgumentNullException("buffer", "Buffer was null.");
|
||||
}
|
||||
@ -499,13 +501,13 @@ namespace System
|
||||
_buffer[_position++] = value;
|
||||
}
|
||||
|
||||
void MemoryStream::WriteTo(Stream stream)
|
||||
void MemoryStream::WriteTo(Stream* stream)
|
||||
{
|
||||
if (!_isOpen)
|
||||
{
|
||||
throw ObjectDisposedException(null, "Stream is closed.");
|
||||
}
|
||||
stream.Write(_buffer, _origin, _length - _origin);
|
||||
stream->Write(_buffer, _origin, _length - _origin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,11 +33,17 @@ namespace System
|
||||
{
|
||||
namespace IO
|
||||
{
|
||||
const Stream* Stream::Null = new Stream();
|
||||
|
||||
Stream::Stream()
|
||||
{
|
||||
_asyncActiveCount = 1;
|
||||
}
|
||||
|
||||
Stream::~Stream()
|
||||
{
|
||||
}
|
||||
|
||||
bool Stream::CanTimeOut()
|
||||
{
|
||||
return false;
|
||||
@ -53,6 +59,14 @@ namespace System
|
||||
Close();
|
||||
}
|
||||
|
||||
void Stream::EndWrite(IAsyncResult* asyncResult)
|
||||
{
|
||||
if (!asyncResult)
|
||||
{
|
||||
throw ArgumentNullException("asyncResult");
|
||||
}
|
||||
}
|
||||
|
||||
int Stream::ReadByte()
|
||||
{
|
||||
byte* buffer = new byte[1];
|
||||
|
@ -1,15 +1,144 @@
|
||||
// Copyright (C) 2010-2012, XFX Team
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of the copyright holder nor the names of any
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <System/Array.h>
|
||||
#include <System/Buffer.h>
|
||||
#include <System/Exception.h>
|
||||
#include <System/IO/FileStream.h>
|
||||
#include <System/IO/StreamWriter.h>
|
||||
#include <System/Text/UTF8Encoding.h>
|
||||
|
||||
namespace System
|
||||
{
|
||||
namespace IO
|
||||
{
|
||||
const int StreamWriter::DefaultBufferSize = 0x400;
|
||||
Encoding StreamWriter::_UTF8NoBOM = UTF8Encoding(false, true);
|
||||
|
||||
StreamWriter::StreamWriter(Stream* stream)
|
||||
: TextWriter(null)
|
||||
{
|
||||
if (!stream)
|
||||
{
|
||||
throw ArgumentNullException("stream");
|
||||
}
|
||||
if (!stream->CanWrite())
|
||||
{
|
||||
throw ArgumentException("");
|
||||
}
|
||||
Init(stream, _UTF8NoBOM, DefaultBufferSize);
|
||||
}
|
||||
|
||||
StreamWriter::StreamWriter(char* path)
|
||||
: TextWriter(null)
|
||||
{
|
||||
if (!path)
|
||||
{
|
||||
throw ArgumentNullException("path");
|
||||
}
|
||||
Stream* stream = CreateFile(path, true);
|
||||
Init(stream, _UTF8NoBOM, 0x400);
|
||||
}
|
||||
|
||||
StreamWriter::StreamWriter(Stream* stream, Encoding encoding)
|
||||
: TextWriter(null)
|
||||
{
|
||||
if (!stream)
|
||||
{
|
||||
throw ArgumentNullException("stream");
|
||||
}
|
||||
if (!stream->CanWrite())
|
||||
{
|
||||
throw ArgumentException("");
|
||||
}
|
||||
Init(stream, encoding, DefaultBufferSize);
|
||||
}
|
||||
|
||||
StreamWriter::StreamWriter(char* path, bool append)
|
||||
: TextWriter(null)
|
||||
{
|
||||
if (!path)
|
||||
{
|
||||
throw ArgumentNullException("path");
|
||||
}
|
||||
Stream* stream = CreateFile(path, append);
|
||||
Init(stream, _UTF8NoBOM, 0x400);
|
||||
}
|
||||
|
||||
StreamWriter::StreamWriter(Stream* stream, Encoding encoding, int bufferSize)
|
||||
: TextWriter(null)
|
||||
{
|
||||
if (!stream)
|
||||
{
|
||||
throw ArgumentNullException("stream");
|
||||
}
|
||||
if (!stream->CanWrite())
|
||||
{
|
||||
throw ArgumentException("");
|
||||
}
|
||||
if (bufferSize < 0)
|
||||
{
|
||||
throw ArgumentOutOfRangeException("bufferSize", "Non-negative number required.");
|
||||
}
|
||||
Init(stream, encoding, bufferSize);
|
||||
}
|
||||
|
||||
StreamWriter::StreamWriter(char* path, bool append, Encoding encoding)
|
||||
: TextWriter(null)
|
||||
{
|
||||
if (!path)
|
||||
{
|
||||
throw ArgumentNullException("path");
|
||||
}
|
||||
Stream* stream = CreateFile(path, append);
|
||||
Init(stream, encoding, 0x400);
|
||||
}
|
||||
|
||||
StreamWriter::StreamWriter(char* path, bool append, Encoding encoding, int bufferSize)
|
||||
: TextWriter(null)
|
||||
{
|
||||
if (!path)
|
||||
{
|
||||
throw ArgumentNullException("path");
|
||||
}
|
||||
Stream* stream = CreateFile(path, append);
|
||||
Init(stream, encoding, bufferSize);
|
||||
}
|
||||
|
||||
void StreamWriter::Close()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
Stream* StreamWriter::CreateFile(char* path, bool append)
|
||||
{
|
||||
return new FileStream(path, append ? FileMode::Append : FileMode::Create, FileAccess::Write, FileShare::Read, 0x1000, FileOptions::SequentialScan);
|
||||
}
|
||||
|
||||
void StreamWriter::Dispose(bool disposing)
|
||||
{
|
||||
if(!closable)
|
||||
@ -33,28 +162,81 @@ namespace System
|
||||
byte* preamble = encoding.GetPreamble();
|
||||
if (Array::Length(preamble) > 0)
|
||||
{
|
||||
stream.Write(preamble, 0, Array::Length(preamble));
|
||||
stream->Write(preamble, 0, Array::Length(preamble));
|
||||
}
|
||||
}
|
||||
int count = encoder.GetBytes(charBuffer, 0, charPos, &byteBuffer, 0, flushEncoder);
|
||||
int count = encoder.GetBytes(charBuffer, 0, charPos, byteBuffer, 0, flushEncoder);
|
||||
charPos = 0;
|
||||
if (count > 0)
|
||||
{
|
||||
stream.Write(&byteBuffer, 0, count);
|
||||
stream->Write(byteBuffer, 0, count);
|
||||
}
|
||||
if(flushStream)
|
||||
{
|
||||
stream.Flush();
|
||||
stream->Flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void StreamWriter::Init(Stream* stream, Encoding encoding, int bufferSize)
|
||||
{
|
||||
this->stream = stream;
|
||||
this->encoding = encoding;
|
||||
encoder = this->encoding.GetEncoder();
|
||||
if (bufferSize < 0x80)
|
||||
{
|
||||
bufferSize = 0x80;
|
||||
}
|
||||
charBuffer = new char[bufferSize];
|
||||
byteBuffer = new byte[encoding.GetMaxByteCount(bufferSize)];
|
||||
charLen = bufferSize;
|
||||
if (stream->CanSeek() && (stream->Position > 0L))
|
||||
{
|
||||
haveWrittenPreamble = true;
|
||||
}
|
||||
closable = true;
|
||||
}
|
||||
|
||||
void StreamWriter::Write(char value)
|
||||
{
|
||||
if(charPos == charLen)
|
||||
{
|
||||
Flush(false, false);
|
||||
}
|
||||
charBuffer[charPos] = value;
|
||||
charPos++;
|
||||
if (autoFlush)
|
||||
{
|
||||
Flush(true, false);
|
||||
}
|
||||
}
|
||||
|
||||
void StreamWriter::Write(char buffer[])
|
||||
{
|
||||
if (buffer)
|
||||
{
|
||||
int num3;
|
||||
int num = 0;
|
||||
for (int i = Array::Length(buffer); i > 0; i -= num3)
|
||||
{
|
||||
if (charPos == charLen)
|
||||
{
|
||||
Flush(false, false);
|
||||
}
|
||||
num3 = charLen - charPos;
|
||||
if (num3 > i)
|
||||
{
|
||||
num3 = i;
|
||||
}
|
||||
Buffer::BlockCopy(buffer, num * 2, charBuffer, charPos * 2, num3 * 2);
|
||||
charPos += num3;
|
||||
num += num3;
|
||||
}
|
||||
if (autoFlush)
|
||||
{
|
||||
Flush(true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
67
src/libmscorlib/TextWriter.cpp
Normal file
67
src/libmscorlib/TextWriter.cpp
Normal file
@ -0,0 +1,67 @@
|
||||
// Copyright (C) 2010-2012, XFX Team
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of the copyright holder nor the names of any
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <System/IO/TextWriter.h>
|
||||
|
||||
namespace System
|
||||
{
|
||||
namespace IO
|
||||
{
|
||||
const char* TextWriter::InitialNewLine = "\r\n";
|
||||
TextWriter::TextWriter()
|
||||
{
|
||||
CoreNewLine = new char[] { '\r', '\n' };
|
||||
InternalFormatProvider = null;
|
||||
}
|
||||
|
||||
TextWriter::TextWriter(IFormatProvider* provider)
|
||||
{
|
||||
CoreNewLine = new char[] { '\r', '\n' };
|
||||
InternalFormatProvider = provider;
|
||||
}
|
||||
|
||||
TextWriter::TextWriter(const TextWriter &obj)
|
||||
{
|
||||
CoreNewLine = obj.CoreNewLine;
|
||||
InternalFormatProvider = obj.InternalFormatProvider;
|
||||
}
|
||||
|
||||
void TextWriter::Write(bool value)
|
||||
{
|
||||
Write((value ? "True" : "False"));
|
||||
}
|
||||
|
||||
void TextWriter::Write(char buffer[])
|
||||
{
|
||||
if (buffer)
|
||||
{
|
||||
Write(buffer, 0, Array::Length(buffer));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -85,10 +85,26 @@ namespace System
|
||||
|
||||
char* Version::ToString(int fieldCount)
|
||||
{
|
||||
if(fieldCount <= 0 || fieldCount > 4)
|
||||
switch(fieldCount)
|
||||
{
|
||||
case 0:
|
||||
return "";
|
||||
break;
|
||||
case 1:
|
||||
return String::Format("%d", _major);
|
||||
break;
|
||||
case 2:
|
||||
return String::Format("%d.%d", _major, _minor);
|
||||
break;
|
||||
case 3:
|
||||
return String::Format("%d.%d.%d", _major, _minor, _build);
|
||||
break;
|
||||
case 4:
|
||||
return String::Format("%d.%d.%d.%d", _major, _minor, _build, _revision);
|
||||
break;
|
||||
default:
|
||||
throw ArgumentOutOfRangeException("fieldCount");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
bool Version::operator !=(Version other)
|
||||
|
@ -183,6 +183,10 @@
|
||||
RelativePath=".\BinaryReader.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\BinaryWriter.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Directory.cpp"
|
||||
>
|
||||
@ -227,6 +231,10 @@
|
||||
RelativePath=".\StreamWriter.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\TextWriter.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Threading"
|
||||
@ -381,6 +389,10 @@
|
||||
RelativePath="..\..\include\System\IO\BinaryReader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\System\IO\BinaryWriter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\System\IO\Directory.h"
|
||||
>
|
||||
@ -541,6 +553,10 @@
|
||||
RelativePath="..\..\include\System\Text\Encoding.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\include\System\Text\UTF8Encoding.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Runtime"
|
||||
|
@ -26,7 +26,7 @@ LD_FLAGS = $(CLINK) $(ALIGN) $(SHARED) $(ENTRYPOINT) $(STRIP)
|
||||
LD_DIRS = -L$(PREFIX)/i386-pc-xbox/lib -L$(PREFIX)/lib
|
||||
LD_LIBS = $(LD_DIRS) -lm -lopenxdk -lhal -lc -lusb -lc -lxboxkrnl -lc -lhal -lxboxkrnl -lhal -lopenxdk -lc -lstdc++ -lgcc
|
||||
|
||||
OBJS = Array.o BinaryReader.o BitConverter.o Buffer.o Calendar.o Comparer.o DateTime.o Decoder.o Dictionary.o Directory.o Encoder.o Environment.o Exception.o File.o FileStream.o HashHelpers.o KeyNotFoundException.o KeyValuePair.o Math.o MemoryStream.o Path.o Stack.o Stream.o StreamAsyncResult.o StreamReader.o StreamWriter.o Thread.o TimeSpan.o Version.o
|
||||
OBJS = Array.o BinaryReader.o BinaryWriter.o BitConverter.o Buffer.o Calendar.o Comparer.o DateTime.o Decoder.o Dictionary.o Directory.o Encoder.o Environment.o Exception.o File.o FileStream.o HashHelpers.o KeyNotFoundException.o KeyValuePair.o Math.o MemoryStream.o Path.o Stack.o Stream.o StreamAsyncResult.o StreamReader.o StreamWriter.o Thread.o TimeSpan.o Version.o
|
||||
|
||||
all: libmscorlib.a
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user