Пример #1
0
        //Game Controllers
        void ApplyGameControllersCapability(GameControllersCapability capability)
        {
            //update pbxproject
            _pbxproj.EnableSystemCapability("com.apple.GameControllers.appletvos", true);
            _pbxproj.AddSystemFramework("GameController.framework", LinkType.Required);
            //update info.plist
            var changes = new PListDictionary();

            changes.Add("GCSupportsControllerUserInteraction", true);
            ApplyInfoPlistChanges(changes);

            if (capability.GameControllers != null && capability.GameControllers.Length > 0)
            {
                var controllerChanges = new PListDictionary();
                var controllers       = new PListArray();

                foreach (var c in capability.GameControllers)
                {
                    var dic = new PListDictionary();
                    dic.Add("ProfileName", c.ToString());
                    controllers.Add(dic);
                }

                controllerChanges.Add("GCSupportedGameControllers", controllers);
                ApplyInfoPlistChanges(controllerChanges, true);
            }
        }
Пример #2
0
        public void SetLanguageEnabled(string key, bool enable = true)
        {
            if (AppConfig == null)
            {
                Debug.LogError("No app config!");
            }

            PListArray arr = null;

            if (AppConfig.ContainsKey(LANGUAGES_DICT_KEY))
            {
                arr = AppConfig[LANGUAGES_DICT_KEY] as PListArray;
            }

            if (arr == null)
            {
                arr = new PListArray();
            }
            PListString id = new PListString(key);

            if (!enable && arr != null && arr.Contains(id))
            {
                arr.Remove(id);
            }
            if (enable && !arr.Contains(id))
            {
                arr.Add(id);
            }

            AppConfig[LANGUAGES_DICT_KEY] = arr;
        }
Пример #3
0
        //Network Extensions
        void ApplyNetworkExtensionsCapability(NetworkExtensionsCapability capability)
        {
            //update pbxproject
            _pbxproj.EnableSystemCapability("com.apple.NetworkExtensions.iOS", true);
            _pbxproj.AddSystemFramework("NetworkExtension.framework", LinkType.Required);
            //update entitlements file
            var entitlementChanges = new PListDictionary();
            var groups             = new PListArray();

            if (capability.AppProxy)
            {
                groups.Add("app-proxy-provider");
            }

            if (capability.ContentFilter)
            {
                groups.Add("content-filter-provider");
            }

            if (capability.PacketTunnel)
            {
                groups.Add("packet-tunnel-provider");
            }

            if (capability.DNSProxy)
            {
                groups.Add("dns-proxy");
            }

            entitlementChanges.Add("com.apple.developer.networking.networkextension", groups);
            ApplyEntitlementsChanges(entitlementChanges, true);
        }
Пример #4
0
        public IPListElement Copy()
        {
            var copy = new PListArray();

            foreach (var element in this)
            {
                copy.Add(element.Copy());
            }

            return(copy);
        }
Пример #5
0
        protected PListArray Serialize <T>(List <T> changeEntries) where T : BaseChangeEntry
        {
            var array = new PListArray();

            foreach (var item in changeEntries)
            {
                array.Add(item.Serialize());
            }

            return(array);
        }
Пример #6
0
        void ApplyNFCTagReadingCapability(NFCTagReadingCapability capability)
        {
            //update pbxproject
            _pbxproj.EnableSystemCapability("com.apple.NearFieldCommunicationTagReading", true);
            //update entitlements file
            var entitlementChanges = new PListDictionary();
            var formats            = new PListArray();

            formats.Add("NDEF");
            entitlementChanges.Add("com.apple.developer.nfc.readersession.formats", formats);
            ApplyEntitlementsChanges(entitlementChanges, true);
        }
Пример #7
0
        //Personal VPN
        void ApplyPersonalVPNCapability(PersonalVPNCapability capability)
        {
            //update pbxproject
            _pbxproj.EnableSystemCapability("com.apple.VPNLite", true);
            _pbxproj.AddSystemFramework("NetworkExtension.framework", LinkType.Required);
            //update entitlements file
            var entitlementChanges = new PListDictionary();
            var groups             = new PListArray();

            groups.Add("allow-vpn");
            entitlementChanges.Add("com.apple.developer.networking.vpn.api", groups);
            ApplyEntitlementsChanges(entitlementChanges, true);
        }
Пример #8
0
        void Load(PListArray array, List <SystemFrameworkEntry> list)
        {
            for (int ii = 0; ii < array.Count; ++ii)
            {
                var dic = array.DictionaryValue(ii);

                if (dic == null)
                {
                    continue;
                }

                var entry = new SystemFrameworkEntry(dic);
                list.Add(entry);
            }
        }
