コード例 #1
0
 private static void Start(string identifier, bool waitForExit)
 {
     RepoManagement.GetReposFromDisk();
     App[] apps = AppExtras.FindApps(identifier);
     if (apps.Length == 0)
     {
         Console.WriteLine("Package not found.");
     }
     else
     {
         App tmp = apps.First();
         if (tmp.Runnable)
         {
             Console.WriteLine($"Starting {tmp.Name}");
             Process tmp1 = AppExtras.RunApp(tmp);
             if (waitForExit)
             {
                 tmp1.WaitForExit();
             }
         }
         else
         {
             Console.WriteLine($"{tmp.Name} is not runnable");
         }
     }
     Console.WriteLine("Done!");
 }
コード例 #2
0
ファイル: CacheManagement.cs プロジェクト: JFronny/UpTool2
 private static void Show(string identifier)
 {
     RepoManagement.GetReposFromDisk();
     App[] apps = AppExtras.FindApps(identifier);
     if (apps.Length == 0)
     {
         Console.WriteLine("Package not found.");
     }
     else
     {
         Console.WriteLine(apps.First());
     }
 }
コード例 #3
0
ファイル: CacheManagement.cs プロジェクト: JFronny/UpTool2
 private static void List()
 {
     RepoManagement.GetReposFromDisk();
     Console.WriteLine(GlobalVariables.Apps.Where(s => (s.Value.Status & Status.Installed) == Status.Installed)
                       .ToStringTable(new[]
     {
         "Name", "State", "Guid"
     },
                                      u => u.Value.Name,
                                      u => u.Value.Local ? "Local" :
                                      (u.Value.Status & Status.Updatable) == Status.Updatable ? "Updatable" : "None",
                                      u => u.Key));
 }
コード例 #4
0
ファイル: CacheManagement.cs プロジェクト: JFronny/UpTool2
 private static void Search(string identifier)
 {
     RepoManagement.GetReposFromDisk();
     App[] apps = AppExtras.FindApps(identifier);
     Console.WriteLine($"Found {apps.Length} app(s)");
     if (apps.Length > 0)
     {
         Console.WriteLine(apps.ToStringTable(new[]
         {
             "Name", "Guid"
         },
                                              u => u.Name,
                                              u => u.Id));
     }
 }
コード例 #5
0
 private static void Reinstall(string identifier, bool force)
 {
     RepoManagement.GetReposFromDisk();
     App[] apps = AppExtras.FindApps(identifier);
     if (apps.Length == 0)
     {
         Console.WriteLine("Package not found.");
     }
     else
     {
         App tmp = apps.First();
         Console.WriteLine($"Reinstalling {tmp.Name}");
         AppExtras.Update(tmp, force);
     }
     Console.WriteLine("Done!");
 }
コード例 #6
0
        private static void DistUpgrade()
        {
            RepoManagement.GetReposFromDisk();
            foreach (KeyValuePair <Guid, App> app in GlobalVariables.Apps.Where(s =>
                                                                                (s.Value.Status & Status.Updatable) == Status.Updatable))
            {
                Console.WriteLine($"Updating {app.Value.Name}");
                AppExtras.Update(app.Value, false);
            }
#if !DEBUG
            if (Assembly.GetExecutingAssembly().GetName().Version < UpdateCheck.OnlineVersion)
            {
                Console.WriteLine("Updating self");
                Other.UpgradeSelf(false);
            }
#endif
            Console.WriteLine("Done!");
        }
コード例 #7
0
 private static void Purge(string identifier)
 {
     RepoManagement.GetReposFromDisk();
     App[] apps = AppExtras.FindApps(identifier);
     if (apps.Length == 0)
     {
         Console.WriteLine("Package not found.");
     }
     else
     {
         App tmp = apps.First();
         if ((tmp.Status & Status.Installed) == Status.Installed)
         {
             Console.WriteLine($"Purging {tmp.Name}");
             AppExtras.Remove(tmp, true);
         }
         else
         {
             Console.WriteLine("Package is not installed");
         }
     }
     Console.WriteLine("Done!");
 }
コード例 #8
0
 private static void Upgrade(string identifier, bool force)
 {
     RepoManagement.GetReposFromDisk();
     App[] apps = AppExtras.FindApps(identifier);
     if (apps.Length == 0)
     {
         Console.WriteLine("Package not found.");
     }
     else
     {
         App tmp = apps.First();
         if ((tmp.Status & Status.Updatable) == Status.Updatable)
         {
             Console.WriteLine($"Upgrading {tmp.Name}");
             AppExtras.Update(tmp, force);
         }
         else
         {
             Console.WriteLine("Package is up-to-date");
         }
     }
     Console.WriteLine("Done!");
 }
コード例 #9
0
 private static void Install(string identifier, bool force)
 {
     RepoManagement.GetReposFromDisk();
     App[] apps = AppExtras.FindApps(identifier);
     if (apps.Length == 0)
     {
         if (File.Exists(identifier))
         {
             Console.WriteLine("Name:");
             string name = Console.ReadLine();
             AppInstall.InstallZip(identifier, new App(name, "Locally installed package, removal only",
                                                       GlobalVariables.MinimumVer, "", true, "",
                                                       Guid.NewGuid(), Color.Red, "", false, ""), force);
             Console.WriteLine($"Successfully installed \"{name}\"");
         }
         else
         {
             Console.WriteLine("Package not found.");
             Console.WriteLine(identifier);
         }
     }
     else
     {
         App tmp = apps.First();
         if ((tmp.Status & Status.Installed) == Status.Installed)
         {
             Console.WriteLine("Package is already installed");
         }
         else
         {
             Console.WriteLine($"Installing {tmp.Name}");
             AppInstall.Install(tmp, true);
         }
     }
     Console.WriteLine("Done!");
 }
コード例 #10
0
ファイル: CacheManagement.cs プロジェクト: JFronny/UpTool2
        private static void Update()
        {
            Console.WriteLine("Fetching Repos...");
            RepoManagement.FetchRepos();
            RepoManagement.GetReposFromDisk();
            Console.WriteLine();
            IEnumerable <App> tmp = GlobalVariables.Apps.Where(s =>
                                                               (s.Value.Status & Status.Updatable) == Status.Updatable).Select(s => s.Value);
            IEnumerable <App> apps = tmp as App[] ?? tmp.ToArray();
            int updatableCount     = apps.Count();

            Console.WriteLine(updatableCount == 0
                ? "All up-to-date"
                : $@"Found {updatableCount} Updates:
{string.Join(Environment.NewLine, apps.Select(s => $"- {s.Name} ({s.Version})"))}");
#if !DEBUG
            Version vLocal  = Assembly.GetExecutingAssembly().GetName().Version;
            Version vOnline = UpdateCheck.OnlineVersion;
            if (vLocal < vOnline)
            {
                Console.WriteLine($"uptool is outdated ({vLocal} vs {vOnline}), update using \"uptool upgrade-self\"");
            }
#endif
        }