https://www.ximea.com/support/projects/apis/wiki/how_to_work_with_ffs_using_xiapinet
How to work with FFS using xiAPI.NET¶
Initialization:
int num_free = 0;
int num_used = 0;
Get camera's FFS info:
num_free = myCam.GetParamInt(PRM.FREE_FFS_SIZE);
num_used = myCam.GetParamInt(PRM.USED_FFS_SIZE);
Console.WriteLine("FFS stats:");
Console.WriteLine("Free bytes : {0}", num_free);
Console.WriteLine("Used bytes : {0}", num_used);
Read available file names stored in camera FFS into array:
List<string> ffs_files = new List<string>();
int max_file_id = myCam.GetParamInt(PRM.FFS_FILE_ID_MAX);
for (int file_id = 0; file_id < max_file_id + 1; file_id++)
{
myCam.SetParam(PRM.FFS_FILE_ID, file_id);
string file_name = myCam.GetParamString(PRM.FFS_FILE_NAME);
ffs_files.Add(file_name);
Console.WriteLine("Found file {0} in camera FFS", file_name);
}
Read all files from camera FFS:
string ffs_files_dir = "FFS_FILES";
Directory.CreateDirectory(ffs_files_dir);
Directory.SetCurrentDirectory(Directory.GetCurrentDirectory() + "\\" + ffs_files_dir);
foreach (string file_name in ffs_files)
{
int file_size = 0;
myCam.SetParam(PRM.FFS_FILE_NAME, file_name);
file_size = myCam.GetParamInt(PRM.FFS_FILE_SIZE);
byte[] file_data = new byte[file_size];
Console.WriteLine("Reading file {0} of size {1}", file_name, file_size);
myCam.GetParam(PRM.READ_FILE_FFS, out file_data, out file_size);
Console.WriteLine("Saving file {0} to {1}.", file_name, Directory.GetCurrentDirectory());
File.WriteAllBytes(file_name, file_data);
}
The complete source code can be downloaded from here