Пример #9
0
        public BuildSettingsChanges(PListArray array)
        {
            if (array == null)
            {
                return;
            }

            for (int ii = 0; ii < array.Count; ++ii)
            {
                var dic = array.DictionaryValue(ii);

                if (dic == null)
                {
                    continue;
                }

                var name = dic.StringValue(BaseBuildSettingEntry.NAME_KEY);
                BaseBuildSetting refSetting;

                if (_reference.BuildSetting(name, out refSetting))
                {
                    if (refSetting is BoolBuildSetting)
                    {
                        _buildSettings.Add(new BoolBuildSettingEntry(dic));
                    }
                    else if (refSetting is ArrayBuildSetting || refSetting is StringListBuildSetting)
                    {
                        _buildSettings.Add(new CollectionBuildSettingEntry(dic));
                    }
                    else if (refSetting is EnumBuildSetting)
                    {
                        _buildSettings.Add(new EnumBuildSettingEntry(dic));
                    }
                    else if (refSetting is StringBuildSetting)
                    {
                        _buildSettings.Add(new StringBuildSettingEntry(dic));
                    }
                    else
                    {
                        throw new System.NotImplementedException("EgoXproject: Developer has forgotten to implement check for new build setting type.");
                    }
                }
                else
                {
                    _buildSettings.Add(new CustomStringBuildSettingEntry(dic));
                }
            }
        }
Пример #10
0
        void LoadBuildSettings(PListArray array)
        {
            if (array == null)
            {
                return;
            }

            try
            {
                BuildSettings = new BuildSettingsChanges(array);
            }
            catch (System.Exception e)
            {
                Debug.LogWarning("EgoXproject: Corrupt build settings section in " + SavePath + " : " + e.Message);
            }
        }
Пример #11
0
        PListArray ParseArray(IEnumerable <XElement> elements)
        {
            PListArray arrayElement = new PListArray();

            foreach (XElement e in elements)
            {
                IPListElement value = ParseValue(e);

                if (value != null)
                {
                    arrayElement.Add(value);
                }
            }

            return(arrayElement);
        }
Пример #12
0
        void LoadScripts(PListArray array)
        {
            if (array == null)
            {
                return;
            }

            try
            {
                Scripts = new ScriptChanges(array);
            }
            catch
            {
                Debug.LogWarning("EgoXproject: Corrupt scripts section in " + SavePath);
            }
        }
Пример #13
0
 public XcodeChangeFile()
 {
     IsDirty            = false;
     SavePath           = "";
     Platform           = BuildPlatform.iOS;
     Frameworks         = new FrameworkChanges();
     FilesAndFolders    = new FilesAndFolderChanges();
     Scripts            = new ScriptChanges();
     BuildSettings      = new BuildSettingsChanges();
     InfoPlistChanges   = new PListDictionary();
     AppConfig          = new PListDictionary();
     AppConfigEnabled   = new PListArray();
     ManualEntitlements = new PListDictionary();
     Signing            = new SigningChanges();
     Capabilities       = new CapabilitiesChanges();
 }
Пример #14
0
        //Associated Domains
        void ApplyAssociatedDomainsCapability(AssociatedDomainsCapability capability)
        {
            //update pbxproject
            _pbxproj.EnableSystemCapability("com.apple.SafariKeychain", true);
            //update entitlements file
            var entitlementChanges = new PListDictionary();
            var domains            = new PListArray();

            entitlementChanges.Add("com.apple.developer.associated-domains", domains);

            foreach (var item in capability.AssociatedDomains)
            {
                domains.Add(item);
            }

            ApplyEntitlementsChanges(entitlementChanges, true);
        }
Пример #15
0
        //App Groups
        void ApplyAppGroupsCapability(AppGroupsCapability capability)
        {
            //update pbxproject
            _pbxproj.EnableSystemCapability("com.apple.ApplicationGroups.iOS", true);
            //update entitlements file
            var entitlementChanges = new PListDictionary();
            var groups             = new PListArray();

            entitlementChanges.Add("com.apple.security.application-groups", groups);

            foreach (var item in capability.AppGroups)
            {
                groups.Add(item);
            }

            ApplyEntitlementsChanges(entitlementChanges, true);
        }
