Exemple #1
0
        public void SetUpDriver(IDriverConfig config, string version = "Latest",
                                Architecture architecture            = Architecture.Auto)
        {
            architecture = architecture.Equals(Architecture.Auto) ? ArchitectureHelper.GetArchitecture() : architecture;
            version      = version.Equals("Latest") ? config.GetLatestVersion() : version;
            var url = architecture.Equals(Architecture.X32) ? config.GetUrl32() : config.GetUrl64();

            url = UrlHelper.BuildUrl(url, version);
            var binaryPath = FileHelper.GetBinDestination(config.GetName(), version, architecture,
                                                          config.GetBinaryName());

            SetUpDriver(url, binaryPath, config.GetBinaryName());
        }
 public void SetUpDriver(IDriverConfig config, string version = VersionResolveStrategy.Latest,
                         Architecture architecture            = Architecture.Auto)
 {
     lock (Object)
     {
         architecture = architecture.Equals(Architecture.Auto)
             ? ArchitectureHelper.GetArchitecture()
             : architecture;
         version = GetVersionToDownload(config, version);
         var url = architecture.Equals(Architecture.X32) ? config.GetUrl32() : config.GetUrl64();
         url = UrlHelper.BuildUrl(url, version);
         var binaryPath = FileHelper.GetBinDestination(config.GetName(), version, architecture,
                                                       config.GetBinaryName());
         SetUpDriver(url, binaryPath, config.GetBinaryName());
     }
 }
Exemple #3
0
        public List <Tuple <string, string> > GetDriverInfo(IDriverConfig browserConfig, Architecture architecture, string browserVersion)
        {
            var baseUrlForSelectedArchitecture = architecture.Equals(Architecture.X32) ? browserConfig.GetUrl32() : browserConfig.GetUrl64();

            browserVersion = browserVersion.Equals("Latest", StringComparison.InvariantCultureIgnoreCase) ? browserVersion : CompatibilityHelper.GetMajorVersion(browserVersion);

            var driverVersion = browserConfig.GetDriverVersion(browserVersion);

            var url = UrlHelper.BuildUrl(baseUrlForSelectedArchitecture, driverVersion);

            var fileAndFolderPath = FileHelper.GetDriverDestination(browserConfig.GetName(), driverVersion, architecture, browserConfig.GetBinaryName());

            List <Tuple <string, string> > driverInfo = new List <Tuple <string, string> >();

            driverInfo.Add(new Tuple <string, string>(url, fileAndFolderPath));

            return(driverInfo);
        }
Exemple #4
0
        public override bool Equals(object other)
        {
            if (other == null)
            {
                return(false);
            }

            var revision = other as Revision;

            if (revision == null)
            {
                return(false);
            }

            return(Project.Equals(revision.Project) &&
                   Architecture.Equals(revision.Architecture) &&
                   Commit.Equals(revision.Commit));
        }
Exemple #5
0
        public int Start()
        {
            Logger.Log("Starting engine");

            if (!FirstInstance)
            {
                throw Logger.Error("There is already an 'Alis instance' running.");
            }

            Logger.Log("Running single instance mode.");

            Platform platform = DetectPlatform;

            if (platform.Equals(Platform.Unsupported))
            {
                throw Logger.Error("Platform unsupported. Please use Windows | MacOS | Linux system.");
            }

            Logger.Log("Platform = " + platform);

            Architecture architecture = DetectArchitecture;

            if (architecture.Equals(Architecture.Unsupported))
            {
                throw Logger.Error("unsupported architecture. Please use x86 or x64 architecture system.");
            }

            Logger.Log("Architecture = " + architecture);

            Graphics graphics = Graphics.OpenGL;
            bool     opengl   = Veldrid.GraphicsDevice.IsBackendSupported(Veldrid.GraphicsBackend.OpenGL);

            if (!opengl)
            {
                throw Logger.Error("Alis use only OpenGL!. Please install the last version of OpenGL 3.0+");
            }

            Logger.Log("API Graphics = OpenGL");

            return(new MainWindow(new Info(platform, architecture, graphics)).Start());
        }
        public async Task <string> ResolveAppHostSourceDirectoryAsync(string archOption, NuGetFramework targetFramework, Architecture arch)
        {
            string rid;
            var    validRids = new string[] { "win-x64", "win-arm64", "osx-x64", "osx-arm64" };

            if (string.IsNullOrEmpty(archOption))
            {
                if (targetFramework != null &&
                    (((targetFramework.Version.Major < 6 && OperatingSystem.IsMacOS()) ||
                      (targetFramework.Version.Major < 5 && OperatingSystem.IsWindows())) &&
                     !arch.Equals(Architecture.X64)))
                {
                    rid = OperatingSystem.IsWindows() ? "win-x64" : "osx-x64";
                }
                else
                {
                    // Use the default app host
                    return(GetDefaultAppHostSourceDirectory());
                }
            }
            else
            {
                rid = CommonOptions.ResolveRidShorthandOptionsToRuntimeIdentifier(null, archOption);
            }

            if (!validRids.Contains(rid))
            {
                throw new GracefulException(string.Format(LocalizableStrings.InvalidRuntimeIdentifier, rid, string.Join(" ", validRids)));
            }

            var packageId   = new PackageId($"microsoft.netcore.app.host.{rid}");
            var packagePath = await _nugetPackageDownloader.DownloadPackageAsync(packageId, packageSourceLocation : _packageSourceLocation);

            var content = await _nugetPackageDownloader.ExtractPackageAsync(packagePath, _tempDir);

            return(Path.Combine(_tempDir.Value, "runtimes", rid, "native"));
        }
