コード例 #1
0
        public static List <T> ReadObjectList <T>(BinaryReader handle) where T : IObjectToString
        {
            List <T> retList = new List <T>();

            if (ReadInt(handle) > 0)
            {
                IObjectToString instance = Activator.CreateInstance(typeof(T)) as IObjectToString;
                instance.ToObject(ReadString(handle));
                retList.Add((T)instance);
            }
            return(retList);
        }
コード例 #2
0
        public static string GetDefaultToStringInformation(this IObjectToString targetObject, uint n)
        {
            var spaces     = Spaces(n);
            var nextN      = n + 4;
            var sb         = new StringBuilder();
            var nameOfType = targetObject.GetType().FullName;

            sb.AppendLine($"{spaces}Begin {nameOfType}");
            sb.Append(targetObject.PropertiesToString(nextN));
            sb.AppendLine($"{spaces}End {nameOfType}");
            return(sb.ToString());
        }
コード例 #3
0
        public static void PrintObjProp(this StringBuilder sb, uint n, string propName, IObjectToString obj)
        {
            var spaces = Spaces(n);
            var nextN  = n + 4;

            if (obj == null)
            {
                sb.AppendLine($"{spaces}{propName} = NULL");
            }
            else
            {
                sb.AppendLine($"{spaces}Begin {propName}");
                sb.Append(obj.ToString(nextN));
                sb.AppendLine($"{spaces}End {propName}");
            }
        }