wasDAVClient – Diff between revs 5 and 8
?pathlinks?
Rev 5 | Rev 8 | |||
---|---|---|---|---|
1 | /////////////////////////////////////////////////////////////////////////// |
1 | /////////////////////////////////////////////////////////////////////////// |
|
2 | // Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 // |
2 | // Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 // |
|
3 | // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // |
3 | // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // |
|
4 | // rights of fair usage, the disclaimer and warranty conditions. // |
4 | // rights of fair usage, the disclaimer and warranty conditions. // |
|
5 | /////////////////////////////////////////////////////////////////////////// |
5 | /////////////////////////////////////////////////////////////////////////// |
|
6 | // Originally based on: WebDAV .NET client by Sergey Kazantsev |
6 | // Originally based on: WebDAV .NET client by Sergey Kazantsev |
|
7 | |
7 | |
|
8 | using System.Collections.Generic; |
8 | using System.Collections.Generic; |
|
9 | using System.IO; |
9 | using System.IO; |
|
10 | using System.Threading.Tasks; |
10 | using System.Threading.Tasks; |
|
11 | using wasDAVClient.Model; |
11 | using wasDAVClient.Model; |
|
12 | |
12 | |
|
13 | namespace wasDAVClient |
13 | namespace wasDAVClient |
|
14 | { |
14 | { |
|
15 | public interface IClient |
15 | public interface IClient |
|
16 | { |
16 | { |
|
17 | /// <summary> |
17 | /// <summary> |
|
18 | /// Specify the WebDAV hostname (required). |
18 | /// Specify the WebDAV hostname (required). |
|
19 | /// </summary> |
19 | /// </summary> |
|
20 | string Server { get; set; } |
20 | string Server { get; set; } |
|
21 | |
21 | |
|
22 | /// <summary> |
22 | /// <summary> |
|
23 | /// Specify the path of a WebDAV directory to use as 'root' (default: /) |
23 | /// Specify the path of a WebDAV directory to use as 'root' (default: /) |
|
24 | /// </summary> |
24 | /// </summary> |
|
25 | string BasePath { get; set; } |
25 | string BasePath { get; set; } |
|
26 | |
26 | |
|
27 | /// <summary> |
27 | /// <summary> |
|
28 | /// Specify an port (default: null = auto-detect) |
28 | /// Specify an port (default: null = auto-detect) |
|
29 | /// </summary> |
29 | /// </summary> |
|
30 | int? Port { get; set; } |
30 | int? Port { get; set; } |
|
31 | |
31 | |
|
32 | /// <summary> |
32 | /// <summary> |
|
33 | /// Specify the UserAgent (and UserAgent version) string to use in requests |
33 | /// Specify the UserAgent (and UserAgent version) string to use in requests |
|
34 | /// </summary> |
34 | /// </summary> |
|
35 | string UserAgent { get; set; } |
35 | string UserAgent { get; set; } |
|
36 | |
36 | |
|
37 | /// <summary> |
37 | /// <summary> |
|
38 | /// Specify the UserAgent (and UserAgent version) string to use in requests |
38 | /// Specify the UserAgent (and UserAgent version) string to use in requests |
|
39 | /// </summary> |
39 | /// </summary> |
|
40 | string UserAgentVersion { get; set; } |
40 | string UserAgentVersion { get; set; } |
|
41 | |
- | ||
42 | |
41 | |
|
43 | /// <summary> |
42 | /// <summary> |
|
44 | /// List all files present on the server. |
43 | /// List all files present on the server. |
|
45 | /// </summary> |
44 | /// </summary> |
|
46 | /// <param name="path">List only files in this path</param> |
45 | /// <param name="path">List only files in this path</param> |
|
47 | /// <param name="depth">Recursion depth</param> |
46 | /// <param name="depth">Recursion depth</param> |
|
48 | /// <returns>A list of files (entries without a trailing slash) and directories (entries with a trailing slash)</returns> |
47 | /// <returns>A list of files (entries without a trailing slash) and directories (entries with a trailing slash)</returns> |
|
49 | Task<IEnumerable<Item>> List(string path = "/", int? depth = 1); |
48 | Task<IEnumerable<Item>> List(string path = Constants.DIRECTORY_SEPARATOR, string depth = Constants.DavDepth.MEMBERS); |
|
50 | |
49 | |
|
51 | /// <summary> |
50 | /// <summary> |
|
52 | /// Get folder information from the server. |
51 | /// Get folder information from the server. |
|
53 | /// </summary> |
52 | /// </summary> |
|
54 | /// <returns>A list of files (entries without a trailing slash) and directories (entries with a trailing slash)</returns> |
53 | /// <returns>A list of files (entries without a trailing slash) and directories (entries with a trailing slash)</returns> |
|
55 | Task<Item> GetFolder(string path = "/"); |
54 | Task<Item> GetFolder(string path = Constants.DIRECTORY_SEPARATOR); |
|
56 | |
55 | |
|
57 | /// <summary> |
56 | /// <summary> |
|
58 | /// Get file information from the server. |
57 | /// Get file information from the server. |
|
59 | /// </summary> |
58 | /// </summary> |
|
60 | /// <returns>A list of files (entries without a trailing slash) and directories (entries with a trailing slash)</returns> |
59 | /// <returns>A list of files (entries without a trailing slash) and directories (entries with a trailing slash)</returns> |
|
61 | Task<Item> GetFile(string path = "/"); |
60 | Task<Item> GetFile(string path = Constants.DIRECTORY_SEPARATOR); |
|
62 | |
61 | |
|
63 | /// <summary> |
62 | /// <summary> |
|
64 | /// Download a file from the server |
63 | /// Download a file from the server |
|
65 | /// </summary> |
64 | /// </summary> |
|
66 | /// <param name="remoteFilePath">Source path and filename of the file on the server</param> |
65 | /// <param name="remoteFilePath">Source path and filename of the file on the server</param> |
|
67 | Task<Stream> Download(string remoteFilePath); |
66 | Task<Stream> Download(string remoteFilePath); |
|
68 | |
67 | |
|
69 | /// <summary> |
68 | /// <summary> |
|
70 | /// Download a file from the server |
69 | /// Download a file from the server |
|
71 | /// </summary> |
70 | /// </summary> |
|
72 | /// <param name="remoteFilePath">Source path and filename of the file on the server</param> |
71 | /// <param name="remoteFilePath">Source path and filename of the file on the server</param> |
|
73 | /// <param name="content"></param> |
72 | /// <param name="content"></param> |
|
74 | /// <param name="name"></param> |
73 | /// <param name="name"></param> |
|
75 | Task<bool> Upload(string remoteFilePath, Stream content, string name); |
74 | Task<bool> Upload(string remoteFilePath, Stream content, string name); |
|
76 | |
75 | |
|
77 | /// <summary> |
76 | /// <summary> |
|
78 | /// Create a directory on the server |
77 | /// Create a directory on the server |
|
79 | /// </summary> |
78 | /// </summary> |
|
80 | /// <param name="remotePath">Destination path of the directory on the server</param> |
79 | /// <param name="remotePath">Destination path of the directory on the server</param> |
|
81 | /// <param name="name"></param> |
80 | /// <param name="name"></param> |
|
82 | Task<bool> CreateDir(string remotePath, string name); |
81 | Task<bool> CreateDir(string remotePath, string name); |
|
83 | |
82 | |
|
84 | /// <summary> |
83 | /// <summary> |
|
85 | /// Get folder information from the server. |
84 | /// Get folder information from the server. |
|
86 | /// </summary> |
85 | /// </summary> |
|
87 | /// <returns>A list of files (entries without a trailing slash) and directories (entries with a trailing slash)</returns> |
86 | /// <returns>A list of files (entries without a trailing slash) and directories (entries with a trailing slash)</returns> |
|
88 | Task DeleteFolder(string path = "/"); |
87 | Task DeleteFolder(string path = Constants.DIRECTORY_SEPARATOR); |
|
89 | |
88 | |
|
90 | /// <summary> |
89 | /// <summary> |
|
91 | /// Get file information from the server. |
90 | /// Get file information from the server. |
|
92 | /// </summary> |
91 | /// </summary> |
|
93 | /// <returns>A list of files (entries without a trailing slash) and directories (entries with a trailing slash)</returns> |
92 | /// <returns>A list of files (entries without a trailing slash) and directories (entries with a trailing slash)</returns> |
|
94 | Task DeleteFile(string path = "/"); |
93 | Task DeleteFile(string path = Constants.DIRECTORY_SEPARATOR); |
|
95 | |
94 | |
|
96 | /// <summary> |
95 | /// <summary> |
|
97 | /// Move a folder on the server |
96 | /// Move a folder on the server |
|
98 | /// </summary> |
97 | /// </summary> |
|
99 | /// <param name="srcFolderPath">Source path of the folder on the server</param> |
98 | /// <param name="srcFolderPath">Source path of the folder on the server</param> |
|
100 | /// <param name="dstFolderPath">Destination path of the folder on the server</param> |
99 | /// <param name="dstFolderPath">Destination path of the folder on the server</param> |
|
101 | Task<bool> MoveFolder(string srcFolderPath, string dstFolderPath); |
100 | Task<bool> MoveFolder(string srcFolderPath, string dstFolderPath); |
|
102 | |
101 | |
|
103 | /// <summary> |
102 | /// <summary> |
|
104 | /// Move a file on the server |
103 | /// Move a file on the server |
|
105 | /// </summary> |
104 | /// </summary> |
|
106 | /// <param name="srcFilePath">Source path and filename of the file on the server</param> |
105 | /// <param name="srcFilePath">Source path and filename of the file on the server</param> |
|
107 | /// <param name="dstFilePath">Destination path and filename of the file on the server</param> |
106 | /// <param name="dstFilePath">Destination path and filename of the file on the server</param> |
|
108 | Task<bool> MoveFile(string srcFilePath, string dstFilePath); |
107 | Task<bool> MoveFile(string srcFilePath, string dstFilePath); |
|
109 | } |
108 | } |
|
110 | } |
- | ||
111 | |
109 | } |
|
- | 110 | |
||
112 |
|
- | ||
113 | |
- | ||
114 | |
- | ||
115 | |
- |