Skip to content

Hack.io.BCSV

Super Hackio edited this page Jun 27, 2021 · 3 revisions

Hack.io.BCSV is the Library that handles Binary Comma Separated Value files
.bcsv, .bcam, .pa, .banmt, and some .tbl formats are supported by this library.


BCSV

The BCSV Class manages the main object that is your BCSV File

  • Properties
    • string FileName: The full path of this BCSV
    • Dictionary<uint, BCSVField> Fields: The collection of Fields contained inside this BCSV
    • int FieldCount: Get the number of Fields in this BCSV. Returns -1 if Fields is Null. Read-Only
    • List<BCSVEntry> Entries: The collection of Entries contained inside this BCSV
    • int EntryCount: Get the number of Entries in this BCSV. Returns -1 if Entries is Null. Read-Only
  • Special
    • BCSV[int Index]: Get or Set the Entry located at Entries[Index]
    • BCSV[uint Hash]: Get or Set the Field keyed at Fields[Hash]
    • (RARCFile)BCSV: Cast a BCSV to a RARCFile from Hack.io.RARC
    • (BCSV)RARCFile: Cast a RARCFile from Hack.io.RARC to a BCSV
  • Constructors
    • BCSV(): Create a new BCSV
    • BCSV(string Filename): Load a BCSV From a file
    • BCSV(Stream BCSV): Read a BCSV from a stream
    • To convert a RARCFile to a BCSV, see the above casts
  • Methods
    • void Save(string Filename):Save the BCSV to the given file. If you leave Filename as null, it will use the already existing filename. Will throw an error if the Filename was null, and you didn't provide one in the method call.
    • void Save(Stream BCSV): Save the BCSV to the provided stream. FileName is not used.
    • MemoryStream Save(): Save the BCSV to a new MemoryStream. FileName is not used
    • void Add(BCSVEntry entry): Adds the provided BCSVEntry to the Entries
    • void Add(BCSVField field): Adds the provided BCSVField to the Fields
    • void AddRange(List<BCSVEntry> list): Adds all the provided BCSVEntry objects to the Entries
    • void AddRange(BCSVEntry[] array): Adds all the provided BCSVEntry objects to the Entries
    • void AddRange(List<BCSVField> list): Adds all the provided BCSVFields objects to the Fields
    • void AddRange(BCSVField[] array): Adds all the provided BCSVFields objects to the Fields
    • void Insert(int index, BCSVEntry entry): Inserts the provided BCSVEntry to the Entries at position index
    • void InsertRange(int index, List<BCSVEntry> list): Adds all the provided BCSVEntry objects to the Entries at position index
    • void InsertRange(int index, BCSVEntry[] array): Adds all the provided BCSVEntry objects to the Entries at position index
    • void Remove(int index): Removes the BCSVEntry at the provided index
    • void Remove(BCSVEntry entry): Removes the provided BCSVEntry from the Entries
    • void Remove(uint hashkey): Removes the BCSVField with the provided hash from Fields
    • void Remove(string Fieldname): Removes the BCSVField that has the provided Name
    • void RemoveRange(int First, int Count): Removes all BCSVEntrys between First and First+Count
    • void RemoveAll(Predicate<BCSVEntry> match): Removes all BCSVEntrys that match the provided condition
      • Example: BCSV.RemoveAll(Entry => Entry.ContainsKey(0x00000000));
        This will remove all entries if they have data for a field with hash 0x00000000
    • void Clear(bool ClearEntries = true, bool ClearFields = false)
    • void Sort<TSource, TKey>(Func<BCSVEntry, TKey> KeySelector): I'll be Honest, not even I (the creator of the library) know how to use this one 😂
    • bool ContainsField(uint hash): Returns true if Fields contains a field with the provided hash
    • bool ContainsField(string Fieldname): Returns true if Fields contains a field with the provided name
  • Static Methods
    • uint FieldNameToHash(string field): Converts a string to a hash. Case-sensitive.

BCSVEntry

The BCSVEntry class contains information about a given BCSV Entry

  • Properties
    • Dictionary<uint, object> Data: This is a dictionary of entries where the "Key" is the FieldHash that the "Value" belongs in.
  • Special
    • BCSVEntry[uint hash]: Get or Set the Data belonging to the FieldHash hash.
    • BCSVEntry == BCSVEntry: Compare two BCSVEntries to see if the data inside them is equal
      • Example: if (EntryA == EntryB) {}
    • BCSVEntry != BCSVEntry: Compare two BCSVEntries to see if the data inside them is not equal
      • Example: if (EntryA != EntryB) {}
  • Constructors
    • BCSVEntry(): Create a new BCSV Entry that has no data whatsoever
    • BCSVEntry(Dictionary<uint, BCSVField> FieldSource): Create a new BCSV Entry that has blank data entries for the provided fields.
      • Example: BCSVEntry entry = new BCSVEntry(InputBCSV.Fields);
        This will make a new entry with empty entries for all the fields in the Input BCSV
  • Methods
    • bool ContainsKey(uint hash): Checks if this BCSV Entry Contains data for a given hash
    • bool ContainsKey(BCSVField Field): Checks if this BCSV Entry Contains data for a given BCSVField
    • bool TryGetValue(uint hash, out object value): Tries to get a value inside this entry. Returns false if this entry has no data for the specified hash value
    • string ToClipboard(): Creates a string representation of this entry which you can then use with `bool FromClipboard(string input). It can be sent to the system's Clipboard
    • bool FromClipboard(string input): Sets the data values based on a string (which would ideally come from the system's Clipboard). Returns false if the string is not a valid BCSV string.
      • Tip: To do "New From Clipboard" functionality, create a new BCSVEntry, then call FromClipboard on it.
    • bool Equals(object obj): Compares a BCSV to another object. Returns false if the obj is not also a BCSVEntry

BCSVField

Todo

Clone this wiki locally