Example #1
0
        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;
            }
        }