예제 #1
0
        public static ComponentTask InstallWithChoco(
            Architectures architecture,
            string displayName,
            string pkgName,
            string searchMask,
            bool force)
        {
            Func <bool> isChocoInstalledAction =
                () => ChocoUtil.IsChocoInstalled();

            Func <bool> isInternetConnected =
                () => Network.TestInternetConnection();

            List <Func <bool> > prereqFuncs = new List <Func <bool> >()
            {
                isInternetConnected, isChocoInstalledAction
            };

            Action installProgramAction =
                () => ChocoUtil.ChocoUpgrade(pkgName, displayName, false, searchMask, ChocoUtil.DefaultArgs);

            Func <bool> isProgramInstalledAction =
                () => ProgramInstaller.IsSoftwareInstalled(architecture, searchMask);



            return(new ComponentTask(new SetupTask(prereqFuncs, installProgramAction, isProgramInstalledAction, force), null));
        }
예제 #2
0
 private void ResolveDefaultArchitecture()
 {
     if (!Architectures.Any())
     {
         Architectures.Add(RuntimeArchitectures.Current);
     }
 }
        private async Task AddSourceArchitecture()
        {
            var source = await _sourcesManager.GetSourceById(_source.Id);

            if (source.ArchitecturesSources == null)
            {
                source.ArchitecturesSources = new List <ArchitectureSourceModel>();
            }

            source.ArchitecturesSources.Add(
                new ArchitectureSourceModel
            {
                ArchitectureId = Architecture.Id,
                SourceId       = source.Id
            });

            var architecture = await _architecturesManager.GetArchitectureById(Architecture.Id);

            if (architecture == null)
            {
                return;
            }

            await _sourcesManager.UpdateSource(source);

            Architectures.Add(architecture);

            ArchitecturesList.Remove(architecture);
        }
예제 #4
0
 public bool Equals(GacFileResolver other)
 {
     return(ReferenceEquals(this, other) ||
            other != null &&
            Architectures.SequenceEqual(other.Architectures) &&
            PreferredCulture == other.PreferredCulture);
 }
        public async Task DeleteSourceArchitecture(object arch)
        {
            var architecture = arch as ArchitectureModel;
            var source       = await _sourcesManager.GetSourceById(_source.Id);

            if (architecture == null)
            {
                return;
            }

            var ArchSour = new ArchitectureSourceModel
            {
                ArchitectureId = architecture.Id,
                SourceId       = source.Id
            };

            await _architectureSourceManager.RemoveArchitectureSource(architecture.Id, source.Id);

            source.ArchitecturesSources.Remove(ArchSour);

            await _sourcesManager.UpdateSource(source);

            Architectures.Remove(architecture);

            ArchitecturesList.Add(architecture);
        }
예제 #6
0
        /// <summary>
        /// Reports if this set of configuration mix constraints can be satisfied on the specified
        /// machine. If no machine is specified, active machine is queried.
        /// </summary>
        /// <returns></returns>
        internal bool IsSatisfied(MachineRecord record)
        {
            if (record == null)
            {
                throw new ArgumentNullException("record");
            }

            //Note - The query operators may be worth caching... Need to see how that plays out.
            if (!HasMatch(OperatingSystems, record.OperatingSystem))
            {
                Explanation = "Configuration OSes: " + OperatingSystems.ToCommaSeparatedList() + " did not match " + record.OperatingSystem;
                return(false);
            }
            else if (!HasMatch(Architectures, record.Architecture))
            {
                Explanation = "Configuration Architectures: " + Architectures.ToCommaSeparatedList() + " did not match: " + record.Architecture;
                return(false);
            }
            else if (Culture != null && !Culture.Equals(record.Culture, StringComparison.OrdinalIgnoreCase))
            {
                Explanation = "Configuration Culture: " + Culture + " did not match:" + record.Culture;
                return(false);
            }
            else if (!String.IsNullOrEmpty(MultiMonitor) &&
                     (String.Compare(MultiMonitor, "True", StringComparison.InvariantCultureIgnoreCase) == 0) &&
                     (record.MonitorCount < 2))
            {
                Explanation = "Configuration MultiMonitor did not match. Test need multiple monitors, actual monitors enabled: " + record.MonitorCount;
                return(false);
            }
            else
            {
                return(true);
            }
        }
