Class MediaDatabase

    Definition

    Namespace:
    Tizen.Content.MediaContent
    Assembly:
    Tizen.Content.MediaContent.dll

    Provides the ability to connect to and manage the database.

    public class MediaDatabase : IDisposable
    Inheritance
    object
    MediaDatabase
    Implements
    System.IDisposable

    Constructors

    View Source

    MediaDatabase()

    Initializes a new instance of the MediaDatabase class.

    Declaration
    public MediaDatabase()

    Properties

    View Source

    IsDisposed

    Gets the value indicating whether the database has been disposed.

    Declaration
    public bool IsDisposed { get; }
    Property Value
    Type Description
    bool

    true if the database has been disposed; otherwise, false.

    Methods

    View Source

    Connect()

    Connects to the database.

    Declaration
    public void Connect()
    Exceptions
    Type Condition
    System.InvalidOperationException

    The database is already connected.

    System.ObjectDisposedException

    The MediaDatabase has already been disposed.

    MediaDatabaseException

    An error occurred while connecting.

    View Source

    Disconnect()

    Disconnects from the media database.

    Declaration
    public void Disconnect()
    Exceptions
    Type Condition
    System.InvalidOperationException

    The database is not connected.

    System.ObjectDisposedException

    The MediaDatabase has already been disposed.

    MediaDatabaseException

    An error occurred while connecting.

    View Source

    Dispose()

    Releases all the resources.

    Declaration
    public void Dispose()
    View Source

    Dispose(bool)

    Disposes of the resources (other than memory) used by the MediaDatabase.

    Declaration
    protected virtual void Dispose(bool disposing)
    Parameters
    Type Name Description
    bool disposing

    true to release both managed and unmanaged resources; false to release only unmanaged resources.

    View Source

    ScanFile(string)

    Requests to scan a media file.

    Declaration
    public void ScanFile(string path)
    Parameters
    Type Name Description
    string path

    The path of the media to be scanned.

    Remarks

    It requests to scan a media file to the media server.
    If the specified file is not registered to the database yet, the media file information will be added to the database.
    If it is already registered to the database, the media information is refreshed.
    If the specified file does not exist, the record of the media file will be deleted from the database.

    If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.
    If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.

    If http://tizen.org/feature/content.scanning.others feature is not supported and the specified file is other-type, System.NotSupportedException will be thrown.

    Exceptions
    Type Condition
    System.InvalidOperationException

    The database is not connected.

    System.ObjectDisposedException

    The MediaDatabase has already been disposed.

    System.ArgumentNullException

    path is null.

    System.ArgumentException

    path is a zero-length string, contains only white space.
    -or-
    path contains a hidden path that starts with '.'.
    -or-
    path contains a directory containing the ".scan_ignore" file.

    System.UnauthorizedAccessException

    The caller has no required privilege.

    System.NotSupportedException

    The required feature is not supported.

    View Source

    ScanFolderAsync(string, bool, CancellationToken)

    Requests to scan a folder.

    Declaration
    public Task ScanFolderAsync(string folderPath, bool recursive, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    string folderPath

    The path to scan.

    bool recursive

    The value indicating if the folder is to be recursively scanned.

    System.Threading.CancellationToken cancellationToken

    The token to stop scanning.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A task that represents the asynchronous scan operation.

    Remarks

    If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.
    If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.

    Exceptions
    Type Condition
    System.InvalidOperationException

    The database is not connected.

    System.ObjectDisposedException

    The MediaDatabase has already been disposed.

    System.UnauthorizedAccessException

    The caller has no required privilege.

    System.ArgumentNullException

    folderPath is null.

    System.ArgumentException

    folderPath is a zero-length string, contains only white space.
    -or-
    folderPath contains a hidden path that starts with '.'.
    -or-
    folderPath contains a directory containing the ".scan_ignore" file.

    View Source

    ScanFolderAsync(string, bool)

    Requests to scan a folder.

    Declaration
    public Task ScanFolderAsync(string folderPath, bool recursive)
    Parameters
    Type Name Description
    string folderPath

    The path to scan.

    bool recursive

    The value indicating if the folder is to be recursively scanned.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A task that represents the asynchronous scan operation.

    Remarks

    If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.
    If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.

    Exceptions
    Type Condition
    System.InvalidOperationException

    The database is not connected.

    System.ObjectDisposedException

    The MediaDatabase has already been disposed.

    System.UnauthorizedAccessException

    The caller has no required privilege.

    System.ArgumentNullException

    folderPath is null.

    System.ArgumentException

    folderPath is a zero-length string, contains only white space.
    -or-
    folderPath contains a hidden path that starts with '.'.
    -or-
    folderPath contains a directory containing the ".scan_ignore" file.

    View Source

    ScanFolderAsync(string, CancellationToken)

    Requests to scan a folder recursively.

    Declaration
    public Task ScanFolderAsync(string folderPath, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    string folderPath

    The path to scan.

    System.Threading.CancellationToken cancellationToken

    The token to stop scanning.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A task that represents the asynchronous scan operation.

    Remarks

    If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.
    If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.

    Exceptions
    Type Condition
    System.InvalidOperationException

    The database is not connected.

    System.ObjectDisposedException

    The MediaDatabase has already been disposed.

    System.UnauthorizedAccessException

    The caller has no required privilege.

    System.ArgumentNullException

    folderPath is null.

    System.ArgumentException

    folderPath is a zero-length string, contains only white space.
    -or-
    folderPath contains a hidden path that starts with '.'.
    -or-
    folderPath contains a directory containing the ".scan_ignore" file.

    View Source

    ScanFolderAsync(string)

    Requests to scan a folder recursively.

    Declaration
    public Task ScanFolderAsync(string folderPath)
    Parameters
    Type Name Description
    string folderPath

    The path to scan.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A task that represents the asynchronous scan operation.

    Remarks

    If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.
    If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.

    Exceptions
    Type Condition
    System.InvalidOperationException

    The database is not connected.

    System.ObjectDisposedException

    The MediaDatabase has already been disposed.

    System.UnauthorizedAccessException

    The caller has no required privilege.

    System.ArgumentNullException

    folderPath is null.

    System.ArgumentException

    folderPath is a zero-length string, contains only white space.
    -or-
    folderPath contains a hidden path that starts with '.'.
    -or-
    folderPath contains a directory containing the ".scan_ignore" file.

    Events

    View Source

    FolderUpdated

    Occurs when there is a change for the folder in the database.

    Declaration
    public static event EventHandler<FolderUpdatedEventArgs> FolderUpdated
    Event Type
    Type Description
    System.EventHandler<TEventArgs><FolderUpdatedEventArgs>
    View Source

    MediaInfoUpdated

    Occurs when there is a change for media in the database.

    Declaration
    public static event EventHandler<MediaInfoUpdatedEventArgs> MediaInfoUpdated
    Event Type
    Type Description
    System.EventHandler<TEventArgs><MediaInfoUpdatedEventArgs>

    Implements

    System.IDisposable
    • View Source
    Back to top Copyright © 2016-2024 Samsung
    Generated by DocFX