Release 9.0.0.16887
[platform/core/csapi/tizenfx.git] / src / Tizen.Applications.PackageManager / Tizen.Applications / PackageSizeInformation.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 using System;
18
19 namespace Tizen.Applications
20 {
21     /// <summary>
22     /// This class has read-only properties to get the package size information.
23     /// </summary>
24     /// <since_tizen> 3 </since_tizen>
25     public class PackageSizeInformation
26     {
27         private long _dataSize;
28         private long _cacheSize;
29         private long _appSize;
30         private long _externalDataSize;
31         private long _externalCacheSize;
32         private long _externalAppSize;
33
34         private PackageSizeInformation() { }
35
36         /// <summary>
37         /// Data size for the package.
38         /// </summary>
39         /// <since_tizen> 3 </since_tizen>
40         public long DataSize { get { return _dataSize; } }
41
42         /// <summary>
43         /// Cache size for the package.
44         /// </summary>
45         /// <since_tizen> 3 </since_tizen>
46         public long CacheSize { get { return _cacheSize; } }
47
48         /// <summary>
49         /// Application size for the package.
50         /// </summary>
51         /// <since_tizen> 3 </since_tizen>
52         public long AppSize { get { return _appSize; } }
53
54         /// <summary>
55         /// External data size for the package.
56         /// </summary>
57         /// <since_tizen> 3 </since_tizen>
58         public long ExternalDataSize { get { return _externalDataSize; } }
59
60         /// <summary>
61         /// External cache size for the package.
62         /// </summary>
63         /// <since_tizen> 3 </since_tizen>
64         public long ExternalCacheSize { get { return _externalCacheSize; } }
65
66         /// <summary>
67         /// External application size for the package.
68         /// </summary>
69         /// <since_tizen> 3 </since_tizen>
70         public long ExternalAppSize { get { return _externalAppSize; } }
71
72         // This method assumes that pass handle is already validated
73         internal static PackageSizeInformation GetPackageSizeInformation(IntPtr handle)
74         {
75             var pkgSizeInfo = new PackageSizeInformation();
76             Interop.PackageManager.PackageSizeInfoGetDataSize(handle, out pkgSizeInfo._dataSize);
77             Interop.PackageManager.PackageSizeInfoGetCacheSize(handle, out pkgSizeInfo._cacheSize);
78             Interop.PackageManager.PackageSizeInfoGetAppSize(handle, out pkgSizeInfo._appSize);
79             Interop.PackageManager.PackageSizeInfoGetExtDataSize(handle, out pkgSizeInfo._externalDataSize);
80             Interop.PackageManager.PackageSizeInfoGetExtCacheSize(handle, out pkgSizeInfo._externalCacheSize);
81             Interop.PackageManager.PackageSizeInfoGetExtAppSize(handle, out pkgSizeInfo._externalAppSize);
82             return pkgSizeInfo;
83         }
84     }
85 }