[Application.Common] Add internal APIs for getting path related resource control...
[platform/core/csapi/tizenfx.git] / src / Tizen.Applications.Common / Tizen.Applications / DirectoryInfo.cs
index cceaba4..d722df7 100644 (file)
  * limitations under the License.
  */
 
+using System;
+using System.ComponentModel;
+using System.IO;
+
 namespace Tizen.Applications
 {
     /// <summary>
@@ -180,5 +184,75 @@ namespace Tizen.Applications
                 return _expansionPackageResourcePath;
             }
         }
+
+        /// <summary>
+        /// Gets the absolute path to the application's resource control directory, which is used to share the allowed resources of the resource packages.
+        /// </summary>
+        /// <param name="resourceType">The resource type defined in the resource package</param>
+        /// <returns> The absolute path to the application's resource control directory, which is used to share the allowed resources of the resource packages.</returns>
+        /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
+        /// <exception cref="OutOfMemoryException">Thrown in case of out of memory.</exception>
+        /// <exception cref="DirectoryNotFoundException">Thrown in case of nonexistence of resource.</exception>
+        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
+        /// <since_tizen> 10 </since_tizen>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public string GetResourceControlAllowedResource(string resourceType)
+        {
+            string path = string.Empty;
+            Interop.AppCommon.AppCommonErrorCode err = Interop.AppCommon.AppGetResControlAllowedResourcePath(resourceType, out path);
+            if (err != Interop.AppCommon.AppCommonErrorCode.None)
+            {
+                switch (err)
+                {
+                    case Interop.AppCommon.AppCommonErrorCode.InvalidParameter:
+                        throw new ArgumentException("Invalid Arguments");
+                    case Interop.AppCommon.AppCommonErrorCode.OutOfMemory:
+                        throw new OutOfMemoryException("Out of memory");
+                    case Interop.AppCommon.AppCommonErrorCode.InvalidContext:
+                        throw new InvalidOperationException("Invalid app context");
+                    case Interop.AppCommon.AppCommonErrorCode.PermissionDenied:
+                        throw new DirectoryNotFoundException(String.Format("Allowed Resource about {0} is not Found", resourceType));
+                    default:
+                        throw new InvalidOperationException("Invalid Operation");
+                }
+            }
+
+            return path;
+        }
+
+        /// <summary>
+        /// Gets the absolute path to the application's resource control directory, which is used to share the global resources of the resource packages.
+        /// </summary>
+        /// <param name="resourceType">The resource type defined in the resource package</param>
+        /// <returns> The absolute path to the application's resource control directory, which is used to share the global resources of the resource packages.</returns>
+        /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
+        /// <exception cref="OutOfMemoryException">Thrown in case of out of memory.</exception>
+        /// <exception cref="DirectoryNotFoundException">Thrown in case of nonexistence of resource.</exception>
+        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
+        /// <since_tizen> 10 </since_tizen>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public string GetResourceControlGlobalResource(string resourceType)
+        {
+            string path = string.Empty;
+            Interop.AppCommon.AppCommonErrorCode err = Interop.AppCommon.AppGetResControlGlobalResourcePath(resourceType, out path);
+            if (err != Interop.AppCommon.AppCommonErrorCode.None)
+            {
+                switch (err)
+                {
+                    case Interop.AppCommon.AppCommonErrorCode.InvalidParameter:
+                        throw new ArgumentException("Invalid Arguments");
+                    case Interop.AppCommon.AppCommonErrorCode.OutOfMemory:
+                        throw new OutOfMemoryException("Out of memory");
+                    case Interop.AppCommon.AppCommonErrorCode.InvalidContext:
+                        throw new InvalidOperationException("Invalid app context");
+                    case Interop.AppCommon.AppCommonErrorCode.PermissionDenied:
+                        throw new DirectoryNotFoundException(String.Format("Allowed Resource about {0} is not Found", resourceType));
+                    default:
+                        throw new InvalidOperationException("Invalid Operation");
+                }
+            }
+
+            return path;
+        }
     }
 }