private void CpuArchitectureCheckbox_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            var checkbox = (CheckBox)sender;

            CpuArchitecture cpuArchitecture = CpuArchitecture.None;

            switch (checkbox.Name)
            {
            case "Arm":
                cpuArchitecture = CpuArchitecture.Arm;
                break;

            case "X64":
                cpuArchitecture = CpuArchitecture.X64;
                break;

            case "X86":
                cpuArchitecture = CpuArchitecture.X86;
                break;
            }

            var viewModel = (IAppPlatformSpecificationPageViewModel)this.DataContext;

            if (checkbox.IsChecked.Value)
            {
                viewModel.AddCpuArchitecture(cpuArchitecture);
            }
            else
            {
                viewModel.RemoveCpuArchitecture(cpuArchitecture);
            }
        }
예제 #2
0
 internal PluginFile(BuildTarget buildTarget, string relativeFilePath, bool supportsEditor, CpuArchitecture cpuArchitecture)
 {
     _buildTarget      = buildTarget;
     _relativeFilePath = relativeFilePath;
     _cpuArchitecture  = cpuArchitecture;
     _supportsEditor   = supportsEditor;
 }
예제 #3
0
파일: Cpu.cs 프로젝트: didimitrov/Algo
 public Cpu(IRam ram, IVideoCard videoCard, byte numberOfCores, CpuArchitecture architecture)
 {
     this.Ram = ram;
     this._videoCard = videoCard;
     NumberOfCores = numberOfCores;
     this.Architecture = architecture;
 }
예제 #4
0
 /// <summary>
 /// Search for parameters that specifies a range of packages in the OpenTAP package system. Unset parameters will be treated as 'any'.
 /// </summary>
 public PackageSpecifier(string name = null, VersionSpecifier version = default(VersionSpecifier), CpuArchitecture architecture = CpuArchitecture.Unspecified, string os = null)
 {
     Name         = name;
     Version      = version ?? VersionSpecifier.Any;
     Architecture = architecture;
     OS           = os;
 }
예제 #5
0
 /// <summary>
 /// Creates a package identifier
 /// </summary>
 /// <param name="packageName">Name of the package.</param>
 /// <param name="version">Version of the package.</param>
 /// <param name="architecture">CPU architechture supported by the package.</param>
 /// <param name="os">Operating System supported by this package.</param>
 public PackageIdentifier(string packageName, SemanticVersion version, CpuArchitecture architecture, string os)
 {
     Name         = packageName;
     Version      = version;
     Architecture = architecture;
     OS           = os;
 }
예제 #6
0
파일: SourceFile.cs 프로젝트: rcarz/fusion
 /// <summary>
 /// Initialises the local source.
 /// </summary>
 /// <param name="digest">expected digest of the file</param>
 /// <param name="localname">file name to use when saving to distfiles</param>
 /// <param name="size">size of the file in bytes</param>
 /// <param name="arch">CPU architecture name</param>
 internal SourceFile(string digest, string localname, long size, CpuArchitecture cpuarch)
 {
     _digest = digest;
     _localname = localname;
     _size = size;
     _cpuarch = cpuarch;
 }
예제 #7
0
        public void Test_CpuArchitecture()
        {
            var task = new CpuArchitecture();

            Assert.IsTrue(task.Execute());
            if (Environment.OSVersion.Platform == System.PlatformID.Unix)
            {
                if (Environment.Is64BitOperatingSystem)
                {
                    Assert.AreEqual("x86_64", task.Value);
                }
                else
                {
                    Assert.AreEqual("i686", task.Value);
                }
            }
            else
            {
                if (Environment.Is64BitOperatingSystem)
                {
                    Assert.AreEqual("x64", task.Value);
                }
                else
                {
                    Assert.AreEqual("x86", task.Value);
                }
            }
        }
        public void CpuArchitecture_Windows()
        {
            var task = new CpuArchitecture();

            Assert.That(task.Execute(), Is.True);
            Assert.That(task.Value, Is.EqualTo(Environment.Is64BitOperatingSystem ? "x64" : "x86"));
        }
