[DllImport(Libraries.MediaContent, EntryPoint = "media_filter_set_order_v2")]
internal static extern MediaContentError SetOrder(FilterHandle filter, string orderExpression);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_filter_set_storage")]
- internal static extern MediaContentError SetStorage(FilterHandle filter, string storageId);
}
internal class FilterHandle : MediaContentCriticalHandle
[DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_name")]
internal static extern MediaContentError GetName(IntPtr folder, out IntPtr folder_name);
- [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_storage_type")]
- internal static extern MediaContentError GetStorageType(IntPtr folder, out StorageType storage_type);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_storage_id")]
- internal static extern MediaContentError GetStorageId(IntPtr folder, out IntPtr storage_id);
-
[DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_folder_from_db")]
internal static extern MediaContentError GetFolderFromDb(string id, out IntPtr folder);
internal static partial class MediaInfo
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- internal delegate void ThumbnailCompletedCallback(MediaContentError error, string filePath, IntPtr userData);
-
- [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void FaceDetectionCompletedCallback(MediaContentError error, int count, IntPtr userData);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal static extern MediaContentError BatchInsert(string[] filePathArray, int arrayLength,
InsertCompletedCallback callback, IntPtr userData = default(IntPtr));
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_delete_from_db")]
- internal static extern MediaContentError Delete(string mediaId);
[DllImport(Libraries.MediaContent, EntryPoint = "media_info_destroy")]
internal static extern MediaContentError Destroy(IntPtr handle);
[DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_title")]
internal static extern MediaContentError GetTitle(MediaInfoHandle mediaInformationHandle, out IntPtr title);
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_storage_id")]
- internal static extern MediaContentError GetStorageId(MediaInfoHandle mediaInformationHandle, out IntPtr storageId);
-
[DllImport(Libraries.MediaContent, EntryPoint = "media_info_is_drm")]
internal static extern MediaContentError IsDrm(MediaInfoHandle mediaInformationHandle, out bool isDrm);
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_storage_type")]
- internal static extern MediaContentError GetStorageType(MediaInfoHandle mediaInformationHandle, out StorageType storageType);
-
[DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_media_from_db")]
internal static extern MediaContentError GetMediaFromDB(string mediaId, out MediaInfoHandle handle);
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-using System;
-using System.Runtime.InteropServices;
-using Tizen.Content.MediaContent;
-
-internal static partial class Interop
-{
- internal static class Storage
- {
- [DllImport(Libraries.MediaContent, EntryPoint = "media_storage_get_storage_info_from_db")]
- internal static extern MediaContentError GetStorageInfoFromDb(string id, out IntPtr storage);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_storage_get_storage_count_from_db")]
- internal static extern MediaContentError GetStorageCountFromDb(FilterHandle filter, out int count);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_storage_get_media_count_from_db")]
- internal static extern MediaContentError GetMediaCountFromDb(string id, FilterHandle filter, out int count);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_storage_destroy")]
- internal static extern MediaContentError Destroy(IntPtr storage);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_storage_get_id")]
- internal static extern MediaContentError GetId(IntPtr storage, out IntPtr id);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_storage_get_path")]
- internal static extern MediaContentError GetPath(IntPtr storage, out IntPtr path);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_storage_get_type")]
- internal static extern MediaContentError GetType(IntPtr storage, out StorageType type);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_storage_foreach_storage_from_db")]
- internal static extern MediaContentError ForeachStorageFromDb(FilterHandle filter, Common.ItemCallback callback,
- IntPtr userData = default(IntPtr));
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_storage_foreach_media_from_db")]
- internal static extern MediaContentError ForeachMediaFromDb(string id, FilterHandle filter,
- Common.ItemCallback callback, IntPtr userData = default(IntPtr));
- }
-}
public static string DateRecorded => "MEDIA_RECORDED_DATE";
/// <summary>
- /// Gets the column name for the copyright of media.
- /// </summary>
- /// <value>The column name for the copyright of media.</value>
- /// <remarks>
- /// The value type is string.
- /// </remarks>
- /// <seealso cref="AudioInfo.Copyright"/>
- /// <seealso cref="VideoInfo.Copyright"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! This will be deprecated in level 6")]
- public static string Copyright => "MEDIA_COPYRIGHT";
-
- /// <summary>
/// Gets the column name for the track number of media.
/// </summary>
/// <value>The column name for the track number of media.</value>
public static string TrackNumber => "MEDIA_TRACK_NUM";
/// <summary>
- /// Gets the column name for the description of media.
- /// </summary>
- /// <value>The column name for the description of media.</value>
- /// <remarks>
- /// The value type is string.
- /// </remarks>
- /// <seealso cref="MediaInfo.Description"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! This will be deprecated in level 6")]
- public static string Description => "MEDIA_DESCRIPTION";
-
- /// <summary>
- /// Gets the column name for the bit rate of media.
- /// </summary>
- /// <value>The column name for the bit rate of media.</value>
- /// <remarks>
- /// The value type is integer.
- /// </remarks>
- /// <seealso cref="AudioInfo.BitRate"/>
- /// <seealso cref="VideoInfo.BitRate"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! This will be deprecated in level 6")]
- public static string BitRate => "MEDIA_BITRATE";
-
- /// <summary>
- /// Gets the column name for the bit per sample of media.
- /// </summary>
- /// <value>The column name for the bit per sample of media.</value>
- /// <remarks>
- /// The value type is integer.
- /// </remarks>
- /// <seealso cref="AudioInfo.BitPerSample"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! This will be deprecated in level 6")]
- public static string BitPerSample => "MEDIA_BITPERSAMPLE";
-
- /// <summary>
- /// Gets the column name for the sample rate of media.
- /// </summary>
- /// <value>The column name for the sample rate of media.</value>
- /// <remarks>
- /// The value type is integer.
- /// </remarks>
- /// <seealso cref="AudioInfo.SampleRate"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! This will be deprecated in level 6")]
- public static string SampleRate => "MEDIA_SAMPLERATE";
-
- /// <summary>
- /// Gets the column name for the channels of media.
- /// </summary>
- /// <value>The column name for the channels of media.</value>
- /// <remarks>
- /// The value type is integer.
- /// </remarks>
- /// <seealso cref="AudioInfo.Channels"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! This will be deprecated in level 6")]
- public static string Channels => "MEDIA_CHANNEL";
-
- /// <summary>
/// Gets the column name for the duration of media.
/// </summary>
/// <value>The column name for the duration of media.</value>
public static string DateTaken => "MEDIA_DATETAKEN";
/// <summary>
- /// Gets the column name for the orientation of media.
- /// </summary>
- /// <value>The column name for the orientation of media.</value>
- /// <remarks>
- /// The value type is integer.
- /// The value should be an integer that is one of the <see cref="MediaContent.Orientation"/> values.
- /// </remarks>
- /// <seealso cref="MediaContent.Orientation"/>
- /// <seealso cref="ImageInfo.Orientation"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! This will be deprecated in level 6")]
- public static string Orientation => "MEDIA_ORIENTATION";
-
- /// <summary>
- /// Gets the column name for the rating of media.
- /// </summary>
- /// <value>The column name for the rating of media.</value>
- /// <remarks>
- /// The value type is integer.
- /// </remarks>
- /// <seealso cref="MediaInfo.Rating"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! This will be deprecated in level 6")]
- public static string Rating => "MEDIA_RATING";
-
- /// <summary>
/// Gets the column name for the favorite status of media.
/// </summary>
/// <value>The column name for the favorite status of media.</value>
/// <seealso cref="MediaInfo.IsDrm"/>
/// <since_tizen> 4 </since_tizen>
public static string IsDrm => "MEDIA_IS_DRM";
-
- /// <summary>
- /// Gets the column name for the storage type of media.
- /// </summary>
- /// <value>The column name for the storage type of media.</value>
- /// <remarks>
- /// The value type is integer.
- /// The value should be an integer that is one of the <see cref="MediaContent.StorageType"/> values.
- /// </remarks>
- /// <seealso cref="MediaInfo.StorageType"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! This will be deprecated in level 6")]
- public static string StorageType => "MEDIA_STORAGE_TYPE";
-
- /// <summary>
- /// Gets the column name for the exposure time of media.
- /// </summary>
- /// <value>The column name for the exposure time of media.</value>
- /// <remarks>
- /// The value type is integer.
- /// </remarks>
- /// <seealso cref="ImageInfo.ExposureTime"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! This will be deprecated in level 6")]
- public static string ExposureTime => "MEDIA_EXPOSURE_TIME";
-
- /// <summary>
- /// Gets the column name for the FNumber of media.
- /// </summary>
- /// <value>The column name for the FNumber of media.</value>
- /// <remarks>
- /// The value type is integer.
- /// </remarks>
- /// <seealso cref="ImageInfo.FNumber"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! This will be deprecated in level 6")]
- public static string FNumber => "MEDIA_FNUMBER";
-
- /// <summary>
- /// Gets the column name for the ISO of media.
- /// </summary>
- /// <value>The column name for the ISO of media.</value>
- /// <remarks>
- /// The value type is integer.
- /// </remarks>
- /// <seealso cref="ImageInfo.Iso"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! This will be deprecated in level 6")]
- public static string Iso => "MEDIA_ISO";
-
- /// <summary>
- /// Gets the column name for the model of media.
- /// </summary>
- /// <value>The column name for the model of media.</value>
- /// <remarks>
- /// The value type is string.
- /// </remarks>
- /// <seealso cref="ImageInfo.Model"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! This will be deprecated in level 6")]
- public static string Model => "MEDIA_MODEL";
}
/// <summary>
/// <seealso cref="Folder.Name"/>
/// <since_tizen> 4 </since_tizen>
public static string Name => "FOLDER_NAME";
-
- /// <summary>
- /// Gets the column name for the storage type of folder.
- /// </summary>
- /// <value>The column name for the storage type of folder.</value>
- /// <remarks>
- /// The value type is integer.
- /// The value should be an integer that is one of the <see cref="MediaContent.StorageType"/> values.
- /// </remarks>
- /// <seealso cref="Folder.StorageType"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! this will be deprecated in level 6")]
- public static string StorageType => "FOLDER_STORAGE_TYPE";
}
/// <summary>
/// <since_tizen> 4 </since_tizen>
public static string Id => "MEDIA_FACE_ID";
}
-
- /// <summary>
- /// Provides the storage column names that can be used for Select and Count commands.
- /// </summary>
- /// <seealso cref="SelectArguments"/>
- /// <seealso cref="CountArguments"/>
- /// <seealso cref="QueryArguments.FilterExpression"/>
- /// <seealso cref="SelectArguments.SortOrder"/>
- /// <seealso cref="StorageCommand.Count(CountArguments)"/>
- /// <seealso cref="StorageCommand.Select(SelectArguments)"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! this will be deprecated in level 6")]
- public static class StorageColumns
- {
- /// <summary>
- /// Gets the column name for the ID of storage.
- /// </summary>
- /// <value>The column name for the ID of storage.</value>
- /// <remarks>
- /// The value type is string.
- /// </remarks>
- /// <seealso cref="Storage.Id"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! this will be deprecated in level 6")]
- public static string Id => "STORAGE_ID";
-
- /// <summary>
- /// Gets the column name for the path of storage.
- /// </summary>
- /// <value>The column name for the path of storage.</value>
- /// <remarks>
- /// The value type is string.
- /// </remarks>
- /// <seealso cref="Storage.Path"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! this will be deprecated in level 6")]
- public static string Path => "STORAGE_PATH";
-
- /// <summary>
- /// Gets the column name for the type of storage.
- /// </summary>
- /// <value>The column name for the type of storage.</value>
- /// <remarks>
- /// The value type is integer.
- /// The value should be an integer that is one of the <see cref="MediaContent.StorageType"/> values.
- /// </remarks>
- /// <seealso cref="Storage.Type"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! this will be deprecated in level 6")]
- public static string Type => "MEDIA_STORAGE_TYPE";
- }
}
}
}
}
+
+ static internal class MediaContentLog
+ {
+ internal const string Tag = "Tizen.Content.MediaContent";
+ }
}
/// <since_tizen> 4 </since_tizen>
public class Folder
{
-#pragma warning disable CS0618 // Type or member is obsolete
internal Folder(IntPtr handle)
{
Id = InteropHelper.GetString(handle, Interop.Folder.GetFolderId);
Path = InteropHelper.GetString(handle, Interop.Folder.GetPath);
Name = InteropHelper.GetString(handle, Interop.Folder.GetName);
-
- StorageType = InteropHelper.GetValue<StorageType>(handle, Interop.Folder.GetStorageType);
- StorageId = InteropHelper.GetString(handle, Interop.Folder.GetStorageId);
}
-#pragma warning restore CS0618 // Type or member is obsolete
+
internal static Folder FromHandle(IntPtr handle) => new Folder(handle);
/// <summary>
public string Name { get; }
/// <summary>
- /// Gets the <see cref="StorageType"/> of the storage that the folder exists.
- /// </summary>
- /// <value>The <see cref="StorageType"/> of the storage that the folder exists.</value>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! this will be deprecated in level 6")]
- public StorageType StorageType { get; }
-
- /// <summary>
- /// Gets the storage ID of the storage that the folder exists.
- /// </summary>
- /// <value>The storage ID of the storage that the folder exists.</value>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! this will be deprecated in level 6")]
- public string StorageId { get; }
-
-#pragma warning disable CS0618 // Type or member is obsolete
- /// <summary>
/// Returns a string representation of the folder.
/// </summary>
/// <returns>A string representation of the current folder.</returns>
/// <since_tizen> 4 </since_tizen>
- public override string ToString() =>
- $"Id={Id}, Name={Name}, Path={Path}, StorageType={StorageType}, StorageId={StorageType}";
-#pragma warning restore CS0618 // Type or member is obsolete
+ public override string ToString() => $"Id={Id}, Name={Name}, Path={Path}";
}
}
/// <since_tizen> 4 </since_tizen>
public class MediaInfo
{
-#pragma warning disable CS0618 // Type or member is obsolete
internal MediaInfo(Interop.MediaInfoHandle handle)
{
Id = InteropHelper.GetString(handle, Interop.MediaInfo.GetMediaId);
Rating = InteropHelper.GetValue<int>(handle, Interop.MediaInfo.GetRating);
IsFavorite = InteropHelper.GetValue<bool>(handle, Interop.MediaInfo.GetFavorite);
Title = InteropHelper.GetString(handle, Interop.MediaInfo.GetTitle);
- StorageId = InteropHelper.GetString(handle, Interop.MediaInfo.GetStorageId);
IsDrm = InteropHelper.GetValue<bool>(handle, Interop.MediaInfo.IsDrm);
-
- StorageType = InteropHelper.GetValue<StorageType>(handle, Interop.MediaInfo.GetStorageType);
}
-#pragma warning restore CS0618 // Type or member is obsolete
/// <summary>
/// Gets the ID of media.
public string Title { get; }
/// <summary>
- /// Gets the storage ID of the storage that the media is stored on.
- /// </summary>
- /// <value>The storage ID of the storage that the media is stored on.</value>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! this will be deprecated in level 6")]
- public string StorageId { get; }
-
- /// <summary>
/// Gets the value indicating whether the media is DRM-protected.
/// </summary>
/// <value>A bool value indicating whether the media is DRM-protected.</value>
public bool IsDrm { get; }
/// <summary>
- /// Gets the storage type of the storage that the media is stored on.
- /// </summary>
- /// <value>The storage type of the storage that the media is stored on.</value>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! this will be deprecated in level 6")]
- public StorageType StorageType { get; }
-
- /// <summary>
/// Returns a string representation of the media information.
/// </summary>
/// <returns>A string representation of the current media information.</returns>
/// <exception cref="UnsupportedContentException">
/// The thumbnail is not available for the given media.<br/>
/// -or-<br/>
- /// The media is in the external USB storage (<see cref="MediaInfo.StorageType"/> is <see cref="StorageType.ExternalUsb"/>).
+ /// The media is in the external USB storage.
/// </exception>
/// <since_tizen> 4 </since_tizen>
[Obsolete("Deprecated since API10; Will be removed in API12. Please use CreateThumbnail instead.")]
/// <exception cref="UnsupportedContentException">
/// The thumbnail is not available for the given media.<br/>
/// -or-<br/>
- /// The media is in the external USB storage (<see cref="MediaInfo.StorageType"/> is <see cref="StorageType.ExternalUsb"/>).
+ /// The media is in the external USB storage.
/// </exception>
/// <since_tizen> 4 </since_tizen>
[Obsolete("Deprecated since API10; Will be removed in API12. Please use CreateThumbnail instead.")]
/// <exception cref="UnsupportedContentException">
/// The thumbnail is not available for the given media.<br/>
/// -or-<br/>
- /// The media is in the external USB storage (<see cref="MediaInfo.StorageType"/> is <see cref="StorageType.ExternalUsb"/>).
+ /// The media is in the external USB storage.
/// </exception>
/// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
/// <since_tizen> 10 </since_tizen>
/// <exception cref="UnsupportedContentException">
/// Face detection is not available for the given media.<br/>
/// -or-<br/>
- /// The media is in the external USB storage (<see cref="MediaInfo.StorageType"/> is <see cref="StorageType.ExternalUsb"/>).
+ /// The media is in the external USB storage.
/// </exception>
/// <exception cref="NotSupportedException">The required feature is not supported.</exception>
/// <since_tizen> 4 </since_tizen>
using (handle)
{
- if (InteropHelper.GetValue<StorageType>(handle, Interop.MediaInfo.GetStorageType) == StorageType.ExternalUsb)
- {
- throw new UnsupportedContentException("The media is in external usb storage.");
- }
-
if (InteropHelper.GetValue<MediaType>(handle, Interop.MediaInfo.GetMediaType) != MediaType.Image)
{
throw new UnsupportedContentException("Only image is supported.");
using (RegisterCancelFaceDetection(cancellationToken, tcs, handle))
using (var cbKeeper = ObjectKeeper.Get(GetFaceDetectionCallback(tcs)))
{
- Interop.MediaInfo.StartFaceDetection(handle, cbKeeper.Target).ThrowIfError("Failed to detect faces");
+ var ret = Interop.MediaInfo.StartFaceDetection(handle, cbKeeper.Target);
+ if (ret == MediaContentError.InvalidParameter)
+ {
+ throw new UnsupportedContentException("The media is in external usb storage.");
+ }
+
+ ret.ThrowIfError("Failed to detect faces");
return await tcs.Task;
}
}
}
- private string _storageId;
-
- /// <summary>
- /// Gets or sets the storage ID for the given filter.
- /// You can use this property when you want to search items only in the specific storage.
- /// </summary>
- /// <value>The storage ID to restrict storage to search, or null for all storages.</value>
- /// <exception cref="ArgumentException"><paramref name="value"/> is a zero-length string, contains only white space.</exception>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! this will be deprecated in level 6")]
- public string StorageId
- {
- get => _storageId;
- set
- {
- if (value != null)
- {
- ValidationUtil.ValidateNotNullOrEmpty(value, nameof(value));
- }
-
- _storageId = value;
- }
- }
-
internal static FilterHandle ToNativeHandle(QueryArguments arguments)
{
if (arguments == null || arguments.IsEmpty())
return handle;
}
-#pragma warning disable CS0618 // Type or member is obsolete
internal virtual bool IsEmpty()
{
- return StorageId == null && FilterExpression == null;
+ return FilterExpression == null;
}
internal virtual void FillHandle(FilterHandle handle)
Interop.Filter.SetCondition(handle, FilterExpression, Collation.Default).
ThrowIfError("Failed to create filter handle(condition)");
}
-
- if (StorageId != null)
- {
- Interop.Filter.SetStorage(handle, StorageId).
- ThrowIfError("Failed to create filter handle(storage id)"); ;
- }
}
-#pragma warning restore CS0618 // Type or member is obsolete
-
}
/// <summary>
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-using System;
-
-namespace Tizen.Content.MediaContent
-{
- /// <summary>
- /// Represents the storage information for media.
- /// </summary>
- /// <remarks>
- /// The system generates the storage ID when the external storage is added and manages the media information
- /// in each of the storage by using the storage ID.
- /// </remarks>
- /// <since_tizen> 3 </since_tizen>
- [Obsolete("Please do not use! this will be deprecated in level 6")]
- public class Storage
- {
- internal Storage(IntPtr handle)
- {
- Path = InteropHelper.GetString(handle, Interop.Storage.GetPath);
- Id = InteropHelper.GetString(handle, Interop.Storage.GetId);
- Type = InteropHelper.GetValue<StorageType>(handle, Interop.Storage.GetType);
- }
-
- internal static Storage FromHandle(IntPtr handle) => new Storage(handle);
-
- /// <summary>
- /// Gets the ID of the storage.
- /// </summary>
- /// <value>The unique ID of the storage.</value>
- /// <since_tizen> 3 </since_tizen>
- public string Id { get; }
-
- /// <summary>
- /// Gets the path of the storage.
- /// </summary>
- /// <value>The path of the storage.</value>
- /// <since_tizen> 4 </since_tizen>
- public string Path { get; }
-
- /// <summary>
- /// Gets the type of the storage.
- /// </summary>
- /// <value>The type of the storage.</value>
- /// <since_tizen> 4 </since_tizen>
- public StorageType Type { get; }
-
- /// <summary>
- /// Returns a string representation of the storage.
- /// </summary>
- /// <returns>A string representation of the current storage.</returns>
- /// <since_tizen> 4 </since_tizen>
- public override string ToString() =>
- $"Id={Id}, Path={Path}, Type={Type}";
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-using System;
-
-namespace Tizen.Content.MediaContent
-{
- /// <summary>
- /// Provides the commands to manage external storages in the database.
- /// </summary>
- /// <remarks>
- /// The internal storage is not managed.
- /// </remarks>
- /// <seealso cref="Storage"/>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! this will be deprecated in level 6")]
- public class StorageCommand : MediaCommand
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="StorageCommand"/> class with the specified <see cref="MediaDatabase"/>.
- /// </summary>
- /// <param name="database">The <see cref="MediaDatabase"/> that the commands run on.</param>
- /// <exception cref="ArgumentNullException"><paramref name="database"/> is null.</exception>
- /// <exception cref="ObjectDisposedException"><paramref name="database"/> has already been disposed.</exception>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! this will be deprecated in level 6")]
- public StorageCommand(MediaDatabase database) : base(database)
- {
- }
-
- /// <summary>
- /// Retrieves the number of storages.
- /// </summary>
- /// <returns>The number of storages.</returns>
- /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
- /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! this will be deprecated in level 6")]
- public int Count() => Count(arguments: null);
-
- /// <summary>
- /// Retrieves the number of storages with the <see cref="CountArguments"/>.
- /// </summary>
- /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
- /// <returns>The number of storages filtered.</returns>
- /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
- /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! this will be deprecated in level 6")]
- public int Count(CountArguments arguments)
- {
- ValidateDatabase();
-
- return CommandHelper.Count(Interop.Storage.GetStorageCountFromDb, arguments);
- }
-
- /// <summary>
- /// Retrieves the storage with the specified ID.
- /// </summary>
- /// <param name="storageId">The storage ID to select.</param>
- /// <returns>The <see cref="Storage"/> instance if the matched record was found in the database, otherwise null.</returns>
- /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
- /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
- /// <exception cref="ArgumentNullException"><paramref name="storageId"/> is null.</exception>
- /// <exception cref="ArgumentException"><paramref name="storageId"/> is a zero-length string, contains only white space.</exception>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! this will be deprecated in level 6")]
- public Storage Select(string storageId)
- {
- ValidateDatabase();
-
- ValidationUtil.ValidateNotNullOrEmpty(storageId, nameof(storageId));
-
- IntPtr handle = IntPtr.Zero;
-
- try
- {
- Interop.Storage.GetStorageInfoFromDb(storageId, out handle).ThrowIfError("Failed to query");
-
- return new Storage(handle);
- }
- catch (ArgumentException)
- {
- // Native FW returns ArgumentException when there's no matched record.
- return null;
- }
- finally
- {
- if (handle != IntPtr.Zero)
- {
- Interop.Storage.Destroy(handle);
- }
- }
- }
-
- /// <summary>
- /// Retrieves all the storages.
- /// </summary>
- /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
- /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
- /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! this will be deprecated in level 6")]
- public MediaDataReader<Storage> Select() => Select(arguments: null);
-
- /// <summary>
- /// Retrieves the storages with the <see cref="SelectArguments"/>.
- /// </summary>
- /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
- /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
- /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
- /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! this will be deprecated in level 6")]
- public MediaDataReader<Storage> Select(SelectArguments arguments)
- {
- ValidateDatabase();
-
- return CommandHelper.Select(arguments, Interop.Storage.ForeachStorageFromDb, Storage.FromHandle);
- }
-
- private bool Exists(string storageId)
- {
- ValidateDatabase();
-
- ValidationUtil.ValidateNotNullOrEmpty(storageId, nameof(storageId));
-
- return Count(new CountArguments { FilterExpression = $"{StorageColumns.Id}='{storageId}'" }) != 0;
- }
-
- /// <summary>
- /// Retrieves the number of media information of the storage.
- /// </summary>
- /// <param name="storageId">The storage ID.</param>
- /// <returns>The number of media information.</returns>
- /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
- /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
- /// <exception cref="ArgumentNullException"><paramref name="storageId"/> is null.</exception>
- /// <exception cref="ArgumentException"><paramref name="storageId"/> is a zero-length string, contains only white space.</exception>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! this will be deprecated in level 6")]
- public int CountMedia(string storageId) => CountMedia(storageId, null);
-
- /// <summary>
- /// Retrieves the number of media information of the storage with the <see cref="CountArguments"/>.
- /// </summary>
- /// <param name="storageId">The storage ID to query with.</param>
- /// <param name="arguments">The criteria to use to filter. This value can be null.</param>
- /// <returns>The number of media information.</returns>
- /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
- /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
- /// <exception cref="ArgumentNullException"><paramref name="storageId"/> is null.</exception>
- /// <exception cref="ArgumentException"><paramref name="storageId"/> is a zero-length string, contains only white space.</exception>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! this will be deprecated in level 6")]
- public int CountMedia(string storageId, CountArguments arguments)
- {
- if (Exists(storageId) == false)
- {
- return 0;
- }
-
- return CommandHelper.Count(Interop.Storage.GetMediaCountFromDb, storageId, arguments);
- }
-
- /// <summary>
- /// Retrieves the media information of the storage.
- /// </summary>
- /// <param name="storageId">The storage ID.</param>
- /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
- /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
- /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
- /// <exception cref="ArgumentNullException"><paramref name="storageId"/> is null.</exception>
- /// <exception cref="ArgumentException"><paramref name="storageId"/> is a zero-length string, contains only white space.</exception>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! this will be deprecated in level 6")]
- public MediaDataReader<MediaInfo> SelectMedia(string storageId) => SelectMedia(storageId, null);
-
- /// <summary>
- /// Retrieves the media information of the storage with the <see cref="SelectArguments"/>.
- /// </summary>
- /// <param name="storageId">The storage ID.</param>
- /// <param name="filter">The criteria to use to filter. This value can be null.</param>
- /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
- /// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
- /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
- /// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
- /// <exception cref="ArgumentNullException"><paramref name="storageId"/> is null.</exception>
- /// <exception cref="ArgumentException"><paramref name="storageId"/> is a zero-length string, contains only white space.</exception>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Please do not use! this will be deprecated in level 6")]
- public MediaDataReader<MediaInfo> SelectMedia(string storageId, SelectArguments filter)
- {
- if (Exists(storageId) == false)
- {
- return new MediaDataReader<MediaInfo>(new MediaInfo[0]);
- }
-
- return CommandHelper.SelectMedia(Interop.Storage.ForeachMediaFromDb, storageId, filter);
- }
-
- }
-}