sbsmac
Feb 12 2011, 20:15
Mac.Arma is a collection of utility classes I've written over the years distributed in the form of a .net assembly. This may be useful to any C# programmers out there. This is very much WIP and I'll be adding more classes and as I clean them up and create documentation.
Currently included
* Mac.Arma.Files - classes that allow you to manipulate pbo files
Coming soon(ish)
* Rap/Unrap and classes to represent a config file as a tree of elements
* Tokeniser, preprocessor and parser for sqf/sqm files
* Instance class to allow querying of installed versions of arma
There is doxygen documentation (sample (http://www.armaleague.com/mac/Mac_arma/html/class_mac_1_1_arma_1_1_files_1_1_pbo_file.html))
Here's a small snippet (looks much prettier in the link above)...
Detailed Description
A PboFile object represents a BIS .pbo file as a collection of PboEntry objects.
The PboFile class is the starting point when working with .pbo files. A .pbo file is really just an archive of files, rather like a .zip file, and the PboFile object represents a logical view of the .pbo as a collection of PboEntry objects in a virtual directory structure. Each PboEntry represents one of the files within the .pbo.
A PboFile can be constructed from an existing .pbo file, a stream, or a mission-folder that contains files.
Once you have created a PboFile, you can extract its contents, save it to disk as a .pbo or manipulate the list of files it contains.
You can iterate over a PboFile or access the PboEntries it contains by indexing into it and a Match method can be used to select sets of files within it.
These capabilities make it easy to perform common operations on .pbo files in just a few lines of code.
//Extract the contents of a pbo to a folder called "missions\mymission.utes"...
PboFile pbo = PboFile.Read(@<hidden>"pbos\mymission.utes.pbo");
pbo.ExtractTo("missions");
//Create a .pbo file from a mission and save it to "pbos\mymission.utes.pbo";
PboFile pbo = PboFile.FromFolder(@<hidden>"missions\mymission.utes");
pbo.Write("pbos");
//List all the files in a pbo
foreach (PboEntry f in pbo)
System.Console.WriteLine(pbo.Path);
//Read the size of the mission.sqm file
System.Console.WriteLine(pbo["mission.sqm"].DataSize);
//Remove all the backup files from an existing pbo
PboFile pbo = PboFile.FromPbo("mymission.utes.pbo");
pbo.RemoveRange(pbo.Match("*.bak"));
pbo.Writeback();
You can read more and download mac.arma from my homepage (https://sites.google.com/site/macsarmatools/mac-arma).
Currently included
* Mac.Arma.Files - classes that allow you to manipulate pbo files
Coming soon(ish)
* Rap/Unrap and classes to represent a config file as a tree of elements
* Tokeniser, preprocessor and parser for sqf/sqm files
* Instance class to allow querying of installed versions of arma
There is doxygen documentation (sample (http://www.armaleague.com/mac/Mac_arma/html/class_mac_1_1_arma_1_1_files_1_1_pbo_file.html))
Here's a small snippet (looks much prettier in the link above)...
Detailed Description
A PboFile object represents a BIS .pbo file as a collection of PboEntry objects.
The PboFile class is the starting point when working with .pbo files. A .pbo file is really just an archive of files, rather like a .zip file, and the PboFile object represents a logical view of the .pbo as a collection of PboEntry objects in a virtual directory structure. Each PboEntry represents one of the files within the .pbo.
A PboFile can be constructed from an existing .pbo file, a stream, or a mission-folder that contains files.
Once you have created a PboFile, you can extract its contents, save it to disk as a .pbo or manipulate the list of files it contains.
You can iterate over a PboFile or access the PboEntries it contains by indexing into it and a Match method can be used to select sets of files within it.
These capabilities make it easy to perform common operations on .pbo files in just a few lines of code.
//Extract the contents of a pbo to a folder called "missions\mymission.utes"...
PboFile pbo = PboFile.Read(@<hidden>"pbos\mymission.utes.pbo");
pbo.ExtractTo("missions");
//Create a .pbo file from a mission and save it to "pbos\mymission.utes.pbo";
PboFile pbo = PboFile.FromFolder(@<hidden>"missions\mymission.utes");
pbo.Write("pbos");
//List all the files in a pbo
foreach (PboEntry f in pbo)
System.Console.WriteLine(pbo.Path);
//Read the size of the mission.sqm file
System.Console.WriteLine(pbo["mission.sqm"].DataSize);
//Remove all the backup files from an existing pbo
PboFile pbo = PboFile.FromPbo("mymission.utes.pbo");
pbo.RemoveRange(pbo.Match("*.bak"));
pbo.Writeback();
You can read more and download mac.arma from my homepage (https://sites.google.com/site/macsarmatools/mac-arma).