PrimoBurner for .NET  5.0
CD, DVD and Blu-ray Software Development Kit
Loading...
Searching...
No Matches
DataDisc Class Reference

Creates and burns data images to CD, DVD and Blu-ray Discs. More...

Inherits IDisposable.

Public Member Functions

 DataDisc ()
 Creates a DataDisc instance.
 
bool CreateImageFile (string imageFilename)
 Creates an ISO image file.
 
void Dispose ()
 Disposes AudioCD and reclaims the resources used by the object.
 
bool LoadFromDisc (Int32 trackNumber)
 Loads a file system from existing track on a CD/DVD/BD.
 
bool LoadFromFile (string imageFilename)
 Loads the directory structure of an image from ISO image file.
 
bool Merge (DataDisc right)
 Merges the file trees of two DataDisc objects.
 
bool Merge (DataDisc right, MergeDirection mergeDirection)
 Merges the file trees of two DataDisc objects.
 
bool SetImageLayout (DataFile rootFolder)
 Sets the file tree of a data image.
 
bool SetImageLayout (DataFile rootFolder, bool sortByFilename)
 Sets the file tree of a data image.
 
bool SetImageLayoutFromFolder (string folder)
 Sets the file system of a data image from a folder.
 
bool SetImageLayoutFromFolder (string folder, bool sortByFilename)
 Sets the file system of a data image from a folder.
 
bool WriteImageToDisc (string imageFile)
 Writes an image file to a disc.
 
bool WriteImageToDisc (string imageFile, bool dismountVolume)
 Writes an image file to a disc.
 
bool WriteImageToDisc (System.IO.Stream image)
 Writes an image stream to a disc.
 
bool WriteImageToDisc (System.IO.Stream image, bool dismountVolume)
 Writes an image stream to a disc.
 
bool WriteToDisc ()
 Writes a data track to a disc.
 
bool WriteToDisc (bool dismountVolume)
 Writes a data track to a disc.
 

Properties

bool Bootable [get, set]
 Indicates whether a bootable image should be created.
 
BootProps BootProps [get]
 Returns an object that provides access to the boot properties.
 
CachePolicy CachePolicy [get]
 Returns an object that provides access to the cache properties.
 
bool CdRomXa [get, set]
 Indicates whether to use Mode2 Form 1 XA sectors during the burning.
 
bool CloseDisc [get, set]
 Instructs DataDisc to close the disc after the session is written to the disc.
 
bool CloseSession [get, set]
 Indicates whether to close the session after the burning is completed.
 
bool CloseTrack [get, set]
 Indicates whether the track should be closed after the burning is completed.
 
DataOverwriteFlags DataOverwrite [get, set]
 Specifies whether files from the image layout should physically overwrite files that already exist on the disc.
 
Device Device [get, set]
 Gets/Sets the device that this object will use.
 
bool DvdVideo [get, set]
 Indicates that DataDisc should create a DVD-Video compatible image.
 
ErrorInfo Error [get]
 The error information for the last DataDisc operation.
 
Int32 ImageConstraints [get, set]
 Gets/Sets filename constraints.
 
DataFile ImageLayout [get]
 Gets the current image file tree.
 
Int32 ImageSizeInBlocks [get]
 Gets the size of the image layout in blocks.
 
Int64 ImageSizeInBytes [get]
 Gets the size of the image layout in bytes.
 
ImageType ImageType [get, set]
 Gets/Sets the image file system.
 
IsoVolumeProps IsoVolumeProps [get]
 Returns an object that provides access to ISO volume properties.
 
JolietVolumeProps JolietVolumeProps [get]
 Returns an object that provides access to Joliet volume properties.
 
Int32 LoadedImageSizeInBlocks [get]
 Gets the size, in blocks, of a image which has been loaded with the LoadFromDisc method.
 
Int32 LoadTrackLayout [get, set]
 Gets/Sets the number of a track that should be loaded from the disc before the burning starts.
 
Int32 SessionStartAddress [get, set]
 Gets/Sets the start address of the new data session in blocks.
 
bool SimulateBurn [get, set]
 Indicates that burning should be simulated.
 
bool TranslateFilenames [get, set]
 Enables the default translation of the file names during the image creation.
 
UdfVolumeProps UdfVolumeProps [get]
 Returns an object that provides access to UDF volume properties.
 
DataWriteAttributes WriteAttributes [get, set]
 Obsolete.
 
WriteMethod WriteMethod [get, set]
 Gets/Sets the disc write method.
 
