protected override void ReadData(DataBuffer buf, FileFormat fmt) { Index = buf.ReadInt32(); Field04h = buf.ReadInt32(); }
/// <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);
/// <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);
/// <summary> /// Event handler executed after <see cref="WriteData(DataBuffer, FileFormat)"/> is called. /// </summary> protected virtual void OnWrite(FileFormat fmt) { }
/// <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);
protected override void ReadData(DataBuffer buf, FileFormat fmt) { FileFormat = fmt; LoadAllData(buf); }
/// <summary> /// Event handler executed after <see cref="ReadData(DataBuffer, FileFormat)"/> is called. /// </summary> protected virtual void OnRead(FileFormat fmt) { }
/// <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)); }
/// <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)); }
protected override void WriteData(DataBuffer buf, FileFormat fmt) { buf.Write((int)Type); buf.Write(Handle); }
int ISaveDataObject.GetSize(FileFormat fmt) { return(GetSize(fmt)); }
protected override void ReadData(DataBuffer buf, FileFormat fmt) { Type = (PoolType)buf.ReadInt32(); Handle = buf.ReadInt32(); }
/// <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)); }
protected override void WriteData(DataBuffer buf, FileFormat fmt) { FileFormat = fmt; SaveAllData(buf); }
protected override void WriteData(DataBuffer buf, FileFormat fmt) { buf.Write(Index); buf.Write(Field04h); }
/// <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))); }
protected override int GetSize(FileFormat fmt) { return(16); }
/// <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);