예제 #9
0
 /// <summary>
 /// Creates a package identifier
 /// </summary>
 /// <param name="packageName">Name of the package.</param>
 /// <param name="version">Version of the package. This should be semver 2.0.0 compliant.</param>
 /// <param name="architecture">CPU architechture supported by the package.</param>
 /// <param name="os">Operating System supported by this package.</param>
 public PackageIdentifier(string packageName, string version, CpuArchitecture architecture, string os)
 {
     Name = packageName;
     if (version != null)
     {
         Version = SemanticVersion.Parse(version);
     }
     Architecture = architecture;
     OS           = os;
 }
예제 #10
0
        /// <exception cref="ArgumentNullException"><paramref name="version"/> is <see langword="null" />.</exception>
        public InstallationSpec(VersionNumber version, CpuArchitecture architecture, BuildConfiguration buildConfiguration)
        {
            if (version == null)
            {
                throw new ArgumentNullException("version");
            }

            Version            = version;
            Architecture       = architecture;
            BuildConfiguration = buildConfiguration;
        }
예제 #11
0
        /// <exception cref="ArgumentNullException"><paramref name="version"/> is <see langword="null" />.</exception>
        public GameArchiveSpec(VersionNumber version, CpuArchitecture architecture, BuildConfiguration buildConfiguration, OperatingSystem operatingSystem)
        {
            if (version == null)
            {
                throw new ArgumentNullException("version");
            }

            Version            = version;
            Architecture       = architecture;
            BuildConfiguration = buildConfiguration;
            OperatingSystem    = operatingSystem;
        }
예제 #12
0
        private void SelectPackage(CpuArchitecture fileType)
        {
            var picker = new FileOpenPicker();

            picker.FileTypeFilter.Add(".appx");

#if WINDOWS_PHONE_APP
            picker.ContinuationData.Add("uri", uri.OriginalString);
            picker.PickSingleFileAndContinue();
#else
            LoadSingleFile(picker, fileType);
#endif
        }
예제 #13
0
 public IEnumerable <PythonWheel> GetWheels(PythonVersion PyVersion, CpuArchitecture CpuArch)
 {
     foreach (SubstitutablePythons SubPyInstaller in Pythons)
     {
         foreach (PythonInstance PyInstaller in SubPyInstaller.PythonInstances)
         {
             if ((PyInstaller.Version == PyVersion) && (PyInstaller.Architecture == CpuArch))
             {
                 return(PyInstaller.Wheels);
             }
         }
     }
     throw new ArgumentException("Python Version not found");
 }
예제 #14
0
        /// <summary>
        /// True if this package is compatible (can be installed on) the specified operating system and architecture
        /// </summary>
        /// <param name="pkg"></param>
        /// <param name="selectedArch">Specifies a CPU architecture. If unspecified, the current host architecture is used.</param>
        /// <param name="selectedOS">Specifies an operating system. If null, the current host operating system is used.</param>
        /// <returns></returns>
        public static bool IsPlatformCompatible(this IPackageIdentifier pkg, CpuArchitecture selectedArch = CpuArchitecture.Unspecified, string selectedOS = null)
        {
            var cpu = selectedArch == CpuArchitecture.Unspecified ? ArchitectureHelper.GuessBaseArchitecture : selectedArch;
            var os  = selectedOS ?? RuntimeInformation.OSDescription;

            if (ArchitectureHelper.CompatibleWith(cpu, pkg.Architecture) == false)
            {
                return(false);
            }

            if (IsOsCompatible(pkg, os) == false)
            {
                return(false);
            }

            return(true);
        }
