コード例 #1
0
ファイル: Collective.cs プロジェクト: whampson/gta-save-data
 protected override void ReadData(DataBuffer buf, FileFormat fmt)
 {
     Index    = buf.ReadInt32();
     Field04h = buf.ReadInt32();
 }
コード例 #2
0
 /// <summary>
 /// Writes this object's data out to the stream buffer using the
 /// specified file format to define the manner in which data is written.
 /// </summary>
 /// <param name="buf">The buffer to write to.</param>
 /// <param name="fmt">The data format.</param>
 protected abstract void WriteData(DataBuffer buf, FileFormat fmt);
コード例 #3
0
 /// <summary>
 /// Gets the size of this object's serialized data.
 /// </summary>
 /// <param name="fmt">The data format.</param>
 /// <returns>The size of the object in bytes.</returns>
 protected abstract int GetSize(FileFormat fmt);
コード例 #4
0
 /// <summary>
 /// Event handler executed after <see cref="WriteData(DataBuffer, FileFormat)"/> is called.
 /// </summary>
 protected virtual void OnWrite(FileFormat fmt)
 {
 }
コード例 #5
0
 /// <summary>
 /// Reads this object's data in from the stream buffer using the
 /// specified file format to define the manner in which data is read.
 /// </summary>
 /// <param name="buf">The buffer to read from.</param>
 /// <param name="fmt">The data format.</param>
 protected abstract void ReadData(DataBuffer buf, FileFormat fmt);
コード例 #6
0
ファイル: SaveFile.cs プロジェクト: whampson/gta-save-data
 protected override void ReadData(DataBuffer buf, FileFormat fmt)
 {
     FileFormat = fmt;
     LoadAllData(buf);
 }
コード例 #7
0
 /// <summary>
 /// Event handler executed after <see cref="ReadData(DataBuffer, FileFormat)"/> is called.
 /// </summary>
 protected virtual void OnRead(FileFormat fmt)
 {
 }
コード例 #8
0
 /// <summary>
 /// Gets the size of a type when serialized using the
 /// specified file format.
 /// </summary>
 /// <typeparam name="T">The type to get the size of.</typeparam>
 /// <param name="fmt">The file format to use.</param>
 /// <returns>The size in bytes of the type.</returns>
 protected static int SizeOfType <T>(FileFormat fmt) where T : new()
 {
     return(Serializer.SizeOfType <T>(fmt));
 }
コード例 #9
0
 /// <summary>
 /// Gets the size of an object when serialized using the
 /// specified file format.
 /// </summary>
 /// <typeparam name="T">The type to get the size of.</typeparam>
 /// <param name="obj">The object to get the size of.</param>
 /// <param name="fmt">The file format to use.</param>
 /// <returns>The size in bytes of the object.</returns>
 protected static int SizeOfObject <T>(T obj, FileFormat fmt)
 {
     return(Serializer.SizeOfObject(obj, fmt));
 }
コード例 #10
0
 protected override void WriteData(DataBuffer buf, FileFormat fmt)
 {
     buf.Write((int)Type);
     buf.Write(Handle);
 }
コード例 #11
0
 int ISaveDataObject.GetSize(FileFormat fmt)
 {
     return(GetSize(fmt));
 }
コード例 #12
0
 protected override void ReadData(DataBuffer buf, FileFormat fmt)
 {
     Type   = (PoolType)buf.ReadInt32();
     Handle = buf.ReadInt32();
 }
コード例 #13
0
ファイル: SaveFile.cs プロジェクト: whampson/gta-save-data
 /// <summary>
 /// Attempts to determine the file format of the specified save data.
 /// </summary>
 /// <typeparam name="T">The <see cref="SaveFile"/> type.</typeparam>
 /// <param name="data">The data to parse.</param>
 /// <param name="fmt">The detected file format.</param>
 /// <returns>A value indicating whether file format detection was successful.</returns>
 public static bool GetFileFormat <T>(byte[] data, out FileFormat fmt) where T : SaveFile, new()
 {
     return(new T().DetectFileFormat(data, out fmt));
 }
コード例 #14
0
ファイル: SaveFile.cs プロジェクト: whampson/gta-save-data
 protected override void WriteData(DataBuffer buf, FileFormat fmt)
 {
     FileFormat = fmt;
     SaveAllData(buf);
 }
コード例 #15
0
ファイル: Collective.cs プロジェクト: whampson/gta-save-data
 protected override void WriteData(DataBuffer buf, FileFormat fmt)
 {
     buf.Write(Index);
     buf.Write(Field04h);
 }
コード例 #16
0
 /// <summary>
 /// Returns an exception for scenarios when there is no
 /// defined size for the specified file format.
 /// </summary>
 /// <param name="fmt">The file format to use.</param>
 /// <returns>An <see cref="InvalidOperationException"/>.</returns>
 protected InvalidOperationException SizeNotDefined(FileFormat fmt)
 {
     return(new InvalidOperationException(string.Format(Strings.Error_InvalidOperation_SizeNotDefined, fmt.Name)));
 }
コード例 #17
0
 protected override int GetSize(FileFormat fmt)
 {
     return(16);
 }
コード例 #18
0
ファイル: SaveFile.cs プロジェクト: whampson/gta-save-data
 /// <summary>
 /// Parses the data and determines the file format.
 /// </summary>
 /// <param name="data">The data to parse.</param>
 /// <param name="fmt">The detected file format.</param>
 /// <returns>A value indicating whether the format detection was successful.</returns>
 protected abstract bool DetectFileFormat(byte[] data, out FileFormat fmt);