예제 #1
0
        internal StrideVersionViewModel(LauncherViewModel launcher, NugetStore store, NugetLocalPackage localPackage, string packageId, int major, int minor)
            : base(launcher, store, localPackage)
        {
            PackageSimpleName  = packageId.Replace(".GameStudio", string.Empty);
            Major              = major;
            Minor              = minor;
            SetAsActiveCommand = new AnonymousCommand(ServiceProvider, () => launcher.ActiveVersion = this);
            // Update status if the user changes whether to display beta versions.
            launcher.PropertyChanged += (s, e) => { if (e.PropertyName == nameof(LauncherViewModel.ShowBetaVersions))
                                                    {
                                                        UpdateStatus();
                                                    }
            };

            if (LocalPackage != null && InstallPath != null)
            {
                var libDirectory = Path.Combine(InstallPath, "lib");
                var frameworks   = Directory.EnumerateDirectories(libDirectory);
                foreach (var frameworkPath in frameworks)
                {
                    var frameworkFolder = new DirectoryInfo(frameworkPath).Name;
                    if (File.Exists(Path.Combine(frameworkPath, "Stride.GameStudio.exe")) ||
                        File.Exists(Path.Combine(frameworkPath, "Xenko.GameStudio.exe")))
                    {
                        Frameworks.Add(frameworkFolder);
                    }
                }

                if (Frameworks.Count > 0)
                {
                    try
                    {
                        // If preferred framework exists in our list, select it
                        var preferredFramework = LauncherSettings.PreferredFramework;
                        if (Frameworks.Contains(preferredFramework))
                        {
                            SelectedFramework = preferredFramework;
                        }
                        else
                        {
                            // Otherwise, try to find a framework of the same kind (.NET Core or .NET Framework)
                            var nugetFramework = NuGetFramework.ParseFolder(preferredFramework);
                            SelectedFramework =
                                Frameworks.FirstOrDefault(x => NuGetFramework.ParseFolder(preferredFramework).Framework == nugetFramework.Framework)
                                ?? Frameworks.First(); // otherwise fallback to first choice
                        }
                    }
                    catch
                    {
                        SelectedFramework = Frameworks.First();
                    }
                }
            }
        }
예제 #2
0
        public void ComputeLinkerFlags()
        {
            foreach (var a in Assemblies)
            {
                a.ComputeLinkerFlags();
            }

            if (App.Platform != ApplePlatform.WatchOS && App.Platform != ApplePlatform.TVOS)
            {
                Frameworks.Add("CFNetwork");                  // required by xamarin_start_wwan
            }
        }
예제 #3
0
        protected void UpdateFrameworks()
        {
            Frameworks.Clear();
            if (LocalPackage != null && InstallPath != null)
            {
                foreach (var toplevelFolder in new[] { "tools", "lib" })
                {
                    var libDirectory = Path.Combine(InstallPath, toplevelFolder);
                    var frameworks   = Directory.EnumerateDirectories(libDirectory);
                    foreach (var frameworkPath in frameworks)
                    {
                        var frameworkFolder = new DirectoryInfo(frameworkPath).Name;
                        if (File.Exists(Path.Combine(frameworkPath, "Stride.GameStudio.exe")) ||
                            File.Exists(Path.Combine(frameworkPath, "Xenko.GameStudio.exe")))
                        {
                            Frameworks.Add(frameworkFolder);
                        }
                    }
                }

                if (Frameworks.Count > 0)
                {
                    try
                    {
                        // If preferred framework exists in our list, select it
                        var preferredFramework = LauncherSettings.PreferredFramework;
                        if (Frameworks.Contains(preferredFramework))
                        {
                            SelectedFramework = preferredFramework;
                        }
                        else
                        {
                            // Otherwise, try to find a framework of the same kind (.NET Core or .NET Framework)
                            var nugetFramework = NuGetFramework.ParseFolder(preferredFramework);
                            SelectedFramework =
                                Frameworks.FirstOrDefault(x => NuGetFramework.ParseFolder(preferredFramework).Framework == nugetFramework.Framework)
                                ?? Frameworks.First(); // otherwise fallback to first choice
                        }
                    }
                    catch
                    {
                        SelectedFramework = Frameworks.First();
                    }
                }
            }
        }