Пример #16
0
        public ScriptChanges(PListArray array)
        {
            if (array == null)
            {
                return;
            }

            for (int ii = 0; ii < array.Count; ++ii)
            {
                var entry = array.DictionaryValue(ii);

                if (entry != null)
                {
                    _scripts.Add(new ScriptEntry(entry));
                }
            }
        }
Пример #17
0
        //Apple Pay (In App Payments)
        void ApplyApplePayCapability(ApplePayCapability capability)
        {
            //update pbxproject
            _pbxproj.EnableSystemCapability("com.apple.ApplePay", true);
            //update entitlements file
            var entitlementChanges = new PListDictionary();
            var groups             = new PListArray();

            entitlementChanges.Add("com.apple.developer.in-app-payments", groups);

            foreach (var item in capability.MerchantIds)
            {
                groups.Add(item);
            }

            ApplyEntitlementsChanges(entitlementChanges, true);
        }
Пример #18
0
        //Keychain Sharing
        void ApplyKeychainSharingCapability(KeychainSharingCapability capability)
        {
            //update pbxproject
            _pbxproj.EnableSystemCapability("com.apple.Keychain", true);
            //update entitlements file
            var entitlementChanges = new PListDictionary();
            var groups             = new PListArray();

            entitlementChanges.Add("keychain-access-groups", groups);

            foreach (var item in capability.KeychainGroups)
            {
                groups.Add("$(AppIdentifierPrefix)" + item);
            }

            ApplyEntitlementsChanges(entitlementChanges, true);
        }
Пример #19
0
        public override PListDictionary Serialize()
        {
            var dic = new PListDictionary();

            if (GameControllers != null && GameControllers.Length > 0)
            {
                var controllers = new PListArray();

                foreach (var c in GameControllers)
                {
                    controllers.Add(c.ToString());
                }

                dic.Add(SUPPORTED_GAME_CONTROLLERS_KEY, controllers);
            }

            return(dic);
        }
Пример #20
0
        void MergePListArray(PListArray main, PListArray other)
        {
            foreach (var el in other)
            {
                //don't overwrite string with empty strings
                var str = el as PListString;

                if (str != null)
                {
                    if (main.Contains(el) && string.IsNullOrEmpty(str.Value))
                    {
                        continue;
                    }
                }

                main.Add(el);
            }
        }
Пример #21
0
        public override PListDictionary Serialize()
        {
            var dic = base.Serialize();

            if (_entries.Count > 0)
            {
                var entriesArray = new PListArray();

                foreach (var entry in _entries)
                {
                    entriesArray.Add(entry.Serialize());
                }

                dic.Add(ENTRIES_KEY, entriesArray);
            }

            return(dic);
        }
Пример #22
0
        public override PListDictionary Serialize()
        {
            var dic = new PListDictionary();

            if (UserManagement != null && UserManagement.Length > 0)
            {
                var controllers = new PListArray();

                foreach (var c in UserManagement)
                {
                    controllers.Add(c.ToString());
                }

                dic.Add(USER_MANAGEMENT_KEY, controllers);
            }

            return(dic);
        }
Пример #23
0
        public bool LanguageEnabled(string key)
        {
            if (AppConfig == null)
            {
                Debug.LogError("No app config!");
            }

            if (!AppConfig.ContainsKey(LANGUAGES_DICT_KEY))
            {
                return(false);
            }
            PListArray arr = AppConfig[LANGUAGES_DICT_KEY] as PListArray;

            if (arr == null || arr.Count == 0)
            {
                return(false);
            }

            return(arr.Contains(new PListString(key)));
        }
Пример #24
0
        void MergeArrays(PListArray original, PListArray toMerge, bool keepEmpty)
        {
            foreach (var element in toMerge)
            {
                if (element is PListDictionary)
                {
                    var originalDic = new PListDictionary();
                    MergeDictionaries(originalDic, element as PListDictionary, keepEmpty, false);

                    if (!keepEmpty && originalDic.Count > 0)
                    {
                        original.Add(originalDic);
                    }
                }
                else if (element is PListArray)
                {
                    var originalArray = new PListArray();
                    MergeArrays(originalArray, element as PListArray, keepEmpty);

                    if (!keepEmpty && originalArray.Count > 0)
                    {
                        original.Add(originalArray);
                    }
                }
                else
                {
                    if (string.IsNullOrEmpty(element.ToString()))
                    {
                        continue;
                    }

                    var matchedElements = ArrayContainsElement(original, element);

                    if (matchedElements == null)
                    {
                        original.Add(element);
                    }
                }
            }
        }
