SetOverrideFileIO

This function overrides the type of file saved / exported independent of the extension given. By default the extension of the filename will define the type saved / exported:
    .rdf => generated RDF serialized content
    .ttl => generated TTL serialized content
    .bin => generated BIN/X serialized content

Available formats
    RDF
    TTL
    BIN/L - readible but large BIN format
    BIN/S - Optimized Binary, only running within given revision
    BIN/X - Optimized Binary, running in all revisions supporting BIN/X

Force file type (overrides extension), works only on save (open selects correct type automatically)
  bit0 bit1 bit2
    0     0     0    [default] unset forced file type
    0     0     1    RESERVED
    0     1     0    TTL
    0     1     1    RDF
    1     0     0    BIN/X
    1     0     1    BIN/S
    1     1     0    RESERVED
    1     1     1    BIN/L

Force exporting as Base64
  bit4
    0    do not use Base64
    1    use Base64 (only works for BIN/S and BIN/X), on other formats no effect

Syntax

public const string EngineDLL = @"engine.dll";[DllImport(EngineDLL, EntryPoint = "SetOverrideFileIO")]
public static extern void SetOverrideFileIO(Int64 model, Int64 setting, Int64 mask);    

Property model

Size: 64 bit / 8 byte (value)
The handle to the model. The model handle is static during its existance. Several models can be opened simultaniously within one session. Different models are always independent, threads are allowed to be running on different models simultaniously.

Property setting

Size: 64 bit / 8 byte (value)
The setting is the data that is defined for bitwise operations, only bits set in the mask will be relevant.

Property mask

Size: 64 bit / 8 byte (value)
This mask or bitmask is data that is used for bitwise operations, i.e. the bits set in the mask are the bits affected in the setting or return value.

Example

Here you can find code snippits that show how the API call SetOverrideFileIO can be used.

using Engine;

...

const Int64 flagbit0 = 1;   // 2^^0
const Int64 flagbit1 = 2;   // 2^^1
const Int64 flagbit2 = 4;   // 2^^2

enum serializations
{
    undefined = 0,
    RDF,
    TTL,
    BIN_X,
    BIN_L,
    BIN_S
};

static void SetSerialization(Int64 model, serializations serialization, bool unset)
{
    Int64 mask = flagbit0 + flagbit1 + flagbit2;

    if (unset)
    {
        Engine.x86_64.SetOverrideFileIO(model, 0, mask);
    }
    else
    {
        Int64 setting = 0;

        switch (serialization)
        {
            case serializations.TTL:
                setting = flagbit1;
                break;
            case serializations.RDF:
                setting = flagbit1 + flagbit2;
                break;
            case serializations.BIN_X:
                setting = flagbit0;
                break;
            case serializations.BIN_S:
                setting = flagbit0 + flagbit2;
                break;
            case serializations.BIN_L:
                setting = flagbit0 + flagbit1 + flagbit2;
                break;
        }

        Engine.x86_64.SetOverrideFileIO(model, setting, mask);
    }
}

static serializations GetSerialization(Int64 model, ref bool unset)
{
    Int64 mask = flagbit0 + flagbit1 + flagbit2,
            setting = Engine.x86_64.GetOverrideFileIO(model, mask);

    if (setting == 0)
    {
        unset = true;
    }
    else if (setting == flagbit1)
    {
        return serializations.TTL;
    }
    else if (setting == flagbit1 + flagbit2)
    {
        return serializations.RDF;
    }
    else if (setting == flagbit0)
    {
        return serializations.BIN_X;
    }
    else if (setting == flagbit0 + flagbit2)
    {
        return serializations.BIN_S;
    }
    else if (setting == flagbit0 + flagbit1 + flagbit2)
    {
        return serializations.BIN_L;
    }
    else
    {
        System.Diagnostics.Debug.Assert(false);
    }

    return serializations.undefined;
}

static void Main(string[] args)
{
    Int64 model = Engine.x86_64.OpenModel("c:\\created\\myBox.bin");

    if (model != 0)
    {
        //  Save in RDF serialization
        Engine.x86_64.SaveModel(model, "c:\\created\\myFile001.rdf");

        //  Save in BIN_X serialization
        Engine.x86_64.SaveModel(model, "c:\\created\\myFile002.bin");

        SetSerialization(model, serializations.BIN_L, false);

        //  Save in BIN_L serialization
        Engine.x86_64.SaveModel(model, "c:\\created\\myFile003.xyz");

        bool unset = false;
        System.Diagnostics.Debug.Assert(GetSerialization(model, ref unset) == serializations.BIN_L && unset == false);

        Engine.x86_64.CloseModel(model);
    }
}