DataWriteStrategy WriteStrategy [get, set]
 Gets/Sets the write strategy.
 

Events

EventHandler< DataDiscContinueEventArgsOnContinueBurn
 Raised to check if burning should continue.
 
EventHandler< DataDiscFileStatusEventArgsOnFileStatus
 Raised to report the burning progress of individual files.
 
EventHandler< DataDiscProgressEventArgsOnProgress
 Raised to report the number of bytes written to a disc or image file.
 
EventHandler< DataDiscStatusEventArgsOnStatus
 Raised to report the burning status.
 

Detailed Description

Creates and burns data images to CD, DVD and Blu-ray Discs.


Constructor & Destructor Documentation

◆ DataDisc()

DataDisc ( )

Creates a DataDisc instance.

When the DataDisc object is not needed anymore it should be disposed in order to deterministically reclaim the allocated resources.

Member Function Documentation

◆ CreateImageFile()

bool CreateImageFile ( string  imageFilename)

Creates an ISO image file.

The ISO image file can be written to a disc using the WriteImageToDisc method.

Parameters
imageFilenameFull path to the image file. If the image file already exists it will be overwritten.
Returns
true if the image is successfully created; false otherwise.

◆ LoadFromDisc()

bool LoadFromDisc ( Int32  trackNumber)

Loads a file system from existing track on a CD/DVD/BD.

Parameters
trackNumberThe track number from which to load the image path tables. The track must exist on the disc inserted in the device specified with the DataDisc.Device property.

This method reads only the directory tables of the data image without the user data. The directory tables map files and directories to logical block addresses on the disc.

When creating a multi-session data disc the calling application should merge the layouts of the new image and the last track on the disc.

Before using this method a Device object must be set using the DataDisc.Device property.

Returns
true if the operation is successful; false otherwise.

◆ LoadFromFile()

bool LoadFromFile ( string  imageFilename)

Loads the directory structure of an image from ISO image file.

The method works with Mode1 (2048 bytes/sector) data images created using the WriteToImageFile method.

Parameters
imageFilenameFull path to an ISO image file. The file should be a ISO9660, Joliet or UDF image that can be recorded in Mode1 (2048 bytes/sector). Loading of HFS images is currently not supported.
Returns
true if the image is successfully loaded; false otherwise
See also
DataDisc.CreateImageFile

◆ Merge() [1/2]

bool Merge ( DataDisc  right)

Merges the file trees of two DataDisc objects.

Parameters
rightA DataDisc object, that should be merged into this object. This method does a right-to-left merging (MergeDirection.Left).
Returns
true if the operation successful; false otherwise.
See also
Merge(DataDisc, MergeDirection)

Merge(DataDisc right, MergeDirection mergeDirection)


References DataDisc.Merge().

◆ Merge() [2/2]

bool Merge ( DataDisc  right,
MergeDirection  mergeDirection 
)

Merges the file trees of two DataDisc objects.

This method is usually used together with the LoadFromDisc method to create multi-session data discs.

Parameters
rightA DataDisc object, that should be merged into this object.
mergeDirectionThis parameter has a default value of MergeDirection.Left. It affects the way files with same virtual path are handled: MergeDirection.Left: If a file with the same virtual path exists both in 'right' and in 'this', the file from 'right' replaces the file from 'this'. MergeDirection.Right: If a file with the same virtual path exists both in 'right' and in 'this', the file from 'right' is ignored.
Returns
true if the operation successful; false otherwise.

Referenced by DataDisc.Merge().

◆ SetImageLayout() [1/2]

bool SetImageLayout ( DataFile  rootFolder)

Sets the file tree of a data image.

Parameters
rootFolderA DataFile object representing the root folder (directory) of the file system.
Returns
true if the layout is successfully set; false otherwise.

remarks> Filenames are not sorted: sortByFilename is false. /remarks>

See also
SetImageLayout(DataFile,bool)

SetImageLayout(DataFile rootFolder,bool sortByFilename)

References DataDisc.SetImageLayout().

◆ SetImageLayout() [2/2]

bool SetImageLayout ( DataFile  rootFolder,
bool  sortByFilename 
)

Sets the file tree of a data image.

Parameters
rootFolderA DataFile object representing the root folder (directory) of the file system.
sortByFilenameIndicates whether to perform case sensitive ASCII sorting of the file entries based on the LongFilename property. For example assume that you have two files with names JOHNSTON and JOHN_HENRY. The string JOHN_HENRY will be greater than JOHNSTON because the "_" has a greater ASCII value than an uppercase S. The file entry for JOHN_HENRY will be placed physically on the disc after the file entry for JOHNSTON.
Returns
true if the layout is successfully set; false otherwise.
See also
DataFile

