/// <summary> /// Illustrate of work... /// </summary> public void OtherWork() { // Login to Ge.tt var user = new Gett.Sharing.GettUser(); user.Login("myapikey", "mymail@local", "mypassword"); // Find specefic share Gett.Sharing.GettShare share1 = user.Shares.GetShare("9XwUVrB"); // Create new file on share. Gett.Sharing.GettFile file1 = share1.CreateFile("mybackup.sql"); // Start upload new file file1.UploadFile(@"d:\mysqlbackupdump\today.sql"); // Get all shares with most files count in it ordered var shareWithMostfiles = from share in user.Shares.GetShares() where share.FilesInfo.Length > 0 orderby share.FilesInfo.Length descending select share; // Get all shares with the largeste files var shareWithTheLargestFileSize = from share in user.Shares.GetShares() where share.FilesInfo.Length > 0 orderby share.FilesInfo.Max(f => f.Size) descending select share; // Begin async upload of file Gett.Sharing.GettFile file2 = share1.CreateFile("contacts.sql"); file2.BeginUploadFile(@"d:\mysqlbackupdump\contacts.sql", UploadFileCompleted, file2); // Begin async download of file file1.BeginDownloadFile(@"d:\download\today.sql", file1.EndDownloadFile, null); }
/// <summary> /// Illustrate of more work... /// </summary> public void OtherWork2() { // Login to Ge.tt var user = new Gett.Sharing.GettUser(); user.Login("myapikey", "mymail@local", "mypassword"); // Create new share Gett.Sharing.GettShare share1 = user.Shares.CreateShare(DateTime.Now.ToString("s")); Gett.Sharing.GettFile file1 = share1.CreateFile("MyDataFile." + DateTime.Now.ToString("s") + ".txt"); // Upload own string as a file to Ge.tt const string myDataString = "Hello from Gett.NET library"; file1.UploadData(System.Text.Encoding.UTF8.GetBytes(myDataString)); // Download file as a string or ... byte[] content = file1.DownloadData(); string contentString = System.Text.Encoding.UTF8.GetString(content); if (myDataString == contentString) { MessageBox.Show(@"It is a match!"); } // Download content to a local file file1.DownloadFile(@"C:\TEMP\MyFileFromGett.txt"); // Delete file or ... file1.Destroy(); // Delete share and all files share1.Destroy(); }