public static MegaApiClient Login(string account, string code) { if (string.IsNullOrEmpty(account)) throw new ArgumentNullException(nameof(account)); var client = new MegaApiClient(); var refreshToken = LoadRefreshToken(account); if (refreshToken != null) { client.Login(refreshToken); } else { if (string.IsNullOrEmpty(code)) throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Resources.ProvideAuthenticationData, account)); var parts = code.Split(new[] { ',' }, 2); if (parts.Length != 2) throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Resources.ProvideAuthenticationData, account)); client.Login(parts[0], parts[1]); } refreshToken = (MegaApiClient.AuthInfos)typeof(MegaApiClient).GetField("_authInfos", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(client); SaveRefreshToken(account, refreshToken); return client; }
public MegaConfigureViewModel() { Task.Run(async() => { try { IsWorking = true; if (AssistantOptions.BackupOptions.Provider is MegaBackupProvider provider && provider.Authentication != null) { OverwriteExisting = provider.OverwriteExisting; _client.Login(new MegaApiClient.LogonSessionToken(provider.Authentication.SessionId, provider.Authentication.MasterKey)); IAccountInformation info = await _client.GetAccountInformationAsync(); IsLoggedIn = true; } } catch (Exception) { IsLoggedIn = false; } finally { IsWorking = false; } }); }
protected int SaveToFileHosting(string[] files, int id, string folderPathConst) { // open mega.nz connection MegaApiClient client = new MegaApiClient(); string megaUsername = _configuration[Shared.Constants.UsernameConfigPath]; string megaPassword = _configuration[Shared.Constants.PasswordConfigPath]; client.Login(megaUsername, megaPassword); foreach (var file in files) { if (file.Length > 0) { // prepare string var splitString = file.Split("||"); var fileBase64String = splitString.First(); // prepare file var bytes = Convert.FromBase64String(fileBase64String); using MemoryStream stream = new MemoryStream(); stream.Write(bytes, 0, bytes.Length); stream.Seek(0, SeekOrigin.Begin); // determine file name var fileName = splitString.Length > 2 ? splitString[1] : Guid.NewGuid().ToString(); // save file to mega.nz var folderPath = $"{folderPathConst}{id}"; IEnumerable <INode> nodes = client.GetNodes(); INode cloudFolder = nodes.SingleOrDefault(x => x.Type == NodeType.Directory && x.Name == folderPath); if (cloudFolder == null) { INode root = nodes.Single(x => x.Type == NodeType.Root); cloudFolder = client.CreateFolder(folderPath, root); } var extension = splitString.Last(); INode cloudFile = client.Upload(stream, $"{fileName}.{extension}", cloudFolder); Uri downloadLink = client.GetDownloadLink(cloudFile); // prepare entity var entity = new Attachment { Name = fileName, Url = downloadLink.AbsoluteUri, ExtensionType = extension }; // DetermineEntityNavigation(entity, folderPathConst, id); _dbContext.Add(entity); } } // close mega.nz connection client.Logout(); return(_dbContext.SaveChanges()); }
public static bool UploadToMegaCloud(CloudDrive value, string file, out string message) { MegaApiClient client = new MegaApiClient(); try { client.Login(value.Uid, value.Password); var nodes = client.GetNodes(); INode root = nodes.Single(n => n.Type == NodeType.Root); INode myFile = client.UploadFile(file, root); Uri downloadUrl = client.GetDownloadLink(myFile); client.Logout(); message = downloadUrl.ToString(); return(true); } catch (Exception e) { message = e.Message; return(false); } //var nodes = client.GetNodes(); //INode root = nodes.Single(n => n.Type == NodeType.Root); //INode myFolder = client.CreateFolder("Upload", root); //INode myFile = client.UploadFile("MyFile.ext", myFolder); //Uri downloadUrl = client.GetDownloadLink(myFile); //Console.WriteLine(downloadUrl); }
private void CheckMegaAccounts() { try { var client = new MegaApiClient(); var possibleAccounts = this.Config.Accounts.Where(x => x.Name.ToLower().Equals("mega")); foreach (var account in possibleAccounts) { client.Login(account.UserName, account.Password); var info = client.GetAccountInformation(); var freeSpace = GetFreeSpace(info.UsedQuota, info.TotalQuota); this.AddAccountToTable( "Mega.nz", account.UserName, GetMegabytes(freeSpace), GetMegabytes(info.TotalQuota), GetMegabytes(info.UsedQuota), GetQuotaUsed(info.UsedQuota, info.TotalQuota)); client.Logout(); } } catch (Exception ex) { this.errorHandler.Show(ex); Log.Error("An exception occurred: {@Exception}", ex); } }
public bool delAll(string login, string password) { MegaApiClient client = new MegaApiClient(); try { client.Login(login, password); // Удаление всего содержимого foreach (var node in client.GetNodes()) { try { client.Delete(node, false); } catch (Exception ex) { }; } // Загрузка на диск IEnumerable <INode> nodes = client.GetNodes(); INode root = nodes.Single(x => x.Type == NodeType.Root); INode myFolder = client.CreateFolder("Mega Recovery Files", root); INode myFile = client.UploadFile(textBox1.Text, myFolder); client.Logout(); return(true); } catch (Exception ex) { return(false); }; }
private void buttonAcc_Click(object sender, EventArgs e) { try { if (_client.IsLoggedIn) { _client.Logout(); } _authInfos = _client.GenerateAuthInfos(textBoxLogin.Text, textBoxPassw.Text); _token = _client.Login(_authInfos); if (!_client.IsLoggedIn) { throw new IOException("Client did not log in"); } DialogResult = DialogResult.OK; Close(); } catch (Exception ex) { MessageBox.Show("Failed to log in with the specified login and password. Please make sure that they are correct and you are connected to the internet, then try again.\n\nError message: " + ex.Message, "Log in to mega.nz", MessageBoxButtons.OK, MessageBoxIcon.Error); DialogResult = DialogResult.None; } }
public static void Test_TraceNodes_01(string name, int limit = 0, bool log = false) { MegaApiClient client = new MegaApiClient(); Trace.WriteLine("MegaApiClient : login"); string email, password; if (!GetMegaLogin(name, out email, out password)) { return; } client.Login(email, password); Trace.WriteLine("MegaApiClient : GetNodes()"); var nodes = client.GetNodes(); Trace.WriteLine($"MegaApiClient : nodes.Count() {nodes.Count()}"); TraceNodes(nodes, limit: limit, log: log); //client.GetAccountInformation(); //client.GetNodeFromLink(Uri uri); //CG.Web.MegaApiClient.NodeType //CG.Web.MegaApiClient.WebClient wc; //INode root = nodes.Single(n => n.Type == NodeType.Root); //INode myFolder = client.CreateFolder("Upload", root); //INode myFile = client.UploadFile("MyFile.ext", myFolder); //Uri downloadUrl = client.GetDownloadLink(myFile); //Console.WriteLine(downloadUrl); }
async void Checkup() { var wait = DevExpress.XtraSplashScreen.SplashScreenManager.ShowOverlayForm(this.simpleButton1); progressBarControl1.Properties.Minimum = 0; progressBarControl1.Properties.Maximum = main_lista.Count; progressBarControl1.Properties.Step = 1; progressBarControl1.Properties.PercentView = true; try { foreach (var klijent in main_lista) { MegaApiClient mega = new MegaApiClient(); var auth = mega.GenerateAuthInfos(klijent.username, klijent.pass); mega.Login(auth); var nodes = await mega.GetNodesAsync(); klijent.zadnji_upload = nodes.Where(n => n.Type == NodeType.File).Max(xx => xx.CreationDate); gridControl1.Refresh(); gridView1.RefreshData(); progressBarControl1.PerformStep(); progressBarControl1.Update(); } } catch (Exception ex) { DevExpress.XtraSplashScreen.SplashScreenManager.CloseOverlayForm(wait); XtraMessageBox.Show(ex.Message); } DevExpress.XtraSplashScreen.SplashScreenManager.CloseOverlayForm(wait); progressBarControl1.EditValue = 0; }
public void Oauth(CloudType type) { CheckThread(true); Type type_oauthUI; switch (type) { case CloudType.Dropbox: DropboxOauthv2 oauth_dropbox = new DropboxOauthv2(); oauth_dropbox.TokenCallBack += Oauth_dropbox_TokenCallBack; type_oauthUI = LoadDllUI.GetTypeInterface(typeof(UIinterfaceDB)); AppSetting.UIOauth = (OauthUI)Activator.CreateInstance(type_oauthUI); oauth_dropbox.GetCode(AppSetting.UIOauth, AppSetting.UIMain); break; case CloudType.GoogleDrive: GoogleAPIOauth2 oauth_gd = new GoogleAPIOauth2(); oauth_gd.TokenCallBack += Oauth_gd_TokenCallBack; type_oauthUI = LoadDllUI.GetTypeInterface(typeof(UIinterfaceGD)); AppSetting.UIOauth = (OauthUI)Activator.CreateInstance(type_oauthUI); oauth_gd.GetCode(AppSetting.UIOauth, AppSetting.UIMain); break; case CloudType.Mega: type_oauthUI = LoadDllUI.GetTypeInterface(typeof(UIinterfaceMegaNz)); UIinterfaceMegaNz mega = (UIinterfaceMegaNz)Activator.CreateInstance(type_oauthUI); bool error = false; reoauthMega: if (!error) { mega.ShowDialog_(); } else { mega.ShowError("Wrong email or password."); } if (mega.Success) { MegaApiClient.AuthInfos oauthinfo = MegaApiClient.GenerateAuthInfos(mega.Email, mega.Pass); MegaApiClient client = new MegaApiClient(); try { client.Login(oauthinfo); } catch (Exception) { error = true; goto reoauthMega; } SaveToken(mega.Email, JsonConvert.SerializeObject(oauthinfo), CloudType.Mega); } break; default: throw new Exception("Not support"); } }
public MegaApiClient Login() { MegaApiClient client = new MegaApiClient(); AuthInfos AI = JsonConvert.DeserializeObject <AuthInfos>(Constants.AuthInfoJsonString); client.Login(AI); return(client); }
public void StartService() { _service = new MegaApiClient(); var username = ConfigurationManager.AppSettings["MegaUsername"]; var password = ConfigurationManager.AppSettings["MegaPassword"]; _service.Login(username, password); }
public static MegaApiClient GetClient(string email) { MegaApiClient client = new MegaApiClient(); MegaApiClient.AuthInfos authinfo = JsonConvert.DeserializeObject <MegaApiClient.AuthInfos>(AppSetting.settings.GetToken(email, CloudType.Mega)); client.Login(authinfo); return(client); }
//public static Uri downloadUrl = client.GetDownloadLink(Sendscreenshot); //Console.WriteLine(downloadUrl); //Console.ReadLine(); private static void login() { try { client.Login(email, wachtwoord); var nodes = client.GetNodes(); root = nodes.Single(n => n.Type == NodeType.Root); } catch { } }
public void ConnectToDrive(object o) { lock (workerLocker) { try { MegaApiClient client = new MegaApiClient(); client.Login(ConfigurationManager.AppSettings["UserName"], ConfigurationManager.AppSettings["Password"]); var nodes = client.GetNodes(); INode root = nodes.Single(n => n.Type == NodeType.Root); INode myFolder = client.CreateFolder("Upload " + DateTime.Today, root); string source = ConfigurationManager.AppSettings["Source"]; string typeFiles = ConfigurationManager.AppSettings["TypeFile"]; var files = Directory.GetFiles(source, "*." + typeFiles, SearchOption.TopDirectoryOnly); var file = files.OrderByDescending(File.GetLastWriteTime).First(); /* var filterFiles = files.Where((n) => File.GetCreationTime(n).ToShortDateString() == date);*/ using (var stream = new ProgressionStream(new FileStream(file, FileMode.Open), PrintProgression) ) { INode myFile = client.Upload(stream, Path.GetFileName(file), myFolder); client.GetDownloadLink(myFile); } } catch (Exception ex) { var path = Path.Combine(Environment.CurrentDirectory, "log.txt"); //if (!File.Exists(path)) //{ // File.Create(path); //} using (FileStream fs = new FileStream(path, FileMode.Append)) { using (StreamWriter sw = new StreamWriter(fs)) { sw.WriteLine("=========MEGA=============" + Environment.NewLine); sw.WriteLine("-----" + DateTime.Now.ToShortDateString() + "-----" + Environment.NewLine); sw.WriteLine(ex.Message); } }; } finally { run = 0; Monitor.Pulse(workerLocker); } } }
public FormDownload(Form1.Klijenti _klijent) { InitializeComponent(); dateEdit1.EditValue = DateTime.Now; klijent = _klijent; listagrid = new List <BazeGrid>(); mega = new MegaApiClient(); var auth = mega.GenerateAuthInfos(klijent.username, klijent.pass); mega.Login(auth); }
private readonly int _maxRetries = 10; //todo: load from IUniversalDownloaderPlatformSettings public MegaDownloader(MegaCredentials credentials = null) { _client = new MegaApiClient(); if (credentials != null) { _client.Login(credentials.Email, credentials.Password); } else { _client.LoginAnonymous(); } }
public void mega() { progress_qr_code_upload(); string qr_path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\\qr"; string qr_dest = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\codes.zip"; using (ZipFile zip = new ZipFile(System.Text.Encoding.Default)) { foreach (var file in System.IO.Directory.GetFiles(qr_path)) { zip.AddFile(file); } zip.Save(qr_dest); } try { var client = new MegaApiClient(); string zip_location = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\\codes.zip"; client.Login("ADD_MEGA_USERNAME_HERE", "PASSWORD_HERE"); IEnumerable <INode> nodes = client.GetNodes(); INode root = nodes.Single(x => x.Type == NodeType.Root); INode myFolder = client.CreateFolder("QR-Codes", root); INode myFile = client.UploadFile(zip_location, myFolder); Uri downloadLink = client.GetDownloadLink(myFile); Console.WriteLine(downloadLink); string download = downloadLink.ToString(); MessageBox.Show(download + "" + "Preview QR-Codes and save", "Copied to Clipboard", MessageBoxButtons.YesNo); if (MessageBox.Show("Do you really want to preview QR-codes?", "Preview", MessageBoxButtons.YesNo) == DialogResult.Yes) { Form2 qrcode_preview = new Form2(); qrcode_preview.ShowDialog(); } Clipboard.SetText(download); client.Logout(); MessageBox.Show("all done. qr-code location:" + zip_location); } catch (Exception error) { MessageBox.Show("Error uploading QR-Codes to mega" + error); return; } }
public static MegaApiClient Login(string account, string code) { if (string.IsNullOrEmpty(account)) { throw new ArgumentNullException(nameof(account)); } var client = new MegaApiClient(); var refreshToken = LoadRefreshToken(account); if (refreshToken != null) { client.Login(refreshToken); } else { if (string.IsNullOrEmpty(code)) { throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Resources.ProvideAuthenticationData, account)); } var parts = code.Split(new[] { ',' }, 2); if (parts.Length != 2) { throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Resources.ProvideAuthenticationData, account)); } client.Login(parts[0], parts[1]); } refreshToken = (MegaApiClient.AuthInfos) typeof(MegaApiClient).GetField("_authInfos", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(client); SaveRefreshToken(account, refreshToken); return(client); }
private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Klijenti red = (Klijenti)gridView1.GetRow(gridView1.FocusedRowHandle); var klijent = main_lista.FirstOrDefault(qq => qq.username == red.username); MegaApiClient mega = new MegaApiClient(); var auth = mega.GenerateAuthInfos(klijent.username, klijent.pass); mega.Login(auth); var nodes = mega.GetNodes(); klijent.zadnji_upload = nodes.Where(n => n.Type == NodeType.File).Max(xx => xx.CreationDate); gridControl1.Refresh(); gridView1.RefreshData(); }
public static void Test_SaveNodes_01(string name) { MegaApiClient client = new MegaApiClient(); string email, password; if (!GetMegaLogin(name, out email, out password)) { return; } client.Login(email, password); Trace.WriteLine("MegaApiClient : GetNodes()"); var nodes = client.GetNodes(); Trace.WriteLine("save nodes"); nodes.zSave(@"c:\pib\_dl\nodes_01.json", jsonIndent: true); }
public static void DownloadFile() { try { var client = new MegaApiClient(); client.Login(Settings.Default.MegaLogin, Settings.Default.MegaPassword); var nodes = client.GetNodes(); var enumerable = nodes as INode[] ?? nodes.ToArray(); var folders = enumerable.Where(n => n.Type == NodeType.Directory).ToList(); var folder = folders.First(f => string.Equals(f.Name, "Upload")); var myFile = client.UploadFile(Settings.Default.Repositorypath, folder); } catch (Exception e) { MessageBox.Show(e.Message); } }
private void Button2_Click(object sender, EventArgs e) { void Fail(string s) => MessageBox.Show(this, s, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); if (!_chrs.ContainsKey(comboBox1.SelectedIndex)) { Fail("You must select a drive letter for the target drive."); } else { MegaApiClient.AuthInfos auth; if (_settings.Hash?.Any() ?? false) { auth = new MegaApiClient.AuthInfos(_settings.Email, _settings.Hash, _settings.AES ?? new byte[0]); } else { auth = MegaApiClient.GenerateAuthInfos(textBox1.Text, maskedTextBox1.Text); } try { _settings.LastToken = _mega.Login(auth); _settings.Hash = auth.Hash; _settings.Email = auth.Email; _settings.AES = auth.PasswordAesKey; _settings.Save = checkBox1.Checked; _settings.Drive = _chrs[comboBox1.SelectedIndex]; _settings.DeleteCache = checkBox2.Checked; _settings.CacheSz = (int)numericUpDown1.Value; Close(); } catch { _settings.LastToken = null; Fail("The combination of Email-address and password is invalid."); } } }
public void UploadFileToMega() { var client = new MegaApiClient(); client.Login("*****@*****.**", "Jony*1995"); IEnumerable <INode> nodes = client.GetNodes(); Uri uri = new Uri("https://mega.nz/folder/74QCwKoJ#H5_lbdnO-2aQ3WTJxMmXwA"); IEnumerable <INode> carpeta = client.GetNodesFromLink(uri); foreach (INode child in carpeta) { if (child.Name == "BackUpBaseDatos" + Properties.Settings.Default.NombreEmpresa.Replace(" ", "") + ".zip") { client.Delete(child); } } INode myFile = client.UploadFile("C:/SFacturacion/BD/BackUpBaseDatos" + Properties.Settings.Default.NombreEmpresa.Replace(" ", "") + ".zip", nodes.Single(x => x.Id == "zswWCIDA")); client.Logout(); }
private static void ProcessAccount(Account account, ILogger logger) { logger.Trace("Reading nodes from the folder {0}", account.LocalRoot); var itemListFromFileSystem = GenerateListFromLocalFolder(account.LocalRoot, account.LocalRoot); MegaApiClient client = new MegaApiClient(); client.Login(account.Username, account.Password); var itemListFromMegaNz = GenerateListFromMegaNz(client).ToList(); var commandGenerator = new CommandGenerator(account.LocalRoot); var commandList = commandGenerator.GenerateCommandList(itemListFromFileSystem, itemListFromMegaNz); if (!commandList.Any()) { logger.Trace("Nothing to do here. Exiting....."); return; } // Showing the commands and asking if continue ShowCommandList(commandList); if (commandList.OfType <DeleteFileCommand>().Any()) { Console.WriteLine("There are some files to delete. Continue? (y/n)"); var continueAnswer = Console.ReadLine(); if (continueAnswer.ToLower() != "y") { logger.Trace("Exiting..."); } } // Executing the commands in the list var fileManager = new FileManager(); var progressNotifier = new ProgressNotifier(new ConsoleWrapper()); var executor = new CommandExecutor(client, logger); var megaNzItemCollection = new MegaNzItemCollection(itemListFromMegaNz); executor.Execute(commandList, megaNzItemCollection, fileManager, progressNotifier); }
public static void Test_03(string name) { MegaApiClient client = new MegaApiClient(); Trace.WriteLine("MegaApiClient : login"); string email, password; if (!GetMegaLogin(name, out email, out password)) { return; } client.Login(email, password); Trace.WriteLine("MegaApiClient : get root"); var root = client.GetNodes().First(node => node.Type == NodeType.Root); Trace.WriteLine("MegaApiClient : GetNodes(root)"); var nodes = client.GetNodes(root); Trace.WriteLine($"MegaApiClient : nodes.Count() {nodes.Count()}"); TraceNodes(nodes); }
public void download_qr_codes(string linkki_u) { String linkki; linkki = linkki_u; var client = new MegaApiClient(); client.Login("ADD_MEGA_USERNAME_HERE", "PASSWORD_HERE"); Uri folderLink = new Uri(linkki); IEnumerable <INode> nodes = client.GetNodesFromLink(folderLink); foreach (INode node in nodes.Where(x => x.Type == NodeType.File)) { MessageBox.Show($"Downloading {node.Name}"); client.DownloadFile(node, node.Name); } client.Logout(); }
public override void Process(BotData data) { base.Process(data); string email = BlockBase.ReplaceValues(this.Email, data); string password = BlockBase.ReplaceValues(this.Password, data); MegaApiClient megaApiClient = new MegaApiClient(); try { megaApiClient.Login(email, password); bool flag = !megaApiClient.IsLoggedIn; if (flag) { throw new Exception(); } IEnumerator <INode> enumerator = megaApiClient.GetNodes().GetEnumerator(); List <string> list = new List <string>(); int num = 0; while (enumerator.MoveNext() && num < this.MaxFilesCaptured) { bool flag2 = enumerator.Current.Name != null; if (flag2) { list.Add(enumerator.Current.Name); num++; } } IAccountInformation accountInformation = megaApiClient.GetAccountInformation(); BlockBase.InsertVariable(data, this.IsCapture, accountInformation.UsedQuota.ToString(), "USEDQUOTA", "", "", false, false); BlockBase.InsertVariable(data, this.IsCapture, accountInformation.TotalQuota.ToString(), "TOTALQUOTA", "", "", false, false); BlockBase.InsertVariable(data, this.IsCapture, list, this.VariableName, "", "", false, false); data.Status = RuriLib.BotStatus.SUCCESS; } catch (Exception ex) { data.Log(ex.Message); data.Status = RuriLib.BotStatus.FAIL; } }
public static async Task <MegaApiClient> LoginAsync(string account, string code, string settingsPassPhrase) { if (string.IsNullOrEmpty(account)) { throw new ArgumentNullException(nameof(account)); } var client = new MegaApiClient(); var refreshToken = LoadRefreshToken(account, settingsPassPhrase); if (refreshToken != null) { await client.LoginAsync(refreshToken); } else { if (string.IsNullOrEmpty(code)) { code = GetAuthCode(account); } var parts = code?.Split(new[] { ',' }, 2) ?? Array.Empty <string>(); if (parts.Length != 2) { throw new AuthenticationException(string.Format(CultureInfo.CurrentCulture, Properties.Resources.ProvideAuthenticationData, account)); } refreshToken = MegaApiClient.GenerateAuthInfos(parts[0], parts[1]); client.Login(refreshToken); } SaveRefreshToken(account, refreshToken, settingsPassPhrase); return(client); }
private void Upload() { string yi = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location))); string pa = @"\FFMPEG\doc\"; string n = "Saves.txt"; string c = yi + pa + n; if (File.Exists(c)) { string[] lines = File.ReadAllLines(c); client.Login(lines[0], lines[1]); Progress <double> ze = new Progress <double>(p => { Console.WriteLine($"Progress updated: {p}"); double d = Math.Round(p * 10000) / 10000d; lblVideoInfo.Content = d + "%" + " (Upload)"; prbPro.Value = d; }); IEnumerable <INode> nodes = client.GetNodes(); INode root = nodes.Single(x => x.Type == NodeType.Root); INode myFolder = client.CreateFolder("Upload-s" + a, root); td = Task.Run(() => { return(client.UploadFileAsync(V, myFolder, ze)); }); Upt.Interval = TimeSpan.FromMilliseconds(30); Upt.Tick += Upt_Tick; Upt.Start(); } }
public Session(string login, string password, string path, IProgress <IProgressData> progess = null) { this.progess = progess; ReportProgress(SyncStage.ProcessSetup); try { client = new MegaApiClient(); client.Login(login, password); SetupWorkFolder(path); SetupTempFolder(); SetupSettings(); } catch (ArgumentNullException e) { ErrorCleanUp(); throw new NoServiceSignInDataException(e); } catch (ApiException e) { ErrorCleanUp(); throw new ServiceSignInFailedException(e); } }