예제 #15
0
        private async Task UploadSingleFile(StorageFile file, CpuArchitecture fileType)
        {
            var uri = new Uri(Constants.PackageUploadServerUrl);

            var uploader = new BackgroundUploader();

            uploader.SetRequestHeader("Filename", file.Name);
            uploader.SetRequestHeader("Guid", _dataContext.AppDetail.AppSpecification.Guid.ToString());
            uploader.SetRequestHeader("AppName", fileType.ToString());


            var upload = uploader.CreateUpload(uri, file);

            //Log(String.Format(CultureInfo.CurrentCulture, "Uploading {0} to {1}, {2}", file.Name, uri.AbsoluteUri,
            //    upload.Guid));

            // Attach progress and completion handlers.
            await HandleUploadAsync(upload, true);
        }
예제 #16
0
        private async void LoadSingleFile(FileOpenPicker picker, CpuArchitecture fileType)
        {
            try
            {
                var selectedFile = await picker.PickSingleFileAsync();

                var properties = await selectedFile.GetBasicPropertiesAsync();

                if (properties.Size > MaxUploadFileSize)
                {
                    await
                    _alertMessageService.ShowAsync(
                        String.Format(CultureInfo.CurrentCulture,
                                      _resourceLoader.GetString("FileExceedsTheMaximumFileSize"), MaxUploadFileSizeUnit), null,
                        DialogCommands.CloseDialogCommand);

                    return;
                }

                switch (fileType)
                {
                case CpuArchitecture.Arm:
                    _armPackageStorageFile = selectedFile;
                    _dataContext.AppVersion.ArmPackageSize = (long)properties.Size;
                    break;

                case CpuArchitecture.X64:
                    _x64PackageStorageFile = selectedFile;
                    _dataContext.AppVersion.X64PackageSize = (long)properties.Size;
                    break;

                case CpuArchitecture.X86:
                    _x86PackageStorageFile = selectedFile;
                    _dataContext.AppVersion.X86PackageSize = (long)properties.Size;
                    break;
                }
            }
            catch (NullReferenceException)
            {
            }
            //  UploadSingleFile(file);
        }
예제 #17
0
        private static string FindPythonInRegistry(int MajorVersion, int MinorVersion, bool Force32Bit)
        {
            CpuArchitecture WindowsArch       = WindowsHelpers.GetWindowsOsArchitecture();
            RegistryKey     hklm              = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
            RegistryKey     pythonRegistryKey = null;

            if (!Force32Bit || WindowsArch != CpuArchitecture.X64)
            {
                pythonRegistryKey = hklm.OpenSubKey(string.Format(@"SOFTWARE\Python\PythonCore\{0}.{1}\InstallPath", MajorVersion, MinorVersion));
            }
            if (pythonRegistryKey == null)
            {
                pythonRegistryKey = hklm.OpenSubKey(string.Format(@"SOFTWARE\Wow6432Node\Python\PythonCore\{0}.{1}\InstallPath", MajorVersion, MinorVersion));
                if (pythonRegistryKey == null)
                {
                    pythonRegistryKey = hklm.OpenSubKey(string.Format(@"SOFTWARE\Wow6432Node\Python\PythonCore\{0}.{1}-32\InstallPath", MajorVersion, MinorVersion));
                    if (pythonRegistryKey == null)
                    {
                        return(null);
                    }
                }
            }
            string executablePath = pythonRegistryKey.GetValue("ExecutablePath") as string;

            if (executablePath != null)
            {
                return(executablePath);
            }
            string installPath = pythonRegistryKey.GetValue(null) as string;

            if (installPath == null)
            {
                return(null);
            }
            executablePath = Path.Combine(installPath, "python.exe");
            if (!File.Exists(executablePath))
            {
                return(null);
            }
            return(executablePath);
        }
예제 #18
0
        private static bool ExistPackage(Guid appGuid, CpuArchitecture cpuArchitecture)
        {
            var exist = false;

            switch (cpuArchitecture)
            {
            case CpuArchitecture.Arm:
                exist = File.Exists($"{ConfigurationReader.AppsDirectoryPath}\\{appGuid}\\arm.pstl");
                break;

            case CpuArchitecture.X86:
                exist = File.Exists($"{ConfigurationReader.AppsDirectoryPath}\\{appGuid}\\x86.pstl");
                break;

            case CpuArchitecture.X64:
                exist = File.Exists($"{ConfigurationReader.AppsDirectoryPath}\\{appGuid}\\x64.pstl");
                break;
            }

            return(exist);
        }
