/// <summary>
        /// Gets the meta information of the commandment.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="commandment">The commandment.</param>
        /// <param name="metaType">Type of the meta.</param>
        /// <returns></returns>
        public static T Meta <T>(this CommandmentBase commandment, CommandmentMetaType metaType)
        {
            CommandmentMeta meta;

            commandmentTypeMeta.TryGetValue(commandment.GetType(), out meta);
            return(meta != null ? (T)meta.Value : default(T));
        }
Пример #2
0
        /// <summary>
        /// Generates and displays the current commandment graph, along with basic statistics and next steps.
        /// </summary>
        /// <param name="args">Unused.</param>
        private static void Main(string[] args)
        {
            commandmentTypes = (from type in typeof(CommandmentBase).Assembly.GetTypes()
                                where typeof(CommandmentBase).IsAssignableFrom(type) && !type.IsAbstract
                                select type).ToArray();
            commandments = commandmentTypes.Select(cmdType => CommandmentBase.CreateInstance(cmdType));

            EnsureNoDuplicates();
            PrintStatistics();
            PrintNextCommandmentsToBeMapped();
            GenerateCommandmentsHierarchyImage();

            Console.WriteLine();
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey(true);
        }
 /// <summary>
 /// Sets meta information on the commandment.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="commandment">The commandment.</param>
 /// <param name="type">The type.</param>
 /// <param name="value">The value.</param>
 public static void Meta <T>(this CommandmentBase commandment, CommandmentMetaType type, T value)
 {
     commandmentTypeMeta[commandment.GetType()] = new CommandmentMeta {
         Type = type, Value = value
     };
 }