Пример #1
0
 public void InvalidFrameworkStructureDoesNotShowUp()
 {
     Directory.CreateDirectory(DefaultFramework.ToString());
     var invalidFrameworks = new FrameworkFinder();
     Assert.AreEqual(0, invalidFrameworks.All.Length);
     Directory.Delete(DefaultFramework.ToString());
 }
Пример #2
0
        public void OutputDirectoryOfTestsIsNotValidFrameworkDirectory()
        {
            DeleteEnvironmentVariable();
            var spy = new FrameworkFinder();

            Assert.AreEqual(0, spy.All.Length);
        }
    /// <summary>
    /// Resolves .NET Core dependencies.
    /// </summary>
    private DependencySearchResult <FrameworkOptionsTuple, Framework> ResolveCore(RuntimeOptions options, bool is64Bit)
    {
        var finder   = new FrameworkFinder(is64Bit);
        var resolver = new DependencyResolver(finder);

        return(resolver.Resolve(options));
    }
Пример #4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if (!Directory.Exists(".updates"))
            {
                Directory.CreateDirectory(".updates");
            }
            var finder    = new FrameworkFinder(Environment.Is64BitOperatingSystem);
            var resolver  = new DependencyResolver(finder);
            var framework = new Framework("Microsoft.WindowsDesktop.App", "5.0.0");
            var options   = new RuntimeOptions("net5.0", framework, RollForwardPolicy.Minor);
            var result    = resolver.Resolve(options);

            // Check if dependencies are missing.
            if (!result.Available)
            {
                if (MessageBox.Show(".NET 5.0 Desktop Runtime is not installed! Would you like to install it now?", "SA Tools Installer", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes)
                {
                    MessageBox.Show("SA Tools cannot be installed without .NET 5.", "SA Tools Installer", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                FrameworkDownloader frameworkDownloader = new FrameworkDownloader(framework.NuGetVersion, framework.FrameworkName);
                string url = frameworkDownloader.GetDownloadUrlAsync(Environment.Is64BitOperatingSystem ? Architecture.Amd64 : Architecture.x86).GetAwaiter().GetResult();
                SAToolsHub.Updater.UpdaterWebClient client = new SAToolsHub.Updater.UpdaterWebClient();
                client.DownloadFile(url, "NET5Install.exe");
                Process.Start(new ProcessStartInfo("NET5Install.exe", "/install /passive /norestart")
                {
                    UseShellExecute = true, Verb = "runas"
                }).WaitForExit();
            }
            SAToolsHub.Updater.LoaderDownloadDialog mainForm = new SAToolsHub.Updater.LoaderDownloadDialog(Environment.Is64BitOperatingSystem ? "http://mm.reimuhakurei.net/SA%20Tools%20x64.7z" : "http://mm.reimuhakurei.net/SA%20Tools%20x86.7z", ".updates");
            Application.Run(mainForm);
        }
Пример #5
0
    /// <summary>
    /// Gets all URLs to missing runtime files.
    /// </summary>
    /// <param name="reloadedFolderPath">Folder path for an application, library will check every runtimeconfig.json inside this folder.</param>
    public static async Task <HashSet <UrlCommandlinePair> > GetMissingRuntimeUrls(string reloadedFolderPath)
    {
        var allFiles = Directory.GetFiles(reloadedFolderPath, "*.*", SearchOption.AllDirectories);
        var filesWithRuntimeConfigs = allFiles.Where(x => x.EndsWith(".runtimeconfig.json")).ToArray();

        // Now that we have the runtime config files, get all missing deps from them.
        var urlSet = new HashSet <UrlCommandlinePair>();
        var dotNetCommandLineParams = new string[]
        {
            "/install",
            "/quiet",
            "/norestart"
        };

        foreach (var is64Bit in new[] { true, false })
        {
            var architecture = is64Bit ? Architecture.Amd64 : Architecture.x86;
            var finder       = new FrameworkFinder(is64Bit);
            var resolver     = new DependencyResolver(finder);
            foreach (var runtimeConfig in filesWithRuntimeConfigs)
            {
                var runtimeOptions = RuntimeOptions.FromFile(runtimeConfig);
                var result         = resolver.Resolve(runtimeOptions);;
                foreach (var missingDep in result.MissingDependencies)
                {
                    var frameworkDownloader = new FrameworkDownloader(runtimeOptions.GetAllFrameworks()[0].NuGetVersion, missingDep.FrameworkName);
                    urlSet.Add(new UrlCommandlinePair()
                    {
                        FriendlyName = $".NET Core {runtimeOptions.GetAllFrameworks()[0].Version} {architecture}",
                        Url          = await frameworkDownloader.GetDownloadUrlAsync(architecture),
                        Parameters   = dotNetCommandLineParams
                    });
                }
            }
        }

        // Also check for C++ Runtime.
        if (!RedistributablePackage.IsInstalled(RedistributablePackageVersion.VC2015to2019x64))
        {
            urlSet.Add(new UrlCommandlinePair()
            {
                FriendlyName = "Visual C++ Redist x64",
                Url          = "https://aka.ms/vs/17/release/vc_redist.x64.exe",
                Parameters   = dotNetCommandLineParams
            });
        }

        if (!RedistributablePackage.IsInstalled(RedistributablePackageVersion.VC2015to2019x86))
        {
            urlSet.Add(new UrlCommandlinePair()
            {
                FriendlyName = "Visual C++ Redist x86",
                Url          = "https://aka.ms/vs/17/release/vc_redist.x86.exe",
                Parameters   = dotNetCommandLineParams
            });
        }

        return(urlSet);
    }
Пример #6
0
		public void CheckAvailableDeltaEngineFrameworks()
		{
			DeleteEnvironmentVariable();
			CreateFrameworkFolders(GetAllDeltaEngineFrameworks());
			frameworks = new FrameworkFinder();
			Assert.AreEqual(6, frameworks.All.Length);
			DeleteFrameworkFolders();
		}
Пример #7
0
 public void CheckAvailableDeltaEngineFrameworks()
 {
     DeleteEnvironmentVariable();
     CreateFrameworkFolders(GetAllDeltaEngineFrameworks());
     frameworks = new FrameworkFinder();
     Assert.AreEqual(6, frameworks.All.Length);
     DeleteFrameworkFolders();
 }
Пример #8
0
 public void CheckAvailabilityOfDefaultFramework()
 {
     DeleteEnvironmentVariable();
     CreateFrameworkFolders(GetAllDeltaEngineFrameworks());
     frameworks = new FrameworkFinder();
     Assert.AreEqual(DefaultFramework, frameworks.Default);
     DeleteFrameworkFolders();
 }
Пример #9
0
 public SampleBrowserViewModel(Service service)
 {
     service.DataReceived += OnDataReceived;
     this.service          = service;
     frameworks            = new FrameworkFinder();
     Samples = new List <Sample>();
     AddSelectionFilters();
     RegisterCommands();
 }
Пример #10
0
        public void InvalidFrameworkStructureDoesNotShowUp()
        {
            DeleteEnvironmentVariable();
            Directory.CreateDirectory(DefaultFramework.ToString());
            var invalidFrameworks = new FrameworkFinder();

            Assert.AreEqual(0, invalidFrameworks.All.Length);
            Directory.Delete(DefaultFramework.ToString());
            DeleteFrameworkFolders();
        }
Пример #11
0
 public void CheckAvailableDeltaEngineFrameworks()
 {
     CreateFrameworkFolders(GetAllDeltaEngineFrameworks());
     frameworks = new FrameworkFinder();
     Assert.AreEqual(6, frameworks.All.Length);
 }
Пример #12
0
 public void CheckAvailabilityOfDefaultFramework()
 {
     CreateFrameworkFolders(GetAllDeltaEngineFrameworks());
     frameworks = new FrameworkFinder();
     Assert.AreEqual(DefaultFramework, frameworks.Default);
 }
Пример #13
0
		public void DeltaEngineInstallerShouldHaveBeenExecutedAndAllFrameworkFoldersBeenCreated()
		{
			var spy = new FrameworkFinder();
			Assert.AreEqual(6, spy.All.Length);
		}
Пример #14
0
		public void OutputDirectoryOfTestsIsNotValidFrameworkDirectory()
		{
			DeleteEnvironmentVariable();
			var spy = new FrameworkFinder();
			Assert.AreEqual(0, spy.All.Length);
		}
Пример #15
0
		public void CheckAvailabilityOfDefaultFramework()
		{
			DeleteEnvironmentVariable();
			CreateFrameworkFolders(GetAllDeltaEngineFrameworks());
			frameworks = new FrameworkFinder();
			Assert.AreEqual(DefaultFramework, frameworks.Default);
			DeleteFrameworkFolders();
		}
Пример #16
0
        public void DeltaEngineInstallerShouldHaveBeenExecutedAndAllFrameworkFoldersBeenCreated()
        {
            var spy = new FrameworkFinder();

            Assert.AreEqual(6, spy.All.Length);
        }