예제 #19
0
파일: List.cs 프로젝트: ZHJEE/OpenTAP
 public PackageListAction()
 {
     Architecture = ArchitectureHelper.GuessBaseArchitecture;
     OS           = null;
 }
예제 #20
0
 /// <summary>Compares for equality with another <see cref="CpuArchitecture" /> object.</summary>
 /// <remarks>Comparison is performed by value.</remarks>
 public bool Equals(CpuArchitecture other)
 {
     return(this.id == other.id);
 }
예제 #21
0
 public void AddCpuArchitecture(CpuArchitecture cpuArchitecture)
 {
     AppDetail.AppPlatformSpecification.CpuArchitectureFlags |= cpuArchitecture;
 }
예제 #22
0
 public void RemoveCpuArchitecture(CpuArchitecture cpuArchitecture)
 {
     AppDetail.AppPlatformSpecification.CpuArchitectureFlags &= ~cpuArchitecture;
 }
예제 #23
0
 /// <summary>
 /// Initialises the web source.
 /// </summary>
 /// <param name="location">remote URL to download from</param>
 /// <param name="digest">expected digest of the file</param>
 /// <param name="localname">file name to use when saving to distfiles</param>
 /// <param name="size">size of the file in bytes</param>
 /// <param name="cpuarch">CPU architecture name</param>
 internal WebSourceFile(Uri location, string digest, string localname, long size, CpuArchitecture cpuarch)
     : base(digest, localname, size, cpuarch)
 {
     _location = location;
 }
예제 #24
0
        private async Task UploadAppAsync(string appTitle, string appDescription, string appVersionDescription, int appCategoryId, long packageSize, byte[] icon128x128, byte[] icon256x256, CpuArchitecture cpuArchitecture, string version)
        {
            await Task.Factory.StartNew(() =>
            {
                var paasteelProvider  = _ctx.LegalPeople.Single(lp => lp.PrimaryEmail == "*****@*****.**");
                var universalPlatform = _ctx.Platforms.First(p => p.PlatformCategory == PlatformCategory.Windows10Universal);

                var app = new App
                {
                    Guid                 = Guid.NewGuid(),
                    Developer            = paasteelProvider,
                    Name                 = appTitle,
                    Description          = appDescription,
                    Icon128X128          = icon128x128,
                    Icon256X256          = icon256x256,
                    AppCategoryId        = appCategoryId,
                    CpuArchitectureFlags = cpuArchitecture,
                    State                = AppState.Unpublished
                };
                app.Platforms.Add(universalPlatform);
                app.AppVersions.Add(new AppVersion()
                {
                    Description = appVersionDescription,
                    Downloads   = 0,
                    PublishDate = DateTime.Now,
                    Version     = version,
                    Size        = packageSize
                });
                _ctx.Apps.Add(app);
                _ctx.SaveChanges();
            });
        }
예제 #25
0
 internal static void AddPluginFiles(BuildTarget buildTarget, string[] filenames, string folderPrefix, bool supportsEditor, CpuArchitecture cpuArchitecture)
 {
     foreach (string filename in filenames)
     {
         _pluginFiles.Add(new PluginFile(buildTarget, folderPrefix + filename, supportsEditor, cpuArchitecture));
     }
 }
예제 #26
0
 /// <summary>
 /// Initializes a new instance of a PackageVersion.
 /// </summary>
 public PackageVersion(string name, SemanticVersion version, string os, CpuArchitecture architechture, DateTime date, List <string> licenses) : base(name, version, architechture, os)
 {
     this.Date     = date;
     this.Licenses = licenses;
 }