예제 #7
0
        public static bool IsJavaInstalled(Architectures architecture, int majorVersion)
        {
            bool isInstalled = false;

            if (architecture == Architectures.X86)
            {
                if (Get32bitJavaJREVersions().FindIndex(item => item.Major == majorVersion) >= 0 ||
                    ProgramInstaller.IsSoftwareInstalled(Architectures.X86, "Java " + majorVersion + " Update *"))
                {
                    isInstalled = true;
                }
            }
            else if (architecture == Architectures.X64)
            {
                if (Get64bitJavaJREVersions().FindIndex(item => item.Major == majorVersion) >= 0 ||
                    ProgramInstaller.IsSoftwareInstalled(Architectures.X64, "Java " + majorVersion + " Update * (64-bit)"))
                {
                    isInstalled = true;
                }
            }
            else
            {
                throw new InvalidOperationException("Invalid architecture");
            }

            return(isInstalled);
        }
예제 #8
0
 /// <summary>
 /// With all architectures that are compatible with the currently running architecture
 /// </summary>
 /// <returns></returns>
 public TestMatrix WithAllArchitectures()
 {
     Architectures.Add(RuntimeArchitectures.Current);
     if (RuntimeInformation.OSArchitecture == Architecture.X64)
     {
         Architectures.Add(RuntimeArchitecture.x86);
     }
     return(this);
 }
예제 #9
0
 private void SetDefaultArchitecture(IProcessorArchitecture arch)
 {
     this.archDefault = arch;
     if (arch != null && !Architectures.ContainsKey(arch.Name))
     {
         Architectures.Add(arch.Name, arch);
     }
     //$REVIEW: raise an event if this option becomes user-available.
 }
        private async void InitData()
        {
            var x = (await _architecturesManager.GetArchitectures()).ToList();

            x.RemoveAll(a => Architectures.Contains(a));

            _immutableArchitecturesList = new ObservableCollection <ArchitectureModel>(
                await _architecturesManager.GetArchitectures());

            ArchitecturesList = new ObservableCollection <ArchitectureModel>(x);
        }
예제 #11
0
 public ChocoInstallData(
     Architectures architecture,
     string displayName,
     string pkgName,
     string searchMask)
 {
     Architecture = architecture;
     DisplayName  = displayName;
     PackageName  = pkgName;
     SearchMask   = searchMask;
 }
예제 #12
0
        // Mutators /////////////////////////////////////////////////////////////////

        public IProcessorArchitecture EnsureArchitecture(string archLabel, Func <string, IProcessorArchitecture> getter)
        {
            if (Architectures.TryGetValue(archLabel, out var arch))
            {
                return(arch);
            }
            arch = getter(archLabel);
            Architectures[arch.Name] = arch;
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Architectures)));
            return(arch);
        }
        private void ResolveDefaultArchitecture()
        {
            if (!Architectures.Any())
            {
                switch (RuntimeInformation.OSArchitecture)
                {
                case Architecture.X86:
                    Architectures.Add(RuntimeArchitecture.x86);
                    break;

                case Architecture.X64:
                    Architectures.Add(RuntimeArchitecture.x64);
                    break;

                default:
                    throw new ArgumentException(RuntimeInformation.OSArchitecture.ToString());
                }
            }
        }
예제 #14
0
        /// <summary>
        /// Loads plugin.
        /// </summary>
        public void Load()
        {
            this.rootWindow   = Global.DefaultRootWindow;
            this.architecture = Stuff.Architecture();

            this.submenu = new Gtk.Menu();

            Gtk.MenuItem mi = new Gtk.MenuItem(Catalog.GetString("_Take region screenshot"));
            this.submenu.Append(mi);
            mi.Activated        += (s, e) => this.TakeRegionScreenshot();
            mi.ButtonPressEvent += (s, e) => this.TakeRegionScreenshot();

            mi = new Gtk.MenuItem(Catalog.GetString("Take screenshot of _entire screen"));
            this.submenu.Append(mi);
            mi.Activated        += (s, e) => this.TakeScreenScreenshot();
            mi.ButtonPressEvent += (s, e) => this.TakeScreenScreenshot();

            mi = new Gtk.MenuItem(Catalog.GetString("_Pick color"));
            this.submenu.Append(mi);
            mi.Activated        += (s, e) => this.PickColor();
            mi.ButtonPressEvent += (s, e) => this.PickColor();
        }
