private void AddArrayData(PlistElementArray elementArray, ICollection data) { foreach (var o in data) { if (o is ArrayList arrayList) { PlistElementArray array = elementArray.AddArray(); AddArrayData(array, arrayList); } else if (o is IDictionary dictionary) { PlistElementDict dic = elementArray.AddDict(); AddDictionaryData(dic, dictionary); } else { AddDataToArray(o, elementArray); } } }
private static void SetPlist(PBXProject proj, PlistElementArray node, ArrayList arg) { if (arg != null) { foreach (object i in arg) { object val = i; var vType = i.GetType(); if (vType == typeof(string)) { node.AddString((string)val); } else if (vType == typeof(bool)) { node.AddBoolean((bool)val); } else if (vType == typeof(double)) { int v = int.Parse(val.ToString()); node.AddInteger(v); } else if (vType == typeof(ArrayList)) { var t = node.AddArray(); var array = val as ArrayList; SetPlist(proj, t, array); } else if (vType == typeof(Hashtable)) { var t = node.AddDict(); var table = val as Hashtable; SetPlist(proj, t, table); } } } }