-
Notifications
You must be signed in to change notification settings - Fork 3
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.
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-1ifFieldsisNull. Read-Only -
List<BCSVEntry> Entries: The collection of Entries contained inside this BCSV -
int EntryCount: Get the number of Entries in this BCSV. Returns-1ifEntriesisNull. Read-Only
-
-
Special
-
BCSV[int Index]: Get or Set the Entry located atEntries[Index] -
BCSV[uint Hash]: Get or Set the Field keyed atFields[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 theEntries -
void Add(BCSVField field): Adds the provided BCSVField to theFields -
void AddRange(List<BCSVEntry> list): Adds all the provided BCSVEntry objects to theEntries -
void AddRange(BCSVEntry[] array): Adds all the provided BCSVEntry objects to theEntries -
void AddRange(List<BCSVField> list): Adds all the provided BCSVFields objects to theFields -
void AddRange(BCSVField[] array): Adds all the provided BCSVFields objects to theFields -
void Insert(int index, BCSVEntry entry): Inserts the provided BCSVEntry to theEntriesat positionindex -
void InsertRange(int index, List<BCSVEntry> list): Adds all the provided BCSVEntry objects to theEntriesat positionindex -
void InsertRange(int index, BCSVEntry[] array): Adds all the provided BCSVEntry objects to theEntriesat positionindex -
void Remove(int index): Removes the BCSVEntry at the provided index -
void Remove(BCSVEntry entry): Removes the provided BCSVEntry from theEntries -
void Remove(uint hashkey): Removes the BCSVField with the provided hash fromFields -
void Remove(string Fieldname): Removes the BCSVField that has the provided Name -
void RemoveRange(int First, int Count): Removes all BCSVEntrys betweenFirstandFirst+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
- Example:
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): ReturnstrueifFieldscontains a field with the provided hash -
bool ContainsField(string Fieldname): ReturnstrueifFieldscontains a field with the provided name
-
-
Static Methods
-
uint FieldNameToHash(string field): Converts a string to a hash. Case-sensitive.
-
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 FieldHashhash. -
BCSVEntry == BCSVEntry: Compare two BCSVEntries to see if the data inside them is equal- Example:
if (EntryA == EntryB) {}
- Example:
-
BCSVEntry != BCSVEntry: Compare two BCSVEntries to see if the data inside them is not equal- Example:
if (EntryA != EntryB) {}
- Example:
-
-
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
- Example:
-
-
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. Returnsfalseif 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). Returnsfalseif the string is not a valid BCSV string.- Tip: To do "New From Clipboard" functionality, create a new BCSVEntry, then call
FromClipboardon it.
- Tip: To do "New From Clipboard" functionality, create a new BCSVEntry, then call
-
bool Equals(object obj): Compares a BCSV to another object. Returnsfalseif theobjis not also a BCSVEntry
-
Todo