Revert "Add Test cases for app shortcut, managedapps"
[profile/tv/apps/dotnet/home.git] / LibTVRefCommonPortable / Utils / IFileSystemAPIs.cs
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.1 (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://floralicense.org/license/
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 using System.Collections.Generic;
19 using System.Linq;
20 using System.Text;
21 using System.Threading.Tasks;
22 using System.IO;
23
24 namespace LibTVRefCommonPortable.Utils
25 {
26     /// <summary>
27     /// An enumeration for the file open mode.
28     /// </summary>
29     public enum UtilFileMode
30     {
31         CreateNew = 1,
32         Create = 2,
33         Open = 3,
34         OpenOrCreate = 4,
35         Truncate = 5,
36         Append = 6
37     }
38
39     /// <summary>
40     /// An interface for the file operations
41     /// </summary>
42     public interface IFileSystemAPIs
43     {
44         /// <summary>
45         /// A directory path which should be used for app data storing.
46         /// </summary>
47         string AppDataStorage
48         {
49             get;
50         }
51
52         /// <summary>
53         /// A directory path which should be used for app resource storing.
54         /// </summary>
55         string AppResourceStorage
56         {
57             get;
58         }
59
60         /// <summary>
61         /// A directory path which should be used for sharing between apps.
62         /// </summary>
63         string PlatformShareStorage
64         {
65             get;
66         }
67
68         /// <summary>
69         /// A method opens a file on the given mode.
70         /// </summary>
71         /// <param name="filePath">A file path</param>
72         /// <param name="mode">An opening mode</param>
73         /// <returns>A file descriptor</returns>
74         Stream OpenFile(string filePath, UtilFileMode mode);
75
76         /// <summary>
77         /// A method flushing the stream to write remains.
78         /// </summary>
79         /// <param name="stream">A file descriptor</param>
80         void Flush(Stream stream);
81
82         /// <summary>
83         /// A method closes the file.
84         /// </summary>
85         /// <param name="stream">A file descriptor</param>
86         void CloseFile(Stream stream);
87
88         /// <summary>
89         /// A method checks if a file existence in the file system.
90         /// </summary>
91         /// <param name="filePath">A file path</param>
92         /// <returns>An existence of the file</returns>
93         bool IsFileExist(String filePath);
94
95         /// <summary>
96         /// A method checks if file is read to use.
97         /// </summary>
98         /// <param name="filePath">A file path</param>
99         /// <returns>A status of ready</returns>
100         bool IsFileReady(String filePath);
101     }
102 }