private void AddDataToArray(object value, PlistElementArray elementArray) { if (value is int) { elementArray.AddInteger(Convert.ToInt32(value)); } else if (value is bool) { elementArray.AddBoolean(Convert.ToBoolean(value)); } else if (value is string) { elementArray.AddString(value.ToString()); } else if (value is float) { elementArray.AddReal(Convert.ToSingle(value)); } }
private static void AddConfig(PlistElementArray ary, List <object> values) { foreach (var v in values) { if (v is int) { ary.AddInteger((int)v); } else if (v is string) { ary.AddString((string)v); } else if (v is bool) { ary.AddBoolean((bool)v); } else if (v is Dictionary <string, object> ) { var parent = ary.AddDict(); AddConfig(parent, (Dictionary <string, object>)v); } } }
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); } } } }