Skip to content

loudKode/AllwayCloudSDK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

AllwayCloudSDK

Download:https://github.com/loudKode/AllwayCloudSDK/releases
NuGet: NuGet

Features

  • Assemblies for .NET 4.5.2 and .NET Standard 2.0 and .NET Core 2.1
  • Just one external reference (Newtonsoft.Json)
  • Easy installation using NuGet
  • Upload/Download tracking support
  • Proxy Support
  • Upload/Download cancellation support

Functions:

  • UserInfo
  • List
  • CreateNewFolder
  • Upload
  • DeleteFile
  • DeleteFolder
  • GetDownloadUrl
  • GetMultipleDownloadUrl
  • DownloadFile
  • DownloadFileAsStream
  • RenameFile
  • RenameFolder

Example:

get token

    Async Sub GetToken()
        Dim tkn = Await AllwayCloudSDK.GetToken.Login("user", "pass")
        DataGridView1.Rows.Add(tkn.PROFILE.DisplayName, tkn.PROFILE.TotalStorage, tkn.PROFILE.UsedStorage, tkn.SID, tkn.UID)
    End Sub
    Sub SetClient()
        Dim MyClient As AllwayCloudSDK.IClient = New AllwayCloudSDK.AClient("tkn.SID", "tkn.UID", "access token")
    End Sub
    Sub SetClientWithOptions()
        Dim Optians As New AllwayCloudSDK.ConnectionSettings With {.CloseConnection = True, .TimeOut = TimeSpan.FromMinutes(30), .Proxy = New AllwayCloudSDK.ProxyConfig With {.ProxyIP = "172.0.0.0", .ProxyPort = 80, .ProxyUsername = "myname", .ProxyPassword = "myPass", .SetProxy = True}}
        Dim MyClient As AllwayCloudSDK.IClient = New AllwayCloudSDK.AClient("tkn.SID", "tkn.UID", "access token", Optians)
    End Sub
    Async Sub ListMyFilesAndFolders()
        Dim result = Await MyClient.List("path", SortByEnum.dir)
        For Each vid In result.FilesList
            DataGridView1.Rows.Add(vid.name, vid.Path, vid.size, vid.ModifiedDate)
        Next
        For Each vid In result.FoldersList
            DataGridView1.Rows.Add(vid.name, vid.Path, vid.size, vid.ModifiedDate)
        Next
    End Sub
    Async Sub DeleteFileOrFolder()
        Dim result = Await MyClient.DeleteFile("file path")
        Dim resultD = Await MyClient.DeleteFolder("folder path")
    End Sub
    Async Sub CreateNewFolder()
        Dim result = Await MyClient.CreateNewFolder("parent folder path", "new folder name")
    End Sub
    Async Sub RenameFile()
        Dim result = Await MyClient.RenameFile("file path", "new file name")
        Dim resultD = Await MyClient.RenameFolder("folder path", "new folder name")
    End Sub
    Async Sub Upload_Local_WithProgressTracking()
        Dim UploadCancellationToken As New Threading.CancellationTokenSource()
        Dim _ReportCls As New Progress(Of AllwayCloudSDK.ReportStatus)(Sub(ReportClass As AllwayCloudSDK.ReportStatus)
                                                                           Label1.Text = String.Format("{0}/{1}", (ReportClass.BytesTransferred), (ReportClass.TotalBytes))
                                                                           ProgressBar1.Value = CInt(ReportClass.ProgressPercentage)
                                                                           Label2.Text = CStr(ReportClass.TextStatus)
                                                                       End Sub)
        Await MyClient.Upload("J:\DB\myvideo.mp4", SentType.FilePath, "myvideo.mp4", "tste/here", _ReportCls, UploadCancellationToken.Token)
    End Sub
    Async Sub Download_File_WithProgressTracking()
        Dim DownloadCancellationToken As New Threading.CancellationTokenSource()
        Dim _ReportCls As New Progress(Of AllwayCloudSDK.ReportStatus)(Sub(ReportClass As AllwayCloudSDK.ReportStatus)
                                                                           Label1.Text = String.Format("{0}/{1}", (ReportClass.BytesTransferred), (ReportClass.TotalBytes))
                                                                           ProgressBar1.Value = CInt(ReportClass.ProgressPercentage)
                                                                           Label2.Text = CStr(ReportClass.TextStatus)
                                                                       End Sub)
        Dim FUrl = Await MyClient.GetDownloadUrl("file path")
        Await MyClient.DownloadFile(FUrl.DOWNLOAD_LINK, "J:\DB\", "myvideo.mp4", _ReportCls, DownloadCancellationToken.Token)
    End Sub