From 5aef277cbf2a0f96f2093ecb52dd600f66f11457 Mon Sep 17 00:00:00 2001 From: hsgwon Date: Tue, 30 Apr 2019 10:19:45 +0900 Subject: [PATCH] [MediaContent] Deprecate Storage API (#807) --- .../Tizen.Content.MediaContent.csproj | 1 + .../Tizen.Content.MediaContent/Columns.cs | 8 +++++++- .../Tizen.Content.MediaContent/Folder.cs | 2 ++ .../Tizen.Content.MediaContent/MediaInfo.cs | 2 ++ .../Tizen.Content.MediaContent/MediaInfoCommand.cs | 12 ++++++++---- .../Tizen.Content.MediaContent/QueryArguments.cs | 1 + .../Tizen.Content.MediaContent/Storage.cs | 5 +++++ .../Tizen.Content.MediaContent/StorageCommand.cs | 11 +++++++++++ 8 files changed, 37 insertions(+), 5 deletions(-) mode change 100755 => 100644 src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Storage.cs diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent.csproj b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent.csproj index fbac841..7a96416 100644 --- a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent.csproj +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent.csproj @@ -5,6 +5,7 @@ + diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Columns.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Columns.cs index 819fe5a..3d4f35c 100644 --- a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Columns.cs +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Columns.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); @@ -466,6 +466,7 @@ namespace Tizen.Content.MediaContent /// /// /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public static string StorageType => "MEDIA_STORAGE_TYPE"; /// @@ -603,6 +604,7 @@ namespace Tizen.Content.MediaContent /// /// /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public static string StorageType => "FOLDER_STORAGE_TYPE"; } @@ -809,6 +811,7 @@ namespace Tizen.Content.MediaContent /// /// /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public static class StorageColumns { /// @@ -820,6 +823,7 @@ namespace Tizen.Content.MediaContent /// /// /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public static string Id => "STORAGE_ID"; /// @@ -831,6 +835,7 @@ namespace Tizen.Content.MediaContent /// /// /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public static string Path => "STORAGE_PATH"; /// @@ -843,6 +848,7 @@ namespace Tizen.Content.MediaContent /// /// /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public static string Type => "MEDIA_STORAGE_TYPE"; } } diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Folder.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Folder.cs index 0da577a..841c421 100644 --- a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Folder.cs +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Folder.cs @@ -66,6 +66,7 @@ namespace Tizen.Content.MediaContent /// /// The of the storage that the folder exists. /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public StorageType StorageType { get; } /// @@ -73,6 +74,7 @@ namespace Tizen.Content.MediaContent /// /// The storage ID of the storage that the folder exists. /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public string StorageId { get; } /// diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInfo.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInfo.cs index 38ea5f9..ffcb30f 100644 --- a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInfo.cs +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInfo.cs @@ -186,6 +186,7 @@ namespace Tizen.Content.MediaContent /// /// The storage ID of the storage that the media is stored on. /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public string StorageId { get; } /// @@ -200,6 +201,7 @@ namespace Tizen.Content.MediaContent /// /// The storage type of the storage that the media is stored on. /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public StorageType StorageType { get; } /// diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInfoCommand.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInfoCommand.cs index b474646..fff1dfc 100644 --- a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInfoCommand.cs +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInfoCommand.cs @@ -20,6 +20,7 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using Tizen.System; namespace Tizen.Content.MediaContent { @@ -880,13 +881,16 @@ namespace Tizen.Content.MediaContent using (handle) { - if (InteropHelper.GetValue(handle, Interop.MediaInfo.GetStorageType) == StorageType.ExternalUsb) + var path = InteropHelper.GetString(handle, Interop.MediaInfo.GetFilePath); + + foreach (var extendedInternal in StorageManager.Storages.Where(s => s.StorageType == StorageArea.ExtendedInternal)) { - throw new UnsupportedContentException("The media is in external usb storage."); + if (path.Contains(extendedInternal.RootDirectory)) + { + throw new UnsupportedContentException("The media is in external usb storage."); + } } - var path = InteropHelper.GetString(handle, Interop.MediaInfo.GetFilePath); - if (File.Exists(path) == false) { throw new FileNotFoundException($"The media file does not exist. Path={path}.", path); diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/QueryArguments.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/QueryArguments.cs index 765a740..4f3996f 100644 --- a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/QueryArguments.cs +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/QueryArguments.cs @@ -95,6 +95,7 @@ namespace Tizen.Content.MediaContent /// The storage ID to restrict storage to search, or null for all storages. /// is a zero-length string, contains only white space. /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public string StorageId { get => _storageId; diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Storage.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Storage.cs old mode 100755 new mode 100644 index 621fa1f..d531d51 --- a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Storage.cs +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Storage.cs @@ -26,6 +26,7 @@ namespace Tizen.Content.MediaContent /// in each of the storage by using the storage ID. /// /// 3 + [Obsolete("Please do not use! this will be deprecated in level 6")] public class Storage { internal Storage(IntPtr handle) @@ -42,6 +43,7 @@ namespace Tizen.Content.MediaContent /// /// The unique ID of the storage. /// 3 + [Obsolete("Please do not use! this will be deprecated in level 6")] public string Id { get; } /// @@ -49,6 +51,7 @@ namespace Tizen.Content.MediaContent /// /// The path of the storage. /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public string Path { get; } /// @@ -56,6 +59,7 @@ namespace Tizen.Content.MediaContent /// /// The type of the storage. /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public StorageType Type { get; } /// @@ -63,6 +67,7 @@ namespace Tizen.Content.MediaContent /// /// A string representation of the current storage. /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public override string ToString() => $"Id={Id}, Path={Path}, Type={Type}"; } diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/StorageCommand.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/StorageCommand.cs index 2d91c36..b526226 100644 --- a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/StorageCommand.cs +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/StorageCommand.cs @@ -26,6 +26,7 @@ namespace Tizen.Content.MediaContent /// /// /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public class StorageCommand : MediaCommand { /// @@ -35,6 +36,7 @@ namespace Tizen.Content.MediaContent /// is null. /// has already been disposed of. /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public StorageCommand(MediaDatabase database) : base(database) { } @@ -47,6 +49,7 @@ namespace Tizen.Content.MediaContent /// The has already been disposed of. /// An error occurred while executing the command. /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public int Count() => Count(arguments: null); /// @@ -58,6 +61,7 @@ namespace Tizen.Content.MediaContent /// The has already been disposed of. /// An error occurred while executing the command. /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public int Count(CountArguments arguments) { ValidateDatabase(); @@ -76,6 +80,7 @@ namespace Tizen.Content.MediaContent /// is null. /// is a zero-length string, contains only white space. /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public Storage Select(string storageId) { ValidateDatabase(); @@ -112,6 +117,7 @@ namespace Tizen.Content.MediaContent /// The has already been disposed of. /// An error occurred while executing the command. /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public MediaDataReader Select() => Select(arguments: null); /// @@ -123,6 +129,7 @@ namespace Tizen.Content.MediaContent /// The has already been disposed of. /// An error occurred while executing the command. /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public MediaDataReader Select(SelectArguments arguments) { ValidateDatabase(); @@ -150,6 +157,7 @@ namespace Tizen.Content.MediaContent /// is null. /// is a zero-length string, contains only white space. /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public int CountMedia(string storageId) => CountMedia(storageId, null); /// @@ -164,6 +172,7 @@ namespace Tizen.Content.MediaContent /// is null. /// is a zero-length string, contains only white space. /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public int CountMedia(string storageId, CountArguments arguments) { if (Exists(storageId) == false) @@ -185,6 +194,7 @@ namespace Tizen.Content.MediaContent /// is null. /// is a zero-length string, contains only white space. /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public MediaDataReader SelectMedia(string storageId) => SelectMedia(storageId, null); /// @@ -199,6 +209,7 @@ namespace Tizen.Content.MediaContent /// is null. /// is a zero-length string, contains only white space. /// 4 + [Obsolete("Please do not use! this will be deprecated in level 6")] public MediaDataReader SelectMedia(string storageId, SelectArguments filter) { if (Exists(storageId) == false) -- 2.7.4