protected override bool _extractFromString(ref string str, ref ListExtractable <T, TEmbedded> result) { bool success = false; if (result == null) { result = this; } int num = 0; if (numExtractable.ExtractOptionalFromString(ref str)) { success = true; num = numExtractable.Value; List <TEmbedded> newList = new List <TEmbedded>( ); if (num > 0) { for (int i = 0; i < num; i++) { itemExtractable = new T( ); if (itemExtractable.ExtractOptionalFromString(ref str)) { newList.Add(itemExtractable.Value); string msg = string.Empty; if (itemExtractable is IDebugDescribable) { msg = (itemExtractable as IDebugDescribable).DebugDescribe( ); } else { msg = itemExtractable.Value.ToString( ); } Debug.LogWarning("Read item " + i + " in list of " + num + " of type " + typeof(T) + " = " + msg); } else { Debug.LogWarning("Failed to read item " + i + " in list of " + num + " of type " + typeof(T)); } } } result._list = newList; Debug.Log("Extracted list of type " + typeof(T) + " with " + result._list.Count + " loaded of " + num); } return(success); }
protected override bool _addToString(ListExtractable <T, TEmbedded> target, StringBuilder sb) { bool success = false; if (target == null) { target = this; } numExtractable.Value = target._list.Count; numExtractable.AddToString(sb); if (target._list.Count > 0) { foreach (TEmbedded t in target._list) { itemExtractable = new T( ); itemExtractable.Value = t; itemExtractable.AddToString(sb); } } success = true; return(success); }