예제 #15
0
        public void ApplyRid(RID rid)
        {
            if (!rid.BaseRID.Equals(BaseRID, StringComparison.Ordinal))
            {
                throw new ArgumentException($"Cannot apply {nameof(RID)} with {nameof(RID.BaseRID)} {rid.BaseRID} to {nameof(RuntimeGroup)} with {nameof(RuntimeGroup.BaseRID)} {BaseRID}.", nameof(rid));
            }

            if (rid.HasArchitecture)
            {
                Architectures.Add(rid.Architecture);
            }

            if (rid.HasVersion)
            {
                Versions.Add(rid.Version);
            }

            if (rid.HasQualifier)
            {
                AdditionalQualifiers.Add(rid.Qualifier);
            }
        }
예제 #16
0
        public static bool IsSoftwareInstalled(Architectures architecture, string softwareName, string remoteMachine = null, StringComparison strComparison = StringComparison.Ordinal)
        {
            List <string> uninstallRegKeys = new List <string>();

            if (architecture == Architectures.X86)// || architecture == Architectures.BOTH)
            {
                uninstallRegKeys.Add(@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall");
            }
            if (architecture == Architectures.X64)// || architecture == Architectures.BOTH)
            {
                uninstallRegKeys.Add(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall");
            }

            bool isInstalled = false;

            foreach (string uninstallRegKey in uninstallRegKeys)
            {
                RegistryView[] enumValues = (RegistryView[])Enum.GetValues(typeof(RegistryView));

                //Starts from 1, because first one is Default, so we dont need it...
                for (int i = 1; i < enumValues.Length; i++)
                {
                    //This one key is all what we need, because RegView will do the rest for us
                    using (RegistryKey regKey = (string.IsNullOrWhiteSpace(remoteMachine))
                                ? RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, enumValues[i]).OpenSubKey(uninstallRegKey)
                                : RegistryKey.OpenRemoteBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, remoteMachine, enumValues[i]).OpenSubKey(uninstallRegKey))
                    {
                        if (SearchSubKeysForValue(regKey, "DisplayName", softwareName, strComparison).Result)
                        {
                            isInstalled = true;
                        }
                    }
                }
            }

            return(isInstalled);
        }
예제 #17
0
        /// <summary>
        /// Loads plugin.
        /// </summary>
        public void Load()
        {
            this.rootWindow = Global.DefaultRootWindow;
            this.architecture = Stuff.Architecture();

            this.submenu = new Gtk.Menu();

            Gtk.MenuItem mi = new Gtk.MenuItem(Catalog.GetString("_Take region screenshot"));
            this.submenu.Append(mi);
            mi.Activated += (s, e) => this.TakeRegionScreenshot();
            mi.ButtonPressEvent += (s, e) => this.TakeRegionScreenshot();

            mi = new Gtk.MenuItem(Catalog.GetString("Take screenshot of _entire screen"));
            this.submenu.Append(mi);
            mi.Activated += (s, e) => this.TakeScreenScreenshot();
            mi.ButtonPressEvent += (s, e) => this.TakeScreenScreenshot();

            mi = new Gtk.MenuItem(Catalog.GetString("_Pick color"));
            this.submenu.Append(mi);
            mi.Activated += (s, e) => this.PickColor();
            mi.ButtonPressEvent += (s, e) => this.PickColor();
        }
예제 #18
0
 public TestMatrix WithAllArchitectures()
 {
     Architectures.Add(RuntimeArchitecture.x64);
     Architectures.Add(RuntimeArchitecture.x86);
     return(this);
 }
예제 #19
0
 public static extern NVMLReturnCodes GetArchitecture(IntPtr handle, out Architectures architecture);