Skip to content

Commit

Permalink
修复folder拼写错误。
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjusss committed Feb 14, 2019
1 parent f96de3c commit fd55154
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
8 changes: 4 additions & 4 deletions 1fichier.SDK.Test/ClientTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ public void MethodClean()
[TestMethod]
public async Task UploadFilesTest()
{
var root = await _client.ListFloder(0, true);
var root = await _client.ListFolder(0, true);
if (root.sub_folders != null)
{
foreach (var i in root.sub_folders)
{
if (i.name == "test")
{
await _client.RemoveFloder(i.id, true);
await _client.RemoveFolder(i.id, true);
}
}
}

int targetDir = await _client.MakeFloder("test");
int targetDir = await _client.MakeFolder("test");

Dictionary<string, Stream> files2Upload = new Dictionary<string, Stream>();
DirectoryInfo di = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory);
Expand Down Expand Up @@ -90,7 +90,7 @@ public async Task UploadFilesTest()
}

Thread.Sleep(20 * 1000);//一个文件夹被上传文件后数秒内不能被删除。
await _client.RemoveFloder(targetDir, true);
await _client.RemoveFolder(targetDir, true);
}
}
}
4 changes: 2 additions & 2 deletions 1fichier.SDK/1fichier.SDK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>_1fichier.SDK</RootNamespace>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.1.0</Version>
<Version>0.1.1</Version>
<Authors>sanjusss</Authors>
<Company />
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
Expand All @@ -15,7 +15,7 @@
<AssemblyVersion>0.1.0.0</AssemblyVersion>
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
<Description>Dotnet SDK for 1fichier.com.</Description>
<PackageReleaseNotes>增加上传文件和列文件夹的功能。</PackageReleaseNotes>
<PackageReleaseNotes>修复folder拼写错误。</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup>
Expand Down
20 changes: 10 additions & 10 deletions 1fichier.SDK/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,25 +305,25 @@ public async Task<IEnumerable<UploadResult>> UploadFiles(Dictionary<string, Stre
/// <summary>
/// 列出文件夹。
/// </summary>
/// <param name="floder">文件夹ID</param>
/// <param name="folder">文件夹ID</param>
/// <param name="listFiles">是否列出当前目录下的文件</param>
/// <returns>文件夹信息。</returns>
/// <exception cref="InvalidApiKeyException">非法的API Key。</exception>
/// <exception cref="CommonException">服务器返回的错误。</exception>
public async Task<FloderInfo> ListFloder(int floder, bool listFiles = false)
public async Task<FolderInfo> ListFolder(int folder, bool listFiles = false)
{
await WaitToOperation();
using (var http = GetHttpClient(true))
{
var request = new
{
folder_id = floder,
folder_id = folder,
files = listFiles ? 1 : 0
};
var response = await http.PostAsync("https://api.1fichier.com/v1/folder/ls.cgi", GetJsonContent(request));
string json = await response.Content.ReadAsStringAsync();
CheckResponse(json);
return JsonConvert.DeserializeObject<FloderInfo>(json);
return JsonConvert.DeserializeObject<FolderInfo>(json);
}
}

Expand All @@ -336,7 +336,7 @@ public async Task<FloderInfo> ListFloder(int floder, bool listFiles = false)
/// <returns>新文件夹ID</returns>
/// <exception cref="InvalidApiKeyException">非法的API Key。</exception>
/// <exception cref="CommonException">服务器返回的错误。</exception>
public async Task<int> MakeFloder(string name, int parent = 0, string sharingUser = null)
public async Task<int> MakeFolder(string name, int parent = 0, string sharingUser = null)
{
await WaitToOperation();
using (var http = GetHttpClient(true))
Expand All @@ -358,20 +358,20 @@ public async Task<int> MakeFloder(string name, int parent = 0, string sharingUse
/// <summary>
/// 删除指定文件夹。
/// </summary>
/// <param name="floder">目标文件夹ID</param>
/// <param name="folder">目标文件夹ID</param>
/// <param name="recursively">递归删除子文件夹和子文件,将耗费更多时间。</param>
/// <exception cref="InvalidApiKeyException">非法的API Key。</exception>
/// <exception cref="CommonException">服务器返回的错误。</exception>
public async Task RemoveFloder(int floder, bool recursively = false)
public async Task RemoveFolder(int folder, bool recursively = false)
{
if (recursively)
{
var info = await ListFloder(floder, true);
var info = await ListFolder(folder, true);
if (info.sub_folders != null)
{
foreach (var i in info.sub_folders)
{
await RemoveFloder(i.id, true);
await RemoveFolder(i.id, true);
}
}

Expand All @@ -395,7 +395,7 @@ public async Task RemoveFloder(int floder, bool recursively = false)
{
var request = new
{
folder_id = floder
folder_id = folder
};
var response = await http.PostAsync("https://api.1fichier.com/v1/folder/rm.cgi", GetJsonContent(request));
string json = await response.Content.ReadAsStringAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace _1fichier.SDK.Result
/// <summary>
/// 文件夹下的文件信息
/// </summary>
public struct FloderFileInfo
public struct FolderFileInfo
{
/// <summary>
/// 文件是否处于保护模式(限制IP、国家、用户或使用者)。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace _1fichier.SDK.Result
/// <summary>
/// 文件夹信息
/// </summary>
public struct FloderInfo
public struct FolderInfo
{
/// <summary>
/// 文件夹状态
Expand Down Expand Up @@ -44,14 +44,14 @@ public struct FloderInfo
/// <summary>
/// 子文件夹的集合
/// </summary>
public IEnumerable<SubFloderInfo> sub_folders;
public IEnumerable<SubFolderInfo> sub_folders;
/// <summary>
/// 当前目录下的文件数量
/// </summary>
public int files;
/// <summary>
/// 当前目录下的文件的集合
/// </summary>
public IEnumerable<FloderFileInfo> items;
public IEnumerable<FolderFileInfo> items;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace _1fichier.SDK.Result
/// <summary>
/// 子文件夹信息
/// </summary>
public struct SubFloderInfo
public struct SubFolderInfo
{
/// <summary>
/// 文件夹ID
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

version: 0.1.0.{build}
version: 0.1.1.{build}
image: Visual Studio 2017
clone_depth: 1
environment:
Expand Down

0 comments on commit fd55154

Please sign in to comment.