ScriptExternalFileObject

 

class

ScriptExternalFileObject.

ScriptExternalFileObjectMarker

Bases: object

Determines whether this object is an external file object or can contain them.

Version added

3.5.9.0

is_external_file_object

Gets a value indicating whether this ScriptObject is is an external file object.

Return type

bool

Returns

True if it is an external file object; otherwise, False.

may_contain_external_file_objects

Gets a value indicating whether this ScriptObject or ScriptProject may contain external file objects.

The project root may always contain external file objects, those are not downloaded to the devices. Devices and Applications may contain files which are synchronized to the runtime, depending on the device descrip­tion and settings.

Return type

bool

Returns

True if it may contain external file objects; otherwise, False

class

ScriptExternalFileObject.

ScriptExternalFileObject

Bases: ScriptExternalFileObject.ScriptExternalFileObjectMarker

Provides the actual functionality of the external file objects.

Version added

3.5.9.0

file_path

Gets the file path.

Return type

str

reference_mode

Gets the reference mode.

Return type

ExternalFileObject.ReferenceMode

auto_update_mode

Gets the auto update mode.

Return type

ExternalFileObject.AutoUpdateMode

change_modes

reference_mode

auto_update_mode=None

Changes the modes of the external file object.

Parameters

  • reference_mode (ReferenceMode) -- The reference mode.

  • auto_update_mode (AutoUpdateMode) -- The auto update mode. This is optional, and only makes sense if reference_mode is set to ReferenceMode.LinkAndEmbed. Defaults to AutoUpdate­Mode.Never if omitted.

update

Updates this instance.

calculate_checksum

Calculates the checksum of the data.

Returns

The CRC 32 value of the data.

last_modification

Gets the last modification date.

Return type

DateTime

length

Gets the length of the data in bytes.

Return type

long

get_data

stream

filename

Gets the data as a byte array.

Warning

The original C# function that is called with this method contains 3 overloads. It is strongly advised to pass all arguments with their respective keywords.

get_data(self) (1/3)

Return type

list <byte>

get_data(self, stream) (2/3)

Gets the data by writing it into the given stream.

get_data(self, filename) (3/3)

Gets the data by writing it to the specified filename.

create_edit_path

Gets the absolute path where this file reference is edited.

This is the absolute path itself if the file reference is linked to a file system object, or a temporary path if it is embedded into a project.

Returns

The edit path of this file reference.

class

ScriptExternalFileObject.

ScriptExternalFileObjectContainer

Bases: ScriptExternalFileObject.ScriptExternalFileObjectMarker

This interface is implemented by the project root, and by objects which can contain synchable external file objects.

The project root may always contain external file objects, those are not downloaded to the devices. Devices and Applications may contain files which are synchronized to the runtime, depending on the device descrip­tion and settings.

Version added

3.5.9.0

create_external_file_object

file_path

name=None

reference_mode='ReferenceMode.Embed'

auto_update_mode='AutoUpdateMode.Never'

Creates an external file objects with the specified name.

Parameters

  • file_path (str) -- The file path with the contents of the external file object.

  • name (str) -- The name. This is optional, if it is omitted, the filename will be extracted from the path.

  • reference_mode (ReferenceMode) -- The reference mode.

  • auto_update_mode (AutoUpdateMode) -- The automatic update mode.

Returns

The newly created external file object.