Exemple #1
0
        static string FromAApiVersionedFieldsArray(Type type, Array ary)
        {
            System.Text.StringBuilder sb = new StringBuilder();
            string fmt = "[{0:X}" + (type.IsAbstract ? " {1}" : "") + "]: {2}\n";

            for (int i = 0; i < ary.Length; i++)
            {
                AApiVersionedFields value = (AApiVersionedFields)ary.GetValue(i);
                if (value.ContentFields.Contains("Value"))
                {
                    sb.Append(string.Format(fmt, i, value.GetType(), value["Value"]));
                }
                else
                {
                    sb.Append(string.Format(fmt, i, value.GetType(), value));
                }
            }
            return(sb.ToString().Trim('\n'));
        }
Exemple #2
0
        /// <summary>
        /// Get the TGIBlock list for a Content Field.
        /// </summary>
        /// <param name="o">The object to query.</param>
        /// <param name="f">The property name under inspection.</param>
        /// <returns>The TGIBlock list for a Content Field, if present; otherwise <c>null</c>.</returns>
        public static DependentList <TGIBlock> GetTGIBlocks(AApiVersionedFields o, string f)
        {
            string tgiBlockListCF = TGIBlockListContentFieldAttribute.GetTGIBlockListContentField(o.GetType(), f);

            if (tgiBlockListCF != null)
            {
                try
                {
                    return(o[tgiBlockListCF].Value as DependentList <TGIBlock>);
                }
                catch
                {
                }
            }
            return(null);
        }