//////////////////////////////////////////////////////////////////////////////// // // @module IOS Deploy // @author Stanislav Osipov (Stan's Assets) // @support support@stansassets.com // //////////////////////////////////////////////////////////////////////////////// using System.Collections.Generic; using StansAssets.Foundation; namespace StansAssets.IOS.XCode { /// /// Represents XCode project info.plist key. /// [System.Serializable] public class InfoPlistKey { //Editor Use Only internal bool IsOpen = true; internal bool IsListOpen = true; /// /// Info.plist Key name /// public string Name = string.Empty; /// /// Info.plist key type /// public InfoPlistKeyType Type = InfoPlistKeyType.String; /// /// Info.plist key string value /// public string StringValue = string.Empty; /// /// Info.plist key int value /// public int IntegerValue = 0; /// /// Info.plist key float value /// public float FloatValue = 0; /// /// Info.plist key bool value /// public bool BooleanValue = true; /// /// Id's of nested keys /// public List ChildrenIds = new List(); /// /// Adds child key /// /// public void AddChild(InfoPlistKey childKey) { if (Type.Equals(InfoPlistKeyType.Dictionary)) foreach (var childId in ChildrenIds) { var var = XCodeProjectSettings.Instance.GetVariableById(childId); if (var.Name.Equals(childKey.Name)) { XCodeProjectSettings.Instance.RemoveVariable(var, ChildrenIds); break; } } var keyId = IdFactory.RandomString; XCodeProjectSettings.Instance.AddVariableToDictionary(keyId, childKey); ChildrenIds.Add(keyId); } public void RemoveChild(InfoPlistKey childKey) { XCodeProjectSettings.Instance.RemoveVariable(childKey, ChildrenIds); } public InfoPlistKey GetChildByStringValue(string val) { foreach (var child in Children) if (child.StringValue.Equals(val)) return child; return null; } public List Children { get { var children = new List(); foreach (var keyId in ChildrenIds) { var key = XCodeProjectSettings.Instance.GetVariableById(keyId); children.Add(key); } return children; } } public void Clear() { ChildrenIds.Clear(); } } }