Ejemplo n.º 1
0
        public static void Test_TraceMegaNodes_02(string name, string directory = "/", NodesOptions options = NodesOptions.Default, int limit = 0, bool log = false)
        {
            MegaClient megaClient = new MegaClient();
            string     email, password;

            if (!GetMegaLogin(name, out email, out password))
            {
                return;
            }
            megaClient.Email    = email;
            megaClient.Password = password;
            megaClient.Login();
            TraceNodes(megaClient.GetNodes(directory, options), limit: limit, log: log);
        }
Ejemplo n.º 2
0
        public static void Test_GetMegaNodes_v2(string name)
        {
            MegaClient megaClient = new MegaClient();
            string     email, password;

            if (!GetMegaLogin(name, out email, out password))
            {
                return;
            }
            megaClient.Email    = email;
            megaClient.Password = password;
            megaClient.Login();
            // .zSave(@"c:\pib\_dl\meganode_01.json", jsonIndent: true)
            //megaClient.GetDictionaryNodes1_v2();
            megaClient.GetMegaNodes().zSave(@"c:\pib\_dl\meganode_02.json", jsonIndent: true);
        }
Ejemplo n.º 3
0
        private static MegaClient GetMegaClient()
        {
            MegaClient megaClient = new MegaClient();
            //string environmentFile = XmlConfig.CurrentConfig.GetExplicit("LocalEnvironment");
            //if (!zFile.Exists(environmentFile))
            //{
            //    Trace.WriteLine("login not defined");
            //    return null;
            //}
            //string login = XDocument.Load(environmentFile).zXPathExplicitValue("Login");
            string           login         = GetMegaEnvironment().GetLogin();
            XmlConfig        localConfig   = XmlConfig.CurrentConfig.GetConfig("LocalConfig");
            XmlConfigElement configElement = localConfig.GetConfigElement($"Login[@name = '{login}']");

            if (configElement == null)
            {
                Trace.WriteLine($"unknow login \"{login}\"");
                return(null);
            }
            megaClient.Email    = configElement.GetExplicit("@email");
            megaClient.Password = configElement.GetExplicit("@password");
            megaClient.Login();
            return(megaClient);
        }