static public void MenuItem_Get(string[] args, MPackEngine.Engine engine) { string appName = ""; string appVersion = ""; if (checkArg(1, args, ref appName) && checkArg(2, args, ref appVersion)) { try { var application = engine.GetCurrentPackageRepositoryList().GetPackage(appName, appVersion); Console.WriteLine("Selected app to download: {0} - {1}", application.ApplicationName, application.ApplicationVersion); var result = engine.GetCurrentPackageRepositoryList().GetFullDownloadListForApplication(appName, appVersion); Console.WriteLine("Full download list:"); result.ForEach(x => Console.WriteLine("Application: {0}, version: {1}", x.ApplicationName, x.ApplicationVersion)); Console.WriteLine("Downloading..."); engine.GetApplication(result); Console.WriteLine("All content was downloaded!"); } catch (Exception ex) { Console.WriteLine(ex.Message); } } else { Console.WriteLine("Check input, give app name as first argument and version as the second", appName, appVersion); } }
static public void MenuItem_Info(string[] args, MPackEngine.Engine engine) { string appName = ""; string appVersion = ""; if (checkArg(1, args, ref appName) && checkArg(2, args, ref appVersion)) { try { var result = engine.GetCurrentPackageRepositoryList().GetPackage(appName, appVersion); Console.WriteLine("Getting app info:"); Console.WriteLine(String.Format("Application: {0} - Version: {1}", result.ApplicationName, result.ApplicationVersion)); Console.WriteLine("Dependecies:"); result.DependentPackages.ForEach(x => Console.WriteLine("Application: {0}, version: {1}", x.ApplicationName, x.ApplicationVersion)); } catch (Exception ex) { Console.WriteLine(ex.Message); } } else { Console.WriteLine("Check input, give app name as first argument and version as the second", appName, appVersion); } }
static public void MenuItem_List(string[] args, MPackEngine.Engine engine) { string filterCommand = ""; List <Package> result; if (checkArg(1, args, ref filterCommand)) { result = engine.GetCurrentPackageRepositoryList().GetPackagesThatStartsWith(filterCommand); } else { result = engine.GetCurrentPackageRepositoryList().Packages; } foreach (var item in result) { Console.WriteLine(String.Format("Application: {0} - Version: {1}", item.ApplicationName, item.ApplicationVersion)); } }