[MediaContent] Deprecate Storage API (#807)
authorhsgwon <haesu.gwon@samsung.com>
Tue, 30 Apr 2019 01:19:45 +0000 (10:19 +0900)
committerGitHub <noreply@github.com>
Tue, 30 Apr 2019 01:19:45 +0000 (10:19 +0900)
src/Tizen.Content.MediaContent/Tizen.Content.MediaContent.csproj
src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Columns.cs
src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Folder.cs
src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInfo.cs
src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInfoCommand.cs
src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/QueryArguments.cs
src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Storage.cs [changed mode: 0755->0644]
src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/StorageCommand.cs

index fbac841..7a96416 100644 (file)
@@ -5,6 +5,7 @@
   </PropertyGroup>
 
   <ItemGroup>
+    <ProjectReference Include="..\Tizen.System.Storage\Tizen.System.Storage.csproj" />
     <ProjectReference Include="..\Tizen\Tizen.csproj" />
     <ProjectReference Include="..\Tizen.Log\Tizen.Log.csproj" />
     <ProjectReference Include="..\Tizen.System.Information\Tizen.System.Information.csproj" />
index 819fe5a..3d4f35c 100644 (file)
@@ -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
         /// </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>
@@ -603,6 +604,7 @@ namespace Tizen.Content.MediaContent
         /// </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";
     }
 
@@ -809,6 +811,7 @@ namespace Tizen.Content.MediaContent
     /// <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>
@@ -820,6 +823,7 @@ namespace Tizen.Content.MediaContent
         /// </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>
@@ -831,6 +835,7 @@ namespace Tizen.Content.MediaContent
         /// </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>
@@ -843,6 +848,7 @@ namespace Tizen.Content.MediaContent
         /// </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";
     }
 }
index 0da577a..841c421 100644 (file)
@@ -66,6 +66,7 @@ namespace Tizen.Content.MediaContent
         /// </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>
@@ -73,6 +74,7 @@ namespace Tizen.Content.MediaContent
         /// </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; }
 
         /// <summary>
index 38ea5f9..ffcb30f 100644 (file)
@@ -186,6 +186,7 @@ namespace Tizen.Content.MediaContent
         /// </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>
@@ -200,6 +201,7 @@ namespace Tizen.Content.MediaContent
         /// </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>
index b474646..fff1dfc 100644 (file)
@@ -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<StorageType>(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);
index 765a740..4f3996f 100644 (file)
@@ -95,6 +95,7 @@ namespace Tizen.Content.MediaContent
         /// <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;
old mode 100755 (executable)
new mode 100644 (file)
index 621fa1f..d531d51
@@ -26,6 +26,7 @@ namespace Tizen.Content.MediaContent
     /// 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)
@@ -42,6 +43,7 @@ namespace Tizen.Content.MediaContent
         /// </summary>
         /// <value>The unique ID of the storage.</value>
         /// <since_tizen> 3 </since_tizen>
+        [Obsolete("Please do not use! this will be deprecated in level 6")]
         public string Id { get; }
 
         /// <summary>
@@ -49,6 +51,7 @@ namespace Tizen.Content.MediaContent
         /// </summary>
         /// <value>The path of the storage.</value>
         /// <since_tizen> 4 </since_tizen>
+        [Obsolete("Please do not use! this will be deprecated in level 6")]
         public string Path { get; }
 
         /// <summary>
@@ -56,6 +59,7 @@ namespace Tizen.Content.MediaContent
         /// </summary>
         /// <value>The type of the storage.</value>
         /// <since_tizen> 4 </since_tizen>
+        [Obsolete("Please do not use! this will be deprecated in level 6")]
         public StorageType Type { get; }
 
         /// <summary>
@@ -63,6 +67,7 @@ namespace Tizen.Content.MediaContent
         /// </summary>
         /// <returns>A string representation of the current storage.</returns>
         /// <since_tizen> 4 </since_tizen>
+        [Obsolete("Please do not use! this will be deprecated in level 6")]
         public override string ToString() =>
             $"Id={Id}, Path={Path}, Type={Type}";
     }
index 2d91c36..b526226 100644 (file)
@@ -26,6 +26,7 @@ namespace Tizen.Content.MediaContent
     /// </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>
@@ -35,6 +36,7 @@ namespace Tizen.Content.MediaContent
         /// <exception cref="ArgumentNullException"><paramref name="database"/> is null.</exception>
         /// <exception cref="ObjectDisposedException"><paramref name="database"/> has already been disposed of.</exception>
         /// <since_tizen> 4 </since_tizen>
+        [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
         /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</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>
@@ -58,6 +61,7 @@ namespace Tizen.Content.MediaContent
         /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</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();
@@ -76,6 +80,7 @@ namespace Tizen.Content.MediaContent
         /// <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();
@@ -112,6 +117,7 @@ namespace Tizen.Content.MediaContent
         /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</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>
@@ -123,6 +129,7 @@ namespace Tizen.Content.MediaContent
         /// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</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();
@@ -150,6 +157,7 @@ namespace Tizen.Content.MediaContent
         /// <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>
@@ -164,6 +172,7 @@ namespace Tizen.Content.MediaContent
         /// <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)
@@ -185,6 +194,7 @@ namespace Tizen.Content.MediaContent
         /// <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>
@@ -199,6 +209,7 @@ namespace Tizen.Content.MediaContent
         /// <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)