예제 #4
0
    public static Frameworks GetMacCatalystFrameworks()
    {
        if (catalyst_frameworks == null)
        {
            catalyst_frameworks = CreateiOSFrameworks(false);
            // not present in iOS but present in catalyst
            catalyst_frameworks.Add("CoreWlan", "CoreWLAN", 15, 0);

            var min   = new Version(13, 0);
            var v14_0 = new Version(14, 0);
            var v14_2 = new Version(14, 2);
            foreach (var f in catalyst_frameworks.Values)
            {
                switch (f.Name)
                {
                // These frameworks were added to Catalyst after they were added to iOS, so we have to adjust the Versions fields
                case "CoreTelephony":
                case "HomeKit":
                case "Messages":
                    f.Version = v14_0;
                    f.VersionAvailableInSimulator = v14_0;
                    break;

                case "AddressBook":
                case "ClassKit":
                case "UserNotificationsUI":
                    f.Version = v14_2;
                    f.VersionAvailableInSimulator = v14_2;
                    break;

                // These frameworks are not available on Mac Catalyst
                case "OpenGLES":
                case "NewsstandKit":
                case "MediaSetup":
                case "NotificationCenter":
                case "GLKit":
                case "VideoSubscriberAccount":
                // The headers for FileProviderUI exist, but the native linker fails
                case "FileProviderUI":
                // The headers for Twitter are there, , but no documentation whatsoever online and the native linker fails too
                case "Twitter":
                // headers-based xtro reporting those are *all* unknown API for Catalyst
                case "AddressBookUI":
                case "AppClip":
                case "ARKit":
                case "AssetsLibrary":
                case "CarPlay":
                case "EventKitUI":
                case "HealthKit":
                case "HealthKitUI":
#if !NET
                case "iAd":
                case "CHIP":
#endif
                case "IdentityLookupUI":
                case "VisionKit":
                case "WatchConnectivity":
                    f.Unavailable = true;
                    break;

                // and nothing existed before Catalyst 13.0
                default:
                    if (f.Version < min)
                    {
                        f.Version = min;
                    }
                    if (f.VersionAvailableInSimulator < min)
                    {
                        f.VersionAvailableInSimulator = min;
                    }
                    break;
                }
            }

            // Add frameworks that are not in iOS
            catalyst_frameworks.Add("AppKit", 13, 0);
        }
        return(catalyst_frameworks);
    }
예제 #5
0
        public void BuildNativeReferenceFlags(TaskLoggingHelper Log, ITaskItem[] NativeReferences)
        {
            if (NativeReferences == null)
            {
                return;
            }

            foreach (var item in NativeReferences)
            {
                var value = item.GetMetadata("Kind");
                NativeReferenceKind kind;
                bool boolean;

                if (string.IsNullOrEmpty(value) || !Enum.TryParse(value, out kind))
                {
                    Log.LogWarning(MSBStrings.W0051, item.ItemSpec);
                    continue;
                }

                if (kind == NativeReferenceKind.Static)
                {
                    value = item.GetMetadata("ForceLoad");

                    if (!string.IsNullOrEmpty(value) && bool.TryParse(value, out boolean) && boolean)
                    {
                        Arguments.Add("-force_load");
                    }

                    Arguments.AddQuoted(item.ItemSpec);

                    value = item.GetMetadata("IsCxx");

                    if (!string.IsNullOrEmpty(value) && bool.TryParse(value, out boolean) && boolean)
                    {
                        Cxx = true;
                    }
                }
                else if (kind == NativeReferenceKind.Framework)
                {
                    var path = item.ItemSpec;
                    // in case the full path to the library is given (msbuild)
                    if (Path.GetExtension(path) != ".framework")
                    {
                        path = Path.GetDirectoryName(path);
                    }
                    Frameworks.Add(path);
                }
                else
                {
                    Log.LogWarning(MSBStrings.W0052, item.ItemSpec);
                    continue;
                }

                value = item.GetMetadata("NeedsGccExceptionHandling");
                if (!string.IsNullOrEmpty(value) && bool.TryParse(value, out boolean) && boolean)
                {
                    if (!Arguments.Contains("-lgcc_eh"))
                    {
                        Arguments.Add("-lgcc_eh");
                    }
                }

                value = item.GetMetadata("WeakFrameworks");
                if (!string.IsNullOrEmpty(value))
                {
                    foreach (var framework in value.Split(' ', '\t'))
                    {
                        WeakFrameworks.Add(framework);
                    }
                }

                value = item.GetMetadata("Frameworks");
                if (!string.IsNullOrEmpty(value))
                {
                    foreach (var framework in value.Split(' ', '\t'))
                    {
                        Frameworks.Add(framework);
                    }
                }

                // Note: these get merged into gccArgs by our caller
                value = item.GetMetadata("LinkerFlags");
                if (!string.IsNullOrEmpty(value))
                {
                    var linkerFlags = CommandLineArgumentBuilder.Parse(value);

                    foreach (var flag in linkerFlags)
                    {
                        Arguments.AddQuoted(flag);
                    }
                }
            }
        }