Exemple #7
0
        /// <summary>Starts this instance.</summary>
        /// <returns>Return false or true to indicate the exit value</returns>
        public int Start()
        {
            if (!FirstInstance)
            {
                Logger.Error("There is already an 'Alis instance' running.");
                return(-1);
            }

            platform = DetectPlatform;
            if (platform.Equals(Platform.Unsupported))
            {
                Logger.Error("Platform unsupported. Please use Windows or MacOS or Linux system.");
                return(-1);
            }

            architecture = DetectArchitecture;
            if (architecture.Equals(Architecture.Unsupported))
            {
                Logger.Error("unsupported architecture. Please use x86 or x64 architecture system.");
                return(-1);
            }

            bool dirext11 = Veldrid.GraphicsDevice.IsBackendSupported(Veldrid.GraphicsBackend.Direct3D11);
            bool metal    = Veldrid.GraphicsDevice.IsBackendSupported(Veldrid.GraphicsBackend.Metal);
            bool opengl   = Veldrid.GraphicsDevice.IsBackendSupported(Veldrid.GraphicsBackend.OpenGL);
            bool vulkan   = Veldrid.GraphicsDevice.IsBackendSupported(Veldrid.GraphicsBackend.Vulkan);

            if (platform.Equals(Platform.Windows))
            {
                graphics = dirext11 ? Graphics.Directx11 :
                           opengl ? Graphics.OpenGL :
                           vulkan ? Graphics.Vulkan :
                           Graphics.Unsupported;

                if (graphics.Equals(Graphics.Unsupported))
                {
                    Logger.Error("Unsupported graphics for windows. Please install ( opengl 2.0+ or Directx 11+ or Vulkan 1.0+ ).");
                    return(-1);
                }
            }

            if (platform.Equals(Platform.MacOS))
            {
                graphics = opengl ? Graphics.OpenGL :
                           metal ? Graphics.Metal :
                           vulkan ? Graphics.Vulkan :
                           Graphics.Unsupported;

                if (graphics.Equals(Graphics.Unsupported))
                {
                    Logger.Error("Unsupported graphics for macos. Please install ( opengl 2.0+ or metal 1.0+ or Vulkan 1.0+ ).");
                    return(-1);
                }
            }

            if (platform.Equals(Platform.Linux))
            {
                graphics = opengl ? Graphics.OpenGL :
                           vulkan ? Graphics.Vulkan :
                           Graphics.Unsupported;

                if (graphics.Equals(Graphics.Unsupported))
                {
                    Logger.Error("Unsupported graphics for linux. Please install ( opengl 2.0+ or Vulkan 1.0+ ).");
                    return(-1);
                }
            }

            info = new Info(platform, architecture, graphics);
            Logger.Log("Info Platform: " + platform.ToString() + " " + architecture.ToString() + " " + graphics.ToString());

            mainWindow = new MainWindow();
            if (!mainWindow.Start(info))
            {
                Logger.Error("Failed to start the main window. ");
                return(-1);
            }

            return(0);
        }