Referenced by DataDisc.SetImageLayout().

◆ SetImageLayoutFromFolder() [1/2]

bool SetImageLayoutFromFolder ( string  folder)

Sets the file system of a data image from a folder.

Parameters
folderThe folder that should be used to create the image layout.

Filenames are not sorted: sortByFilename is false.

Returns
true if the layout is successfully set; false otherwise.
See also
DataDisc.SetImageLayoutFromFolder(string,bool)

DataDisc.SetImageLayoutFromFolder(string folder,bool sortByFilename)

◆ SetImageLayoutFromFolder() [2/2]

bool SetImageLayoutFromFolder ( string  folder,
bool  sortByFilename 
)

Sets the file system of a data image from a folder.

The directory and file structure of the data image will be identical to the file tree under the folder specified with the folder parameter.

Parameters
folderThe folder name that should be used to create the image layout. The name must specify the full path to the folder.
sortByFilenameIndicates whether to perform case sensitive ASCII sorting of the file entries based on the LongFilename property. For example assume that you have two files with names JOHNSTON and JOHN_HENRY. The string JOHN_HENRY will be greater than JOHNSTON because the "_" has a greater ASCII value than an uppercase S. The file entry for JOHN_HENRY will be placed physically on the Disc after the file entry for JOHNSTON.
Returns
true if the layout is successfully set; false otherwise.

◆ WriteImageToDisc() [1/4]

bool WriteImageToDisc ( string  imageFile)

Writes an image file to a disc.

Parameters
imageFileThe full path to a source image file.

dismountVolume is false.

Returns
true if the operation is successful; false otherwise.
See also
WriteImageToDisc(string, bool)

WriteImageToDisc(string imageFile, bool dismountVolume)

References DataDisc.WriteImageToDisc().

◆ WriteImageToDisc() [2/4]

bool WriteImageToDisc ( string  imageFile,
bool  dismountVolume 
)

Writes an image file to a disc.

Parameters
imageFileThe full path to a source image file.
dismountVolumeIndicates whether to dismount the volume after the burning. The default value of this parameter is false.

The operating system tries to mount an unmounted volume as soon as an attempt is made to access it. For example, a call to GetLogicalDrives triggers the operating system to mount unmounted volumes. Dismounting a volume is useful when a volume needs to disappear for a while. For example, when an application changes a volume file system it needs to dismount it to clear the volume information cache.

Returns
true if the operation is successful; false otherwise.

Referenced by DataDisc.WriteImageToDisc(), and DataDisc.WriteImageToDisc().

◆ WriteImageToDisc() [3/4]

bool WriteImageToDisc ( System::IO::Stream  image)

Writes an image stream to a disc.

The method uses a System.IO.Stream stream object to read the image data.

Parameters
imageAn object that inherits from System.IO.Stream.

dismountVolume is false.

Returns
true if the operation is successful; false otherwise.
See also
WriteImageToDisc(System.IO.Stream, bool)

WriteImageToDisc(System.IO.Stream image, bool dismountVolume)

References DataDisc.WriteImageToDisc().

◆ WriteImageToDisc() [4/4]

bool WriteImageToDisc ( System::IO::Stream  image,
bool  dismountVolume 
)

Writes an image stream to a disc.

The method uses a System.IO.Stream stream object to read the image data.

Parameters
imageAn object that inherits from System.IO.Stream.
dismountVolumeIndicates whether to dismount the volume after the burning. The default value of this parameter is false.

The operating system tries to mount an unmounted volume as soon as an attempt is made to access it. For example, a call to GetLogicalDrives triggers the operating system to mount unmounted volumes. Dismounting a volume is useful when a volume needs to disappear for a while. For example, when an application changes a volume file system it needs to dismount it to clear the volume information cache.

Returns
true if the operation is successful; false otherwise.

◆ WriteToDisc() [1/2]

bool WriteToDisc ( )

Writes a data track to a disc.

Returns
true if the operation is successful; false otherwise.
See also
WriteToDisc(bool)

WriteToDisc(bool dismountVolume)

References DataDisc.WriteToDisc().

Referenced by DataDisc.WriteToDisc().

◆ WriteToDisc() [2/2]

bool WriteToDisc ( bool  dismountVolume)

Writes a data track to a disc.

