Skip to content
jamesheck2019 edited this page Sep 11, 2019 · 15 revisions

Welcome to the MediafireSDK wiki!

Download https://github.com/jamesheck2019/MediafireSDK/releases

NuGet version (BlackBeltCoder.Silk)

List of functions:

  • ChangeFilePrivacy
  • ChangeFolderPrivacy
  • CheckIfFileExist
  • CopyFile
  • CopyFolder
  • CopyMultipleFiles
  • CopyMultipleFolders
  • CreateNewFolder
  • DeleteFile
  • DeleteFolder
  • DeleteMultipleFiles
  • DeleteMultipleFolders
  • DownloadFile
  • DownloadFileAsStream
  • DownloadMultipleFilesAsZip_premium
  • EmptyRecycleBin
  • FileMetadata
  • FolderMetadata
  • Get10MinToken
  • Get2YearToken
  • GetActionToken
  • GetFileLinks
  • GetFilesDownloadUrlAsZip
  • GetMultipleFilesLinks
  • ListFolder
  • ListRecycleBin
  • ListRoot
  • MoveFile
  • MoveFolder
  • MoveMultipleFiles
  • MoveMultipleFolders
  • MultipleFilesMetadata
  • OneTimeUseUrl
  • RenameFile
  • RenameFolder
  • RenewToken
  • RenewToken
  • ReplaceFile
  • ResizeDirectImageUrl
  • RevokeActionToken
  • RootMetadata
  • SearchFolder
  • SearchRoot
  • SpaceQuota
  • TrashFile
  • TrashFolder
  • TrashMultipleFiles
  • TrashMultipleFolders
  • UpdateFile
  • UploadLocalFile
  • UploadRemoteFile
  • UserInfo
  • UserSettings

Code simple:

get 10 min token (auto renewed at the end of the time)

Dim tkn = Await MediafireSDK.GetToken.Get10MinToken("user", "pass")

set client

Dim Clnt As MediafireSDK.IClient = New MediafireSDK.MClient("token", "user", "pass")

list root files/folders

Dim RSLT = Await Clnt.ListRoot(fileOrFolder, Nothing, FoldersFilterEnum.public, Nothing, FoldersOrderByEnum.name, SortEnum.asc, 500, 1)
For Each onz In RSLT.response.folder_content.FoldersList
   DataGridView1.Rows.Add(onz.name, onz.FolderID, onz.total_files, onz.total_folders, onz.total_size, onz.folder_count, onz.file_count)
Next
For Each onz In RSLT.response.folder_content.FilesList
   DataGridView1.Rows.Add(onz.name, onz.FileID, ISisFunctions.Bytes_To_KbMbGb.SetBytes(onz.size), onz.filetype, onz.mimetype, onz.ImgUrl, onz.links.normal_download)
Next

upload local file (without progress tracking)

Dim UploadCancellationToken As New Threading.CancellationTokenSource()
Dim RSLT = Clnt.UploadLocalFile("C:\ureWiz.png", UploadTypes.FilePath, "DestinationFolderID", "ureWiz.png", IfAlreadyExist.keep, nothing, UploadCancellationToken.Token)

upload local file with progress tracking

Dim UploadCancellationToken As New Threading.CancellationTokenSource()
Dim prog_ReportCls As New Progress(Of MediafireSDK.ReportStatus)(Sub(ReportClass As MediafireSDK.ReportStatus)
                   Label1.Text = String.Format("{0}/{1}", (ReportClass.BytesTransferred), (ReportClass.TotalBytes))
                   ProgressBar1.Value = CInt(ReportClass.ProgressPercentage)
                   Label2.Text = CStr(ReportClass.TextStatus)
                   End Sub)
Dim RSLT = Clnt.UploadLocalFile("C:\ureWiz.png", UploadTypes.FilePath, "DestinationFolderID", "ureWiz.png", IfAlreadyExist.keep, prog_ReportCls , UploadCancellationToken.Token)
Clone this wiki locally