Пример #25
0
        public override IPListElement Serialize()
        {
            var array = new PListArray();

            foreach (var entry in _buildSettings)
            {
                //don't save empty entries
                if (entry is CustomStringBuildSettingEntry)
                {
                    var custom = entry as CustomStringBuildSettingEntry;

                    if (string.IsNullOrEmpty(custom.Name) && string.IsNullOrEmpty(custom.Value))
                    {
                        continue;
                    }
                }

                array.Add(entry.Serialize());
            }

            return(array);
        }
Пример #26
0
        public PListDictionary Serialize()
        {
            var dic = new PListDictionary();

            dic.Add(ACTIVE_CONFIGURATION_KEY, _activeConfiguration);
            var configs = new PListDictionary();

            foreach (var kvp in _configurations)
            {
                var entries = new PListArray();

                foreach (var e in kvp.Value)
                {
                    entries.Add(e);
                }

                configs.Add(kvp.Key, entries);
            }

            dic.Add(CONFIGURATIONS_KEY, configs);
            return(dic);
        }
Пример #27
0
        //Background Modes
        void ApplyBackgroundModesCapability(BackgroundModesCapability capability)
        {
            //update pbxproject
            switch (_platform)
            {
            case BuildPlatform.tvOS:
                _pbxproj.EnableSystemCapability("com.apple.BackgroundModes.appletvos", true);
                break;

            case BuildPlatform.iOS:
            default:
                _pbxproj.EnableSystemCapability("com.apple.BackgroundModes", true);
                break;
            }

            //update info.plist
            var modes = new PListArray();

            if (capability.UsesBTLEAcc)
            {
                modes.Add("bluetooth-central");
            }

            if (capability.AudioAirplayPIP)
            {
                modes.Add("audio");
            }

            if (capability.ActsAsBTLEAcc)
            {
                modes.Add("bluetooth-peripheral");
            }

            if (capability.ExternalAccComms)
            {
                modes.Add("external-accessory");
            }

            if (capability.BackgroundFetch)
            {
                modes.Add("fetch");
            }

            if (capability.LocationUpdates)
            {
                modes.Add("location");
            }

            if (capability.NewsstandDownloads)
            {
                modes.Add("newsstand-content");
            }

            if (capability.RemoteNotifications)
            {
                modes.Add("remote-notification");
            }

            if (capability.VOIP)
            {
                modes.Add("voip");
            }

            if (modes.Count > 0)
            {
                var changes = new PListDictionary();
                changes.Add("UIBackgroundModes", modes);
                ApplyInfoPlistChanges(changes);
            }

            //update entitlements file
        }
Пример #28
0
        IPListElement[] ArrayContainsElement(PListArray original, IPListElement element)
        {
            if (element is PListString)
            {
                var strings = original.Where(o => o is PListString).ToArray();

                if (strings != null)
                {
                    var e        = element as PListString;
                    var selected = strings.Where(o => o.Equals(e));

                    if (selected != null && selected.Count() > 0)
                    {
                        return(selected.ToArray());
                    }
                }
            }
            else if (element is PListInteger)
            {
                var ints = original.Where(o => o is PListInteger).ToArray();

                if (ints != null)
                {
                    var e        = element as PListInteger;
                    var selected = ints.Where(o => o.Equals(e));

                    if (selected != null && selected.Count() > 0)
                    {
                        return(selected.ToArray());
                    }
                }
            }
            else if (element is PListBoolean)
            {
                var bools = original.Where(o => o is PListBoolean).ToArray();

                if (bools != null)
                {
                    var e        = element as PListBoolean;
                    var selected = bools.Where(o => o.Equals(e));

                    if (selected != null && selected.Count() > 0)
                    {
                        return(selected.ToArray());
                    }
                }
            }
            else if (element is PListReal)
            {
                var reals = original.Where(o => o is PListReal).ToArray();

                if (reals != null)
                {
                    var e        = element as PListReal;
                    var selected = reals.Where(o => o.Equals(e));

                    if (selected != null && selected.Count() > 0)
                    {
                        return(selected.ToArray());
                    }
                }
            }
            else if (element is PListData)
            {
                var datas = original.Where(o => o is PListData).ToArray();

                if (datas != null)
                {
                    var e        = element as PListData;
                    var selected = datas.Where(o => o.Equals(e));

                    if (selected != null && selected.Count() > 0)
                    {
                        return(selected.ToArray());
                    }
                }
            }
            else if (element is PListDate)
            {
                var dates = original.Where(o => o is PListDate).ToArray();

                if (dates != null)
                {
                    var e        = element as PListDate;
                    var selected = dates.Where(o => o.Equals(e));

                    if (selected != null && selected.Count() > 0)
                    {
                        return(selected.ToArray());
                    }
                }
            }

            return(null);
        }
