Esempio n. 1
0
 private bool InitializeRepository()
 {
     try
     {
         AddonRepo = new AptRepository(AddonEnv);
         return(true);
     }
     catch (Exception e)
     {
         Output.Error("Failed to load repository index.");
     }
     return(false);
 }
Esempio n. 2
0
        public void DoUpdate()
        {
            AddonRemote = new AptRemote(AddonEnv);

            Output.Info("Action: update repository database.");
            PrintEnvInfo();
            try
            {
                if (AddonRepo == null)
                {
                    AddonRepo = new AptRepository(AddonEnv);
                }
                Output.Info(String.Format("Current index from: {0}", AddonRepo.GetRepositoryDate()));
                Output.Info(String.Format("There are currently {0} addons in the database.", AddonRepo.GetAddonNum()));
            }
            catch (Exception e)
            {
                Output.Error("Failed to load current index file.");
            }

            Output.Info("Downloading index file...");

            if (AddonRemote.UpdateIndexFile())
            {
                Output.Info("Download successful.");

                try
                {
                    AddonRepo = new AptRepository(AddonEnv);
                    Output.Info(String.Format("Updated index from: {0}", AddonRepo.GetRepositoryDate()));
                    Output.Info(String.Format("There are now {0} addons in the database.", AddonRepo.GetAddonNum()));
                }
                catch (Exception e)
                {
                    Output.Error("Failed to downloaded index file.");
                }
            }
            else
            {
                Output.Error("Download failed.");
            }
        }