Difference between revisions of "Truxton file export create"

From truxwiki.com
Jump to navigation Jump to search
 
(2 intermediate revisions by the same user not shown)
Line 4: Line 4:
 
=Syntax=
 
=Syntax=
 
<source lang="C">
 
<source lang="C">
uint64_t truxton_file_export_create(uint64_t truxton_handle);
+
uint64_t truxton_file_export_create( uint64_t truxton_handle );
 
</source>
 
</source>
  
Line 21: Line 21:
 
#pragma hdrstop
 
#pragma hdrstop
  
int main()
+
void main( void )
 
{
 
{
 
     char temporary_string[256];
 
     char temporary_string[256];
Line 29: Line 29:
 
     uint64_t truxton = truxton_create();
 
     uint64_t truxton = truxton_create();
  
     uint64_t export_handle = truxton_file_export_create(truxton);
+
     uint64_t export_handle = truxton_file_export_create( truxton );
  
 
     // We want a variety of file types
 
     // We want a variety of file types
     sprintf_s(temporary_string, sizeof(temporary_string), "%d, %d, %d", Type_JPEGWithExif, Type_JPEG, Type_GIF);
+
     sprintf_s( temporary_string, sizeof(temporary_string), "%d, %d, %d", Type_JPEGWithExif, Type_JPEG, Type_GIF );
     truxton_file_export_add_criteria(export_handle, TRUXTON_EXPORT_FILE_QUERY_FIELD_TYPE, temp_string);
+
     truxton_file_export_add_criteria( export_handle, TRUXTON_EXPORT_FILE_QUERY_FIELD_TYPE, temp_string );
  
 
     // We only want files where the MD5 hash starts with "e4"
 
     // We only want files where the MD5 hash starts with "e4"
     truxton_file_export_add_criteria(export_handle, TRUXTON_EXPORT_FILE_QUERY_FIELD_HASH, "e4");
+
     truxton_file_export_add_criteria( export_handle, TRUXTON_EXPORT_FILE_QUERY_FIELD_HASH, "e4" );
  
 
     // We want a file that is at least 4MB long
 
     // We want a file that is at least 4MB long
     truxton_file_export_add_criteria(export_handle, TRUXTON_EXPORT_FILE_QUERY_FIELD_SIZE_MINIMUM, "4194304");
+
     truxton_file_export_add_criteria( export_handle, TRUXTON_EXPORT_FILE_QUERY_FIELD_SIZE_MINIMUM, "4194304" );
  
 
     // We want a file that is no larger than 5MB
 
     // We want a file that is no larger than 5MB
     truxton_file_export_add_criteria(export_handle, TRUXTON_EXPORT_FILE_QUERY_FIELD_SIZE_MAXIMUM, "5242880");
+
     truxton_file_export_add_criteria( export_handle, TRUXTON_EXPORT_FILE_QUERY_FIELD_SIZE_MAXIMUM, "5242880" );
  
 
     // Limit the output to a single file
 
     // Limit the output to a single file
     truxton_file_export_add_criteria(export_handle, TRUXTON_EXPORT_FILE_QUERY_FIELD_LIMIT, "1");
+
     truxton_file_export_add_criteria( export_handle, TRUXTON_EXPORT_FILE_QUERY_FIELD_LIMIT, "1" );
  
 
     // Rename the file being exported to include the hash before the original name
 
     // Rename the file being exported to include the hash before the original name
     truxton_file_export_set_option(export_handle, TRUXTON_EXPORT_FILE_OPTION_NAME_FORMAT, "{hash}_{name}");
+
     truxton_file_export_set_option( export_handle, TRUXTON_EXPORT_FILE_OPTION_NAME_FORMAT, "{hash}_{name}" );
  
 
     // The files should be output to a particular folder
 
     // The files should be output to a particular folder
     truxton_file_export_set_option(export_handle, TRUXTON_EXPORT_FILE_OPTION_FOLDER, "C:\\temp");
+
     truxton_file_export_set_option( export_handle, TRUXTON_EXPORT_FILE_OPTION_FOLDER, "C:\\temp");
  
 
     // We want them output to a TAR file in that particular folder
 
     // We want them output to a TAR file in that particular folder
     truxton_file_export_set_option(export_handle, TRUXTON_EXPORT_FILE_OPTION_TAR, "JPGWithExif.tar");
+
     truxton_file_export_set_option( export_handle, TRUXTON_EXPORT_FILE_OPTION_TAR, "JPGWithExif.tar");
  
 
     // Go find the files and output them to C:\temp\JPGWithExif.tar
 
     // Go find the files and output them to C:\temp\JPGWithExif.tar
     truxton_file_export_execute(export_handle);
+
     truxton_file_export_execute( export_handle );
  
 
     // Clean up
 
     // Clean up
     truxton_file_export_destroy(export_handle);
+
     truxton_file_export_destroy( export_handle );
     truxton_destroy(truxton);
+
     truxton_destroy( truxton );
 
     truxton_stop();
 
     truxton_stop();
 
}
 
}
 
</source>
 
</source>

Latest revision as of 10:57, 3 February 2024

This is the first step in exporting files from Truxton. A file export object holds the criteria and options for exporting files.

Syntax

uint64_t truxton_file_export_create( uint64_t truxton_handle );

Parameters

truxton_handle

The Truxton instance this exporter will be working with. This handle comes from calling truxton_create().

Sample

#include "TruxtonCAPI.h"
#pragma comment(lib, "TruxtonCAPI.lib")

#include "filetypes.h"
#include <stdlib.h>
#pragma hdrstop

void main( void )
{
    char temporary_string[256];

    truxton_start();

    uint64_t truxton = truxton_create();

    uint64_t export_handle = truxton_file_export_create( truxton );

    // We want a variety of file types
    sprintf_s( temporary_string, sizeof(temporary_string), "%d, %d, %d", Type_JPEGWithExif, Type_JPEG, Type_GIF );
    truxton_file_export_add_criteria( export_handle, TRUXTON_EXPORT_FILE_QUERY_FIELD_TYPE, temp_string );

    // We only want files where the MD5 hash starts with "e4"
    truxton_file_export_add_criteria( export_handle, TRUXTON_EXPORT_FILE_QUERY_FIELD_HASH, "e4" );

    // We want a file that is at least 4MB long
    truxton_file_export_add_criteria( export_handle, TRUXTON_EXPORT_FILE_QUERY_FIELD_SIZE_MINIMUM, "4194304" );

    // We want a file that is no larger than 5MB
    truxton_file_export_add_criteria( export_handle, TRUXTON_EXPORT_FILE_QUERY_FIELD_SIZE_MAXIMUM, "5242880" );

    // Limit the output to a single file
    truxton_file_export_add_criteria( export_handle, TRUXTON_EXPORT_FILE_QUERY_FIELD_LIMIT, "1" );

    // Rename the file being exported to include the hash before the original name
    truxton_file_export_set_option( export_handle, TRUXTON_EXPORT_FILE_OPTION_NAME_FORMAT, "{hash}_{name}" );

    // The files should be output to a particular folder
    truxton_file_export_set_option( export_handle, TRUXTON_EXPORT_FILE_OPTION_FOLDER, "C:\\temp");

    // We want them output to a TAR file in that particular folder
    truxton_file_export_set_option( export_handle, TRUXTON_EXPORT_FILE_OPTION_TAR, "JPGWithExif.tar");

    // Go find the files and output them to C:\temp\JPGWithExif.tar
    truxton_file_export_execute( export_handle );

    // Clean up
    truxton_file_export_destroy( export_handle );
    truxton_destroy( truxton );
    truxton_stop();
}