Пример #29
0
        //Maps
        void ApplyMapsCapability(MapsCapability capability)
        {
            //update pbxproject
            _pbxproj.EnableSystemCapability("com.apple.Maps.iOS", true);
            _pbxproj.AddSystemFramework("MapKit.framework", LinkType.Required);
            //update info.plist
            var changes = new PListDictionary();
            var modes   = new PListArray();

            if (capability.Airplane)
            {
                modes.Add("MKDirectionsModePlane");
            }

            if (capability.Bike)
            {
                modes.Add("MKDirectionsModeBike");
            }

            if (capability.Bus)
            {
                modes.Add("MKDirectionsModeBus");
            }

            if (capability.Car)
            {
                modes.Add("MKDirectionsModeCar");
            }

            if (capability.Ferry)
            {
                modes.Add("MKDirectionsModeFerry");
            }

            if (capability.Other)
            {
                modes.Add("MKDirectionsModeOther");
            }

            if (capability.Pedestrian)
            {
                modes.Add("MKDirectionsModePedestrian");
            }

            if (capability.RideSharing)
            {
                modes.Add("MKDirectionsModeRideShare");
            }

            if (capability.Streetcar)
            {
                modes.Add("MKDirectionsModeStreetCar");
            }

            if (capability.Subway)
            {
                modes.Add("MKDirectionsModeSubway");
            }

            if (capability.Taxi)
            {
                modes.Add("MKDirectionsModeTaxi");
            }

            if (capability.Train)
            {
                modes.Add("MKDirectionsModeTrain");
            }

            if (modes.Count > 0)
            {
                changes.Add("MKDirectionsApplicationSupportedModes", modes);
                var docType = new PListDictionary();
                docType.Add("CFBundleTypeName", "MKDirectionsRequest");
                docType.Add("LSItemContentTypes", new PListArray("com.apple.maps.directionsrequest"));
                var docTypes = new PListArray(docType);
                changes.Add("CFBundleDocumentTypes", docTypes);
                ApplyInfoPlistChanges(changes);
            }
        }
Пример #30
0
        //iCloud
        void ApplyICloudCapability(ICloudCapability capability)
        {
            //update pbxproject
            _pbxproj.EnableSystemCapability("com.apple.iCloud", true);

            if (capability.CloudKit)
            {
                _pbxproj.AddSystemFramework("CloudKit.framework", LinkType.Required);
                //ensure push is enabled with cloudkit
                ApplyPushNotificationsCapability(new PushNotificationsCapability());
            }

            //update entitlements file
            var entitlementChanges   = new PListDictionary();
            var services             = new PListArray();
            var ubiquityContainerIds = new PListArray();
            var iCloudContainerIds   = new PListArray();

            if (capability.iCloudDocuments)
            {
                services.Add("CloudDocuments");
            }

            if (capability.CloudKit)
            {
                services.Add("CloudKit");
            }

            if (capability.iCloudDocuments || capability.CloudKit)
            {
                if (capability.UseCustomContainers)
                {
                    foreach (var item in capability.CustomContainers)
                    {
                        iCloudContainerIds.Add(item);

                        if (capability.iCloudDocuments)
                        {
                            ubiquityContainerIds.Add(item);
                        }
                    }
                }
                else
                {
                    iCloudContainerIds.Add("iCloud.$(CFBundleIdentifier)");

                    if (capability.iCloudDocuments)
                    {
                        ubiquityContainerIds.Add("iCloud.$(CFBundleIdentifier)");
                    }
                }
            }

            //always add, even if empty
            entitlementChanges.Add("com.apple.developer.icloud-container-identifiers", iCloudContainerIds);

            if (services.Count > 0)
            {
                entitlementChanges.Add("com.apple.developer.icloud-services", services);
            }

            if (ubiquityContainerIds.Count > 0)
            {
                entitlementChanges.Add("com.apple.developer.ubiquity-container-identifiers", ubiquityContainerIds);
            }

            if (capability.KeyValueStorage)
            {
                entitlementChanges.Add("com.apple.developer.ubiquity-kvstore-identifier", "$(TeamIdentifierPrefix)$(CFBundleIdentifier)");
            }

            ApplyEntitlementsChanges(entitlementChanges, true);
        }