Example #1
0
        static string DownloadApp(string imageReference)
        {
            Console.WriteLine("| Downloading " + imageReference);
            var root     = AppStore.Root;
            var appPath  = imageReference.Replace(':', '.').Replace('/', '.').ToString();
            var fullPath = Path.Combine(root, appPath);
            var pullArgs = $"pull {imageReference} ";

            IoUtils.EnsureDirectory(fullPath);

            var psi = new ProcessStartInfo
            {
                FileName               = "oras",
                WorkingDirectory       = fullPath,
                Arguments              = pullArgs,
                RedirectStandardOutput = true,
                RedirectStandardError  = true,
                UseShellExecute        = false
            };

            using (var proc = Process.Start(psi))
            {
                proc.WaitForExit();
                if (proc.ExitCode != 0)
                {
                    Console.Write($"Error downloading {imageReference}");
                    Environment.Exit(proc.ExitCode);
                }
            }

            return(fullPath);
        }
Example #2
0
        // Create the app
        static AppStore()
        {
            var profile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
            var appRoot = System.IO.Path.Combine(profile, ".dotnet-oras-app");

            IoUtils.EnsureDirectory(appRoot);
            _rootPath = appRoot;
        }