The image layout must be set with the SetImageLayoutFromFolder or SetImageLayout methods before this method can be used.

Parameters
dismountVolumeIndicates whether to dismount the volume after the burning. The default value of this parameter is false.

The operating system tries to mount an unmounted volume as soon as an attempt is made to access it. For example, a call to GetLogicalDrives triggers the operating system to mount unmounted volumes. Dismounting a volume is useful when a volume needs to disappear for a while. For example, when an application changes a volume file system it needs to dismount it to clear the volume information cache.

Returns
true if the operation is successful; false otherwise.

Property Documentation

◆ Bootable

bool Bootable
getset

Indicates whether a bootable image should be created.

If this property is not set a non-bootable image will be created.

The Bootable, BootImageFile and BootEmulation properties must be set before using the WriteToDisc or WriteToImageFile methods.

See also
PrimoSoftware.Burner.BootProps.ImageFile

BootProps.ImageFile

See also
PrimoSoftware.Burner.BootProps.Emulation

BootProps.Emulation

◆ CdRomXa

bool CdRomXa
getset

Indicates whether to use Mode2 Form 1 XA sectors during the burning.

If set to true the resulting CD will become a CD-ROM XA CD.

In multi-session / multi-track discs XA (Mode2 Form 1 XA) and normal (Mode1) track types cannot be mixed together. This property has effect only when the write method is set to Session-At-Once (WriteMethod.Sao).

◆ CloseDisc

bool CloseDisc
getset

Instructs DataDisc to close the disc after the session is written to the disc.

If you never set this property the disc will be closed by default. Setting CloseDisc has no effect for DVD-RAM.

◆ CloseSession

bool CloseSession
getset

Indicates whether to close the session after the burning is completed.

Setting CloseSession has no effect for DVD-RAM.

If this property is set to true, the session is closed. If this property is false, the session is left open and additional tracks may be added to the session later. If you do not set this property to true the session is always closed by default.

This property has no effect if the burn mode is set to DAO or if the DataDisc.CloseDisc property is set to true.

◆ CloseTrack

bool CloseTrack
getset

Indicates whether the track should be closed after the burning is completed.

The default value of this property is true.

Setting CloseTrack has no effect for DVD-RAM.

This setting is overridden by the CloseSession and CloseDisc properties.

A track is always closed when the session is set to be closed. A session is always closed when the disk is set to be closed.

◆ DataOverwrite

DataOverwriteFlags DataOverwrite
getset

Specifies whether files from the image layout should physically overwrite files that already exist on the disc.

When a file is physically overwritten the new file data is written to the same disc address as the old file, effectively replacing the data but not increasing the image size.

This property works only with DVD+RW media and is ignored for all other media profiles.

This property must be set before calling WriteToDisc or Merge methods in order to have any effect.

◆ DvdVideo

bool DvdVideo
getset

Indicates that DataDisc should create a DVD-Video compatible image.

When DvdVideo is set to true the following properties will be automatically changed: ImageType to ImageType.UdfIso, UdfVolumeProps.AllocDescType to UdfAllocDescType.Short>, UdfVolumeProps.TextEncoding to UdfTextEncoding.Ansi.

◆ Error

ErrorInfo Error
get

The error information for the last DataDisc operation.

See also
ErrorInfo

◆ ImageConstraints

Int32 ImageConstraints
getset

Gets/Sets filename constraints.

This is a combination of one or more flags defined in the ImageConstraints enumeration. The default value of this property is ImageConstraints.None and no validation of the filenames is performed by default.

The constraints are used by the SetImageLayout and SetImageLayoutFromFolder methods.

See also
TranslateFilenames, ImageConstraints

◆ ImageLayout

DataFile ImageLayout
get

Gets the current image file tree.

See also
DataDisc.LoadFromDisc, DataDisc.Merge

◆ ImageSizeInBlocks

Int32 ImageSizeInBlocks
get

Gets the size of the image layout in blocks.

See also
SetImageLayoutFromFolder, SetImageLayout

◆ ImageSizeInBytes

Int64 ImageSizeInBytes
get

Gets the size of the image layout in bytes.

See also
SetImageLayoutFromFolder, SetImageLayout

◆ ImageType

Gets/Sets the image file system.

The supported image types are defined in the ImageType enumeration.

See also
PrimoSoftware.Burner.ImageType

◆ LoadedImageSizeInBlocks

Int32 LoadedImageSizeInBlocks
get

Gets the size, in blocks, of a image which has been loaded with the LoadFromDisc method.