예제 #27
0
        internal static List <PackageDef> GatherPackagesAndDependencyDefs(Installation installation, PackageSpecifier[] pkgRefs, string[] packageNames, string Version, CpuArchitecture arch, string OS, List <IPackageRepository> repositories, bool force, bool includeDependencies, bool askToIncludeDependencies, bool noDowngrade)
        {
            List <PackageDef> gatheredPackages = new List <PackageDef>();

            List <PackageSpecifier> packages = new List <PackageSpecifier>();

            if (pkgRefs != null)
            {
                packages = pkgRefs.ToList();
            }
            else
            {
                if (packageNames == null)
                {
                    throw new Exception("No packages specified.");
                }
                foreach (string packageName in packageNames)
                {
                    var version = Version;
                    if (Path.GetExtension(packageName).ToLower().EndsWith("tappackages"))
                    {
                        var tempDir          = Path.GetTempPath();
                        var bundleFiles      = PluginInstaller.UnpackPackage(packageName, tempDir);
                        var packagesInBundle = bundleFiles.Select(PackageDef.FromPackage);

                        // A packages file may contain the several variants of the same package, try to select one based on OS and Architecture
                        foreach (IGrouping <string, PackageDef> grp in packagesInBundle.GroupBy(p => p.Name))
                        {
                            var selected = grp.ToList();
                            if (selected.Count == 1)
                            {
                                gatheredPackages.Add(selected.First());
                                continue;
                            }
                            if (!string.IsNullOrEmpty(OS))
                            {
                                selected = selected.Where(p => p.OS.ToLower().Split(',').Any(OS.ToLower().Contains)).ToList();
                                if (selected.Count == 1)
                                {
                                    gatheredPackages.Add(selected.First());
                                    log.Debug("TapPackages file contains packages for several operating systems. Picking only the one for {0}.", OS);
                                    continue;
                                }
                            }
                            if (arch != CpuArchitecture.Unspecified)
                            {
                                selected = selected.Where(p => ArchitectureHelper.CompatibleWith(arch, p.Architecture)).ToList();
                                if (selected.Count == 1)
                                {
                                    gatheredPackages.Add(selected.First());
                                    log.Debug("TapPackages file contains packages for several CPU architectures. Picking only the one for {0}.", arch);
                                    continue;
                                }
                            }
                            throw new Exception("TapPackages file contains multiple variants of the same package. Unable to autoselect a suitable one.");
                        }
                    }
                    else if (string.IsNullOrWhiteSpace(packageName) == false)
                    {
                        packages.Add(new PackageSpecifier(packageName, VersionSpecifier.Parse(version ?? ""), arch, OS));
                    }
                }
            }

            foreach (var packageReference in packages)
            {
                var       installedPackages = installation.GetPackages();
                Stopwatch timer             = Stopwatch.StartNew();
                if (File.Exists(packageReference.Name))
                {
                    var package = PackageDef.FromPackage(packageReference.Name);

                    if (noDowngrade)
                    {
                        var installedPackage = installedPackages.FirstOrDefault(p => p.Name == package.Name);
                        if (installedPackage != null && installedPackage.Version.CompareTo(package.Version) >= 0)
                        {
                            log.Info($"The same or a newer version of package '{package.Name}' in already installed.");
                            continue;
                        }
                    }

                    gatheredPackages.Add(package);
                    log.Debug(timer, "Found package {0} locally.", packageReference.Name);
                }
                else
                {
                    PackageDef package = PackageActionHelpers.FindPackage(packageReference, force, installation, repositories);

                    if (noDowngrade)
                    {
                        var installedPackage = installedPackages.FirstOrDefault(p => p.Name == package.Name);
                        if (installedPackage != null && installedPackage.Version.CompareTo(package.Version) >= 0)
                        {
                            log.Info($"The same or a newer version of package '{package.Name}' in already installed.");
                            continue;
                        }
                    }

                    if (PackageCacheHelper.PackageIsFromCache(package))
                    {
                        log.Debug(timer, "Found package {0} version {1} in local cache", package.Name, package.Version);
                    }
                    else
                    {
                        log.Debug(timer, "Found package {0} version {1}", package.Name, package.Version);
                    }

                    gatheredPackages.Add(package);
                }
            }

            if (gatheredPackages.All(p => p.IsBundle()))
            {
                // If we are just installing bundles, we can assume that dependencies should also be installed
                includeDependencies = true;
            }

            log.Debug("Resolving dependencies.");
            var resolver = new DependencyResolver(installation, gatheredPackages, repositories);

            if (resolver.UnknownDependencies.Any())
            {
                foreach (var dep in resolver.UnknownDependencies)
                {
                    string message = string.Format("A package dependency named '{0}' with a version compatible with {1} could not be found in any repository.", dep.Name, dep.Version);

                    if (force)
                    {
                        log.Warning(message);
                        log.Warning("Continuing without downloading dependencies. Plugins will likely not work as expected.", dep.Name);
                    }
                    else
                    {
                        log.Error(message);
                    }
                }
                if (!force)
                {
                    log.Info("To download package dependencies despite the conflicts, use the --force option.");
                    return(null);
                }
            }
            else if (resolver.MissingDependencies.Any())
            {
                string dependencyArgsHint = "";
                if (!includeDependencies)
                {
                    dependencyArgsHint = $" (use --dependencies to also get these)";
                }
                if (resolver.MissingDependencies.Count > 1)
                {
                    log.Info("{0} required dependencies are currently not installed{1}.", resolver.MissingDependencies.Count, dependencyArgsHint);
                }
                else
                {
                    log.Info("A required dependency is currently not installed{0}.", dependencyArgsHint);
                }


                if (includeDependencies)
                {
                    //log.Debug($"Currently set to download dependencies quietly.");
                    foreach (var package in resolver.MissingDependencies)
                    {
                        log.Debug("Adding dependency {0} {1}", package.Name, package.Version);
                        gatheredPackages.Insert(0, package);
                    }
                }
                else if (askToIncludeDependencies)
                {
                    var pkgs = new List <DepRequest>();

                    foreach (var package in resolver.MissingDependencies)
                    {
                        // Handle each package at a time.
                        DepRequest req = null;
                        pkgs.Add(req = new DepRequest {
                            PackageName = package.Name, message = string.Format("Add dependency {0} {1} ?", package.Name, package.Version), Response = DepResponse.Add
                        });
                        UserInput.Request(req, true);
                    }

                    foreach (var pkg in resolver.MissingDependencies)
                    {
                        var res = pkgs.FirstOrDefault(r => r.PackageName == pkg.Name);

                        if ((res != null) && res.Response == DepResponse.Add)
                        {
                            gatheredPackages.Insert(0, pkg);
                        }
                    }
                }
            }

            return(gatheredPackages);
        }
예제 #28
0
        private void GetDependenciesRecursive(List <IPackageRepository> repositories, PackageDependency dependency, CpuArchitecture packageArchitecture, string OS)
        {
            if (Dependencies.Any(p => (p.Name == dependency.Name) &&
                                 dependency.Version.IsCompatible(p.Version) &&
                                 ArchitectureHelper.PluginsCompatible(p.Architecture, packageArchitecture)))
            {
                return;
            }
            PackageDef depPkg = GetPackageDefFromInstallation(dependency.Name, dependency.Version);

            if (depPkg == null)
            {
                depPkg = GetPackageDefFromRepo(repositories, dependency.Name, dependency.Version);
                MissingDependencies.Add(depPkg);
            }
            if (depPkg == null)
            {
                UnknownDependencies.Add(dependency);
                return;
            }
            Dependencies.Add(depPkg);
            foreach (var nextLevelDep in depPkg.Dependencies)
            {
                GetDependenciesRecursive(repositories, nextLevelDep, packageArchitecture, OS);
            }
        }