예제 #6
0
        /// <summary>
        ///     Deserialize the object
        /// </summary>
        public virtual void DeserializeJson(JToken inputObject)
        {
            if (inputObject != null && inputObject.Type != JTokenType.Null)
            {
                var idValue = inputObject["id"];
                if (idValue != null && idValue.Type != JTokenType.Null)
                {
                    Id = int.Parse((string)idValue);
                }

                var emailValue = inputObject["email"];
                if (emailValue != null && emailValue.Type != JTokenType.Null)
                {
                    Email = (string)emailValue;
                }

                var employerSatisfactionValue = inputObject["employerSatisfaction"];
                if (employerSatisfactionValue != null && employerSatisfactionValue.Type != JTokenType.Null)
                {
                    EmployerSatisfaction = (double)employerSatisfactionValue;
                }

                var frameworksSequence = inputObject["frameworks"];
                if (frameworksSequence != null && frameworksSequence.Type != JTokenType.Null)
                {
                    foreach (var frameworksValue in (JArray)frameworksSequence)
                    {
                        var framework = new Framework();
                        framework.DeserializeJson(frameworksValue);
                        Frameworks.Add(framework);
                    }
                }

                var learnerSatisfactionValue = inputObject["learnerSatisfaction"];
                if (learnerSatisfactionValue != null && learnerSatisfactionValue.Type != JTokenType.Null)
                {
                    LearnerSatisfaction = (double)learnerSatisfactionValue;
                }

                var locationsSequence = inputObject["locations"];
                if (locationsSequence != null && locationsSequence.Type != JTokenType.Null)
                {
                    foreach (var locationsValue in (JArray)locationsSequence)
                    {
                        var location = new Location();
                        location.DeserializeJson(locationsValue);
                        Locations.Add(location);
                    }
                }

                var marketingInfoValue = inputObject["marketingInfo"];
                if (marketingInfoValue != null && marketingInfoValue.Type != JTokenType.Null)
                {
                    MarketingInfo = (string)marketingInfoValue;
                }

                var nameValue = inputObject["name"];
                if (nameValue != null && nameValue.Type != JTokenType.Null)
                {
                    Name = (string)nameValue;
                }

                var nationalProviderValue = inputObject["nationalProvider"];
                if (nationalProviderValue != null && nationalProviderValue.Type != JTokenType.Null)
                {
                    NationalProvider = (bool)nationalProviderValue;
                }

                var phoneValue = inputObject["phone"];
                if (phoneValue != null && phoneValue.Type != JTokenType.Null)
                {
                    Phone = (string)phoneValue;
                }

                var standardsSequence = inputObject["standards"];
                if (standardsSequence != null && standardsSequence.Type != JTokenType.Null)
                {
                    foreach (var standardsValue in (JArray)standardsSequence)
                    {
                        var standard = new Standard();
                        standard.DeserializeJson(standardsValue);
                        Standards.Add(standard);
                    }
                }

                var ukprnValue = inputObject["ukprn"];
                if (ukprnValue != null && ukprnValue.Type != JTokenType.Null)
                {
                    Ukprn = (int)ukprnValue;
                }

                var websiteValue = inputObject["website"];
                if (websiteValue != null && websiteValue.Type != JTokenType.Null)
                {
                    Website = (string)websiteValue;
                }
            }
        }