The size of a data block is 2048 bytes.

◆ LoadTrackLayout

Int32 LoadTrackLayout
getset

Gets/Sets the number of a track that should be loaded from the disc before the burning starts.

To disable track loading and merging set this property to 0.

NOTE: Loading of the image layout from HFS discs is not supported.

◆ SessionStartAddress

Int32 SessionStartAddress
getset

Gets/Sets the start address of the new data session in blocks.

The start address is saved in the directory structure of the image before it is burnt to a disc. The OS uses that information to find the data on multi-session discs.

IMPORTANT: When creating multi-track, multi session discs this property must be set before using any of the following methods: LoadFromDisc, Merge, SetImageLayoutFromFolder and SetImageLayout. Those methods adjust the ISO/Joliet/UDF directory structure according to the start address set with SessionStartAddress. Failing to set the session start address before using the image layout methods may lead to unreadable discs. Device.GetNewSessionStartAddress to get the correct start address for the next session.

◆ SimulateBurn

bool SimulateBurn
getset

Indicates that burning should be simulated.


The simulation is a good test of a disc recorder, because most of the operations are performed as in a real recording.

Simulation is only supported for CD-R/RW and DVD-R/RW media. On CD-R/RW media simulation is possible only for Track-At-Once or Session-At-Once recording. On DVD-R/RW media simulation is possible for Disc-At-Once recording.

◆ TranslateFilenames

bool TranslateFilenames
getset

Enables the default translation of the file names during the image creation.

If set to true, the engine will replace the long file names with shorter ones without reporting an error. If set to false the engine will report an error for any constraint that is violated. The default setting for this property is false.

The file names are translated according to the following rules:

  • If there is an extension the first three characters of the extension are kept as extension for the short filename.
  • The name part only (the part without the extension) is truncated so its length plus 4 (the length of the extension and the dot '.') equals the maximum filename length allowed for the image type that is to be created.

This property is ignored if no constraints have been set.

See also
DataFile.ShortFilename, ImageConstraints

◆ WriteMethod

Gets/Sets the disc write method.

The following write methods are currently supported:

CD Media: WriteMethod.Packet WriteMethod.Tao WriteMethod.Sao and WriteMethod.RawDao

DVD Media: WriteMethod.DvdIncremental and WriteMethod.DvdDao

The WriteMethod.DvdIncremental method works with all DVD profiles. The burning is done in sessions and fragments (tracks) with one exception for DVD+RW media: DVD+RW disc needs to be formatted before any burning could be done and once formatted the disc contains one session and one track and the whole track could be written and rewritten randomly with no overwrite restrictions.

The WriteMethod.DvdDao method can be used only with DVD-RW formatted for sequential writing and DVD-R media. With WriteMethod.DvdDao the disc will contain one session with one track. No sessions could be added after the burning is completed. It is recommended to use WriteMethod.DvdDao and DVD-R media to burn DVD movies to ensure best compatibility with the consumer DVD players.

BD Media: WriteMethod.BluRay

◆ WriteStrategy

DataWriteStrategy WriteStrategy
getset

Gets/Sets the write strategy.

The write strategy affect the way WriteToDisc method works. This property should be used only when burning multi-track incremental UDF sessions.

NOTE: The write strategy works only when the write method is set to WriteMethod.Packet or WriteMethod.DvdIncremental and when the image type is set to ImageType.Udf. The strategy is ignored in all other cases.

Event Documentation

◆ OnContinueBurn

EventHandler<DataDiscContinueEventArgs> OnContinueBurn

Raised to check if burning should continue.

The event handler receives an argument of type DataDiscContinueEventArgs containing data related to this event.

See also
DataDiscContinueEventArgs

◆ OnFileStatus

EventHandler<DataDiscFileStatusEventArgs> OnFileStatus

Raised to report the burning progress of individual files.

The event handler receives an argument of type DataDiscFileStatusEventArgs containing data related to this event.

See also
DataDiscFileStatusEventArgs

◆ OnProgress

EventHandler<DataDiscProgressEventArgs> OnProgress

Raised to report the number of bytes written to a disc or image file.

The event handler receives an argument of type DataDiscProgressEventArgs containing data related to this event.

See also
DataDiscProgressEventArgs

◆ OnStatus

EventHandler<DataDiscStatusEventArgs> OnStatus

Raised to report the burning status.

The event handler receives an argument of type DataDiscStatusEventArgs containing data related to this event.

See also
DataDiscStatusEventArgs