Search Results for

    Show / Hide Table of Contents

    Class FPG

    A representation of a DIV Games Studio FPG file.

    Inheritance
    Object
    FPG
    Implements
    IEnumerable<MAP>
    Namespace: DIV2.Format.Exporter
    Assembly: DIV2.Format.Exporter.dll
    Syntax
    public sealed class FPG : object, IAssetFile, IFormatValidable, ISerializableAsset, IEnumerable<MAP>
    Remarks

    Implements functions to import, export and create File Package Graphic files.

    Constructors

    FPG(PAL)

    Creates a new FPG instance.

    Declaration
    public FPG(PAL palette)
    Parameters
    Type Name Description
    PAL palette

    The PAL instance used in this FPG instance.

    FPG(Byte[])

    Loads a FPG file.

    Declaration
    public FPG(byte[] buffer)
    Parameters
    Type Name Description
    Byte[] buffer

    array that contain the FPG file data to load.

    FPG(String)

    Loads a FPG file.

    Declaration
    public FPG(string filename)
    Parameters
    Type Name Description
    String filename

    Filename to load.

    Properties

    Count

    Number of MAP objects stored in this FPG.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    Int32

    Gets the number of MAP instances contained in the FPG.

    Item[Int32]

    Gets a MAP instance.

    Declaration
    public MAP this[int index] { get; }
    Parameters
    Type Name Description
    Int32 index

    Index of the MAP in the FPG.

    Property Value
    Type Description
    MAP

    Returns the MAP instance.

    Palette

    Color palette used by this FPG.

    Declaration
    public PAL Palette { get; }
    Property Value
    Type Description
    PAL

    Returns the PAL instance for this FPG object.

    Remarks

    All MAPs stored in the FPG shared this palette.

    Methods

    Add(MAP, String)

    Adds a MAP file.

    Declaration
    public void Add(MAP map, string filename = "")
    Parameters
    Type Name Description
    MAP map

    MAP instance to add.

    String filename

    Optional filename value in DOS 8:3 format.

    Remarks

    This method always performs a color conversion if the palette is different from the FPG instance to ensure the MAP image shows properly with the current palette.

    The filename field in the file only allows a 12 length ASCII null terminated string. If the input string is shorter than 12 characters, the string is filled with null chars. If the input string is longer than 12 characters, getting a 12 characters length substring.

    Add(Byte[], String)

    Adds a MAP file.

    Declaration
    public void Add(byte[] buffer, string filename = "")
    Parameters
    Type Name Description
    Byte[] buffer

    array that contain the MAP file data to load.

    String filename

    Optional filename value in DOS 8:3 format.

    Remarks

    This method always performs a color conversion if the palette is different from the FPG instance to ensure the MAP image shows properly with the current palette.

    The filename field in the file only allows a 12 length ASCII null terminated string. If the input string is shorter than 12 characters, the string is filled with null chars. If the input string is longer than 12 characters, getting a 12 characters length substring.

    Add(String)

    Adds a MAP file.

    Declaration
    public void Add(string filename)
    Parameters
    Type Name Description
    String filename

    MAP file to load.

    Remarks

    This method always performs a color conversion if the palette is different from the FPG instance to ensure the MAP image shows properly with the current palette.

    Clear()

    Removes all MAP in this instance.

    Declaration
    public void Clear()

    Contains(MAP)

    Determines whether a MAP is in this instance.

    Declaration
    public bool Contains(MAP map)
    Parameters
    Type Name Description
    MAP map

    The MAP to locate in this instance.

    Returns
    Type Description
    Boolean

    Returns true if the MAP exists.

    Contains(Int32)

    Determines whether a MAP with a graphic identifier is in this instance.

    Declaration
    public bool Contains(int graphId)
    Parameters
    Type Name Description
    Int32 graphId

    MAP graphic identifier to search.

    Returns
    Type Description
    Boolean

    Returns true if a MAP graphic identifier exists.

    GetFilename(MAP)

    Gets the associated filename value for this MAP in the FPG.

    Declaration
    public string GetFilename(MAP map)
    Parameters
    Type Name Description
    MAP map

    MAP instance to find.

    Returns
    Type Description
    String

    Returns the MAP filename value.

    GetFilename(Int32)

    Gets the associated filename value for this MAP in the FPG.

    Declaration
    public string GetFilename(int index)
    Parameters
    Type Name Description
    Int32 index

    The index of the MAP instance to find. Not confuse with the GraphId value.

    Returns
    Type Description
    String

    Returns the MAP filename value.

    GetHashCode()

    Generates a hash code for this instance.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32

    Returns an SHA256 hash code from the MD5 hash created by the binary serialized data of this instance.

    Remove(MAP)

    Removes a MAP from this instance.

    Declaration
    public void Remove(MAP map)
    Parameters
    Type Name Description
    MAP map

    MAP instance to remove.

    Remove(Int32)

    Removes a MAP from this instance.

    Declaration
    public void Remove(int graphId)
    Parameters
    Type Name Description
    Int32 graphId

    GraphId to search.

    RemoveAt(Int32)

    Removes a MAP from this instance.

    Declaration
    public void RemoveAt(int index)
    Parameters
    Type Name Description
    Int32 index

    MAP index in this instance.

    Save(String)

    Saves the instance in a FPG file.

    Declaration
    public void Save(string filename)
    Parameters
    Type Name Description
    String filename

    Filename to write the data.

    ToString()

    Serializes the relevant data of this instance in a value.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    Returns a value with the relevant serialized data in JSON format.

    Validate(Byte[])

    Validates if the file is a valid FPG file.

    Declaration
    public bool Validate(byte[] buffer)
    Parameters
    Type Name Description
    Byte[] buffer

    Memory buffer that contain a FPG file data.

    Returns
    Type Description
    Boolean

    Returns true if the file is a valid FPG.

    Validate(String)

    Validates if the file is a valid FPG file.

    Declaration
    public bool Validate(string filename)
    Parameters
    Type Name Description
    String filename

    File to validate.

    Returns
    Type Description
    Boolean

    Returns true if the file is a valid FPG.

    ValidateFormat(Byte[])

    Validates if the file is a valid FPG file.

    Declaration
    public static bool ValidateFormat(byte[] buffer)
    Parameters
    Type Name Description
    Byte[] buffer

    Memory buffer that contain a FPG file data.

    Returns
    Type Description
    Boolean

    Returns true if the file is a valid FPG.

    ValidateFormat(String)

    Validates if the file is a valid FPG file.

    Declaration
    public static bool ValidateFormat(string filename)
    Parameters
    Type Name Description
    String filename

    File to validate.

    Returns
    Type Description
    Boolean

    Returns true if the file is a valid FPG.

    Operators

    Equality(FPG, FPG)

    Equality operator.

    Declaration
    public static bool operator ==(FPG a, FPG b)
    Parameters
    Type Name Description
    FPG a

    Left FPG value to compare.

    FPG b

    Right FPG value to compare.

    Returns
    Type Description
    Boolean

    Returns true if both values are equal.

    Inequality(FPG, FPG)

    Inequality operator.

    Declaration
    public static bool operator !=(FPG a, FPG b)
    Parameters
    Type Name Description
    FPG a

    Left FPG value to compare.

    FPG b

    Right FPG value to compare.

    Returns
    Type Description
    Boolean

    Returns true if both values are not equal.

    Implements

    IEnumerable<>
    In This Article
    Back to top
    DIV2.Format.Exporter © Visual Studio EX3, José Miguel Sánchez Fernández - 2020 - 2022 | Site generated with DocFX