コード例 #1
0
 public void GenerateDocumentation(IDocumentationGenerator generator)
 {
     if (GoldCost != 0)
     {
         generator.PropertyValuePair("Cost", $"{GoldCost}{Naming.Gold}");
     }
 }
コード例 #2
0
 public void create_stubs()
 {
     StubWriter          = MockRepository.GenerateStub <IScreenWriter>();
     StubDocGen          = MockRepository.GenerateStub <IDocumentationGenerator>();
     StubEventAggregator = MockRepository.GenerateStub <IEventAggregator>();
     StubEventAggregator.Stub(x => x.GetEvent <WarningEvent>()).Return(new WarningEvent());
     StubEventAggregator.Stub(x => x.GetEvent <BadFileEvent>()).Return(new BadFileEvent());
 }
コード例 #3
0
ファイル: Arguments.cs プロジェクト: jujis008/docu
 public void create_stubs()
 {
     StubDocGen = MockRepository.GenerateStub<IDocumentationGenerator>();
     StubWriter = MockRepository.GenerateStub<IScreenWriter>();
     StubEventAggregator = MockRepository.GenerateStub<IEventAggregator>();
     StubEventAggregator.Stub(x => x.GetEvent<WarningEvent>()).Return(new WarningEvent());
     StubEventAggregator.Stub(x => x.GetEvent<BadFileEvent>()).Return(new BadFileEvent());
 }
コード例 #4
0
            public void GenerateDocumentation(IDocumentationGenerator generator)
            {
                var shows = new List <string>();

                if (ShowGold)
                {
                    shows.Add($"Gold");
                }
                if (ShowGeneral)
                {
                    shows.Add($"Age, Clan, Culture, Health");
                }
                if (ShowTopSkills)
                {
                    shows.Add($"Skills greater than {MinSkillToShow}");
                }
                if (ShowAttributes)
                {
                    shows.Add($"Attributes");
                }
                if (ShowEquipment)
                {
                    shows.Add($"Equipment tier");
                }
                if (ShowInventory)
                {
                    shows.Add($"Battle equipment inventory");
                }
                if (ShowCivilianInventory)
                {
                    shows.Add($"Civilian equipment inventory");
                }
                if (ShowStorage)
                {
                    shows.Add($"Custom item storage");
                }
                if (ShowRetinue)
                {
                    shows.Add($"Retinue count and average tier");
                }
                if (ShowRetinueList)
                {
                    shows.Add($"Retinue unit list");
                }
                if (ShowAchievements)
                {
                    shows.Add($"Achievements");
                }
                if (ShowTrackedStats)
                {
                    shows.Add($"Tracked stats");
                }
                if (ShowPowers)
                {
                    shows.Add($"Powers");
                }
                generator.PropertyValuePair("Shows", string.Join(", ", shows));
            }
コード例 #5
0
ファイル: ConsoleApplication.cs プロジェクト: wsky/docu
        public ConsoleApplication(IScreenWriter screenWriter, IDocumentationGenerator documentationGenerator, IEventAggregator eventAggregator)
        {
            this.screenWriter           = screenWriter;
            this.documentationGenerator = documentationGenerator;
            this.eventAggregator        = eventAggregator;

            WireUpListeners();
            DefineSwitches();
        }
コード例 #6
0
 public static IDocumentationGenerator PropertyValuePair(this IDocumentationGenerator generator,
                                                         string property, Action content)
 {
     return(generator.Div("value", () =>
     {
         generator.P($"<strong class=\"value\">{property}</strong>:");
         content();
     }));
 }
コード例 #7
0
 public void GenerateDocumentation(IDocumentationGenerator generator)
 {
     generator.PropertyValuePair("Skills", $"{(Auto ? "Automatic, based on class, equipment, and existing skills" : Skills)}");
     generator.PropertyValuePair("XP", $"{AmountLow}" + (AmountLow == AmountHigh ? $"" : $" to {AmountHigh}"));
     if (GoldCost != 0)
     {
         generator.PropertyValuePair("Costs", $"{GoldCost}{Naming.Gold}");
     }
 }
コード例 #8
0
 public void GenerateDocumentation(IDocumentationGenerator generator)
 {
     generator.PropertyValuePair("Reflect", $"{ReflectPercent:0}%");
     if (ReflectedDamageIsSubtracted)
     {
         generator.Value($"Reflected damage is subtracted from incoming damage");
     }
     generator.PropertyValuePair(nameof(HitBehavior).SplitCamelCase(), HitBehavior.ToString());
 }
コード例 #9
0
 public void GenerateDocumentation(IDocumentationGenerator generator)
 {
     generator.P(Random ? "Random attribute" : "Provide the attribute name (or part of it) when calling this");
     generator.PropertyValuePair("Amount", $"{AmountLow}" + (AmountLow == AmountHigh ? $"" : $" to {AmountHigh}"));
     if (GoldCost != 0)
     {
         generator.P($"Costs {GoldCost}{Naming.Gold}");
     }
 }
コード例 #10
0
        public ConsoleApplication(IScreenWriter screenWriter, IDocumentationGenerator documentationGenerator, IEventAggregator eventAggregator)
        {
            this.screenWriter = screenWriter;
            this.documentationGenerator = documentationGenerator;
            this.eventAggregator = eventAggregator;

            WireUpListeners();
            DefineSwitches();
        }
コード例 #11
0
 private static void AutoDocumentCollection(IDocumentationGenerator generator, IEnumerable obj)
 {
     generator.Table(() =>
     {
         foreach (object o in obj)
         {
             generator.TR(() => generator.TD(() => AutoDocument(generator, o)));
         }
     });
 }
コード例 #12
0
        public void Setup()
        {
            _generateClassDocs       = 0;
            _generateInterfaceDocs   = 0;
            _generateMethodDocs      = 0;
            _generateConstructorDocs = 0;
            _generatePropertyDocs    = 0;
            _generateFieldDocs       = 0;
            _generateEnumDocs        = 0;
            _generateStructDocs      = 0;

            _documentationGenerator = Substitute.For <IDocumentationGenerator>();

            _documentationGenerator.When(x =>
                                         x.GenerateClassDocs(Arg.Any <ClassDeclarationSyntax>())).Do(_ => _generateClassDocs++);
            _documentationGenerator.When(x =>
                                         x.GenerateInterfaceDocs(Arg.Any <InterfaceDeclarationSyntax>())).Do(_ => _generateInterfaceDocs++);
            _documentationGenerator.When(x =>
                                         x.GenerateMethodDocs(Arg.Any <MethodDeclarationSyntax>())).Do(_ => _generateMethodDocs++);
            _documentationGenerator.When(x =>
                                         x.GenerateConstructorDocs(Arg.Any <ConstructorDeclarationSyntax>())).Do(_ => _generateConstructorDocs++);
            _documentationGenerator.When(x =>
                                         x.GeneratePropertyDocs(Arg.Any <PropertyDeclarationSyntax>())).Do(_ => _generatePropertyDocs++);
            _documentationGenerator.When(x =>
                                         x.GenerateFieldDocs(Arg.Any <FieldDeclarationSyntax>())).Do(_ => _generateFieldDocs++);
            _documentationGenerator.When(x =>
                                         x.GenerateEnumDocs(Arg.Any <EnumDeclarationSyntax>())).Do(_ => _generateEnumDocs++);
            _documentationGenerator.When(x =>
                                         x.GenerateStructDocs(Arg.Any <StructDeclarationSyntax>())).Do(_ => _generateStructDocs++);

            _xmlDocCreator = new XmlDocCreator(_documentationGenerator);

            _xmlDocCreator.CreateDocLines(1, "class Test {}");
            _xmlDocCreator.CreateDocLines(1, "interface ITest {}");
            _xmlDocCreator.CreateDocLines(3,
                                          @"class Test
{
    public int Method() { }
}");
            _xmlDocCreator.CreateDocLines(3,
                                          @"class Test
{
    public Test() { }
}");
            _xmlDocCreator.CreateDocLines(1, "public int Test {get;set;}");
            _xmlDocCreator.CreateDocLines(1, "public int Test;");
            _xmlDocCreator.CreateDocLines(1, "public enum Test");
            _xmlDocCreator.CreateDocLines(1, "public struct Test {}");
        }
コード例 #13
0
        private static void AutoDocumentObject(IDocumentationGenerator generator, object obj)
        {
            var objType = obj.GetType();

            var categoryOrders = objType
                                 .GetCustomAttributes(inherit: true)
                                 .OfType <CategoryOrderAttribute>()
                                 .ToList();

            var properties = objType.GetProperties()
                             .Select(p => (p, doc: p.GetCustomAttribute <DocumentAttribute>()))
                             .Where(p => p.doc != null)
                             .GroupBy(p => p.p.GetCustomAttribute <CategoryAttribute>())
                             .OrderBy(g => categoryOrders.FirstOrDefault(c => c.Category == g.Key?.Category)?.Order ?? -int.MaxValue);

            foreach (var c in properties)
            {
                if (c.Key?.Category != null)
                {
                    generator.H2(c.Key.Category);
                }
                generator.Table(() =>
                {
                    var categoryItems = c.OrderBy(p =>
                                                  p.p.GetCustomAttribute <PropertyOrderAttribute>()?.Order ?? -int.MaxValue);
                    foreach (var p in categoryItems)
                    {
                        string name  = p.doc?.Name ?? p.p.Name.SplitCamelCase();
                        string desc  = p.doc?.Description ?? p.p.GetCustomAttribute <DescriptionAttribute>()?.Description ?? string.Empty;
                        object value = p.p.GetValue(obj);

                        generator.TR(() =>
                        {
                            generator.TD(name);
                            generator.TD(() =>
                            {
                                if (value != null)
                                {
                                    AutoDocument(generator, value);
                                }
                            });
                            generator.TD(desc);
                        });
                    }
                });
            }
        }
コード例 #14
0
 public static void AutoDocument(IDocumentationGenerator generator, object obj)
 {
     if (obj is bool b)
     {
         generator.P(b ? "Enabled" : "Disabled");
     }
     else if (obj.GetType().IsPrimitive || obj.GetType().IsEnum || obj is string)
     {
         generator.P(obj.ToString());
     }
     else if (obj is IEnumerable col)
     {
         AutoDocumentCollection(generator, col);
     }
     else
     {
         AutoDocumentObject(generator, obj);
     }
 }
コード例 #15
0
 public void GenerateDocumentation(IDocumentationGenerator generator)
 {
     if (KnockBackChancePercent > 0)
     {
         generator.PropertyValuePair(nameof(KnockBackChancePercent).SplitCamelCase(), $"{KnockBackChancePercent:0}%");
     }
     if (KnockDownChancePercent > 0)
     {
         generator.PropertyValuePair(nameof(KnockDownChancePercent).SplitCamelCase(), $"{KnockDownChancePercent:0}%");
     }
     if (ShrugOffChancePercent > 0)
     {
         generator.PropertyValuePair(nameof(ShrugOffChancePercent).SplitCamelCase(), $"{ShrugOffChancePercent:0}%");
     }
     if (MakesRearChancePercent > 0)
     {
         generator.PropertyValuePair(nameof(MakesRearChancePercent).SplitCamelCase(), $"{MakesRearChancePercent:0}%");
     }
     if (DismountChance > 0)
     {
         generator.PropertyValuePair(nameof(DismountChance).SplitCamelCase(), $"{DismountChance:0}%");
     }
 }
コード例 #16
0
            public void GenerateDocumentation(IDocumentationGenerator generator)
            {
                generator.PropertyValuePair("Side", OnPlayerSide ? "Streamers side" : "Enemy side");
                if (HealPerSecond > 0)
                {
                    generator.PropertyValuePair("Heals", $"{HealPerSecond:0.0}HP per second while summoned");
                }
                if (GoldCost > 0)
                {
                    generator.PropertyValuePair("Cost", $"{GoldCost}{Naming.Gold}");
                }

                var allowed = new List <string>();

                if (AllowFieldBattle)
                {
                    allowed.Add("Field battle");
                }
                if (AllowVillageBattle)
                {
                    allowed.Add("Village battle");
                }
                if (AllowSiegeBattle)
                {
                    allowed.Add("Siege battle");
                }
                if (AllowFriendlyMission)
                {
                    allowed.Add("Friendly mission");
                }
                if (AllowHideOut)
                {
                    allowed.Add("Hide-out");
                }

                generator.PropertyValuePair("Allowed in", $"{string.Join(", ", allowed)}");
            }
コード例 #17
0
 public static IDocumentationGenerator PropertyValuePair(this IDocumentationGenerator generator,
                                                         string property, string value)
 {
     return(generator.Div("value", () => generator.P($"<strong class=\"value\">{property}</strong>: {value}")));
 }
コード例 #18
0
 public void GenerateDocumentation(IDocumentationGenerator generator) => generator.P(Description);
コード例 #19
0
ファイル: ConsoleApplication.cs プロジェクト: jcbozonier/docu
 public ConsoleApplication(IScreenWriter screenWriter, IDocumentationGenerator documentationGenerator)
 {
     this.screenWriter = screenWriter;
     this.documentationGenerator = documentationGenerator;
     this.documentationGenerator.BadFileEvent += documentationGenerator_BadFileEvent;
 }
コード例 #20
0
 public MainWindow()
 {
     InitializeComponent();
     facade       = new DocumentationGenerator();
     rbTypeMember = rbTrainee;
 }
コード例 #21
0
 public static IDocumentationGenerator Value(this IDocumentationGenerator generator, Action content)
 {
     return(generator.Div("value", content));
 }
コード例 #22
0
 public CommandsController(IIDEExplorer ideExplorer, IDocumentationGenerator generator)
 {
     _ideExplorer = ideExplorer;
     _generator   = generator;
 }
コード例 #23
0
 public static IDocumentationGenerator Value(this IDocumentationGenerator generator, string value)
 {
     return(generator.P("value", value));
 }
コード例 #24
0
 public void GenerateDocumentation(IDocumentationGenerator generator)
 {
     generator.PropertyValuePair("Damage", $"{DamageModifierPercent:0}%");
     generator.PropertyValuePair(nameof(AddHitBehavior).SplitCamelCase(), () => AddHitBehavior.GenerateDocumentation(generator));
     generator.PropertyValuePair(nameof(RemoveHitBehavior).SplitCamelCase(), () => RemoveHitBehavior.GenerateDocumentation(generator));
 }
コード例 #25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XmlDocCreator"/> class.
 /// </summary>
 /// <param name="documentationGenerator">The documentation generator.</param>
 public XmlDocCreator(IDocumentationGenerator documentationGenerator)
 {
     _documentationGenerator = documentationGenerator
                               ?? throw new ArgumentNullException(nameof(documentationGenerator));
 }
コード例 #26
0
ファイル: Arguments.cs プロジェクト: jcbozonier/docu
 public void create_stubs()
 {
     StubDocGen = MockRepository.GenerateStub<IDocumentationGenerator>();
 }
コード例 #27
0
 public void GenerateDocumentation(IDocumentationGenerator generator)
 {
     Retinue.GenerateDocumentation(generator);
 }
コード例 #28
0
 public CommandsController(IIdeEnvironment ide, IDocumentationGenerator generator)
 {
     _ide       = ide;
     _generator = generator;
 }
コード例 #29
0
 public void GenerateDocumentation(IDocumentationGenerator generator)
 {
     generator.PropertyValuePair("Amount", $"{Amount}{Naming.Gold}");
 }