forked from microsoft/BotBuilder-Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding sample bot that renders several types of cards as attachments
- Loading branch information
Robert Standefer
committed
Mar 8, 2017
1 parent
27fc422
commit 603e002
Showing
85 changed files
with
3,294 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,219 @@ | ||
<StyleCopSettings Version="105"> | ||
<Analyzers> | ||
<Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules"> | ||
<Rules> | ||
<Rule Name="ElementsMustBeDocumented"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="PartialElementsMustBeDocumented"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="EnumerationItemsMustBeDocumented"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="DocumentationMustContainValidXml"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="ElementDocumentationMustHaveSummary"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="PartialElementDocumentationMustHaveSummary"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="ElementDocumentationMustHaveSummaryText"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="PartialElementDocumentationMustHaveSummaryText"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="ElementDocumentationMustNotHaveDefaultSummary"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="ElementParametersMustBeDocumented"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="ElementParameterDocumentationMustMatchElementParameters"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="ElementParameterDocumentationMustDeclareParameterName"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="ElementParameterDocumentationMustHaveText"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="ElementReturnValueMustBeDocumented"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="ElementReturnValueDocumentationMustHaveText"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="VoidReturnValueMustNotBeDocumented"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="GenericTypeParametersMustBeDocumented"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="GenericTypeParametersMustBeDocumentedPartialClass"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="GenericTypeParameterDocumentationMustMatchTypeParameters"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="GenericTypeParameterDocumentationMustDeclareParameterName"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="GenericTypeParameterDocumentationMustHaveText"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="PropertySummaryDocumentationMustMatchAccessors"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="PropertySummaryDocumentationMustOmitSetAccessorWithRestrictedAccess"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="ElementDocumentationMustNotBeCopiedAndPasted"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="SingleLineCommentsMustNotUseDocumentationStyleSlashes"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="DocumentationTextMustNotBeEmpty"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="DocumentationTextMustContainWhitespace"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="DocumentationMustMeetCharacterPercentage"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="ConstructorSummaryDocumentationMustBeginWithStandardText"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="DestructorSummaryDocumentationMustBeginWithStandardText"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="DocumentationHeadersMustNotContainBlankLines"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="IncludedDocumentationXPathDoesNotExist"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="IncludeNodeDoesNotContainValidFileAndPath"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="InheritDocMustBeUsedWithInheritingClass"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="ElementDocumentationMustBeSpelledCorrectly"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="FileMustHaveHeader"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="FileHeaderMustShowCopyright"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="FileHeaderMustHaveCopyrightText"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="FileHeaderMustContainFileName"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="FileHeaderFileNameDocumentationMustMatchFileName"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="FileHeaderMustHaveValidCompanyText"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
<Rule Name="FileHeaderFileNameDocumentationMustMatchTypeName"> | ||
<RuleSettings> | ||
<BooleanProperty Name="Enabled">False</BooleanProperty> | ||
</RuleSettings> | ||
</Rule> | ||
</Rules> | ||
<AnalyzerSettings /> | ||
</Analyzer> | ||
</Analyzers> | ||
</StyleCopSettings> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<configSections> | ||
<section name="codeItemsSection" type="SourceTool.CodeItemsSection, SourceTool" /> | ||
</configSections> | ||
|
||
<codeItemsSection> | ||
<codeItems> | ||
<!-- we can use regex because we know function is implemented at the end of the class [regexs are not good to handle non-regular langs] --> | ||
<add typeRegex="\s([\S]+)\s:\sRichCardScorable[^{]+{" | ||
codeRegex="IList<Attachment>\sGetCardAttachments\(\)[^{]+{([\s\S]+)}[^}]+}[^}]+"> | ||
<replacements> | ||
<add replacementRegex="return\s" replacementValue="message.Attachments = " /> | ||
</replacements> | ||
</add> | ||
</codeItems> | ||
</codeItemsSection> | ||
|
||
<system.diagnostics> | ||
<trace autoflush="false" indentsize="4"> | ||
<listeners> | ||
<add name="configConsoleListener" type="System.Diagnostics.ConsoleTraceListener" /> | ||
</listeners> | ||
</trace> | ||
</system.diagnostics> | ||
|
||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> | ||
</startup> | ||
</configuration> |
17 changes: 17 additions & 0 deletions
17
CSharp/demo-CardsAttachments/SourceTool/CodeItemCollection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace SourceTool | ||
{ | ||
using System.Configuration; | ||
|
||
public class CodeItemCollection : ConfigurationElementCollection | ||
{ | ||
protected override ConfigurationElement CreateNewElement() | ||
{ | ||
return new CodeItemElement(); | ||
} | ||
|
||
protected override object GetElementKey(ConfigurationElement element) | ||
{ | ||
return ((CodeItemElement)element).TypeRegex; | ||
} | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
CSharp/demo-CardsAttachments/SourceTool/CodeItemElement.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
namespace SourceTool | ||
{ | ||
using System.Configuration; | ||
using System.Text.RegularExpressions; | ||
|
||
public class CodeItemElement : ConfigurationElement | ||
{ | ||
private Regex typeRegex; | ||
private Regex codeRegex; | ||
|
||
[ConfigurationProperty("typeRegex", IsRequired = true)] | ||
public string TypeRegex | ||
{ | ||
get | ||
{ | ||
return (string)this["typeRegex"]; | ||
} | ||
|
||
set | ||
{ | ||
this["typeRegex"] = value; | ||
} | ||
} | ||
|
||
[ConfigurationProperty("codeRegex", IsRequired = true)] | ||
public string CodeRegex | ||
{ | ||
get | ||
{ | ||
return (string)this["codeRegex"]; | ||
} | ||
|
||
set | ||
{ | ||
this["codeRegex"] = value; | ||
} | ||
} | ||
|
||
[ConfigurationProperty("replacements")] | ||
public CodeReplacementCollection Replacements | ||
{ | ||
get | ||
{ | ||
return (CodeReplacementCollection)this["replacements"]; | ||
} | ||
|
||
set | ||
{ | ||
this["replacements"] = value; | ||
} | ||
} | ||
|
||
public Regex GetTypeRegex() | ||
{ | ||
if (this.typeRegex == null) | ||
{ | ||
this.typeRegex = new Regex(this.TypeRegex, RegexOptions.Compiled); | ||
} | ||
|
||
return this.typeRegex; | ||
} | ||
|
||
public Regex GetCodeRegex() | ||
{ | ||
if (this.codeRegex == null) | ||
{ | ||
this.codeRegex = new Regex(this.CodeRegex, RegexOptions.Compiled); | ||
} | ||
|
||
return this.codeRegex; | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
CSharp/demo-CardsAttachments/SourceTool/CodeItemsSection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
namespace SourceTool | ||
{ | ||
using System.Configuration; | ||
|
||
public class CodeItemsSection : ConfigurationSection | ||
{ | ||
[ConfigurationProperty("codeItems")] | ||
public CodeItemCollection CodeItems | ||
{ | ||
get | ||
{ | ||
return (CodeItemCollection)this["codeItems"]; | ||
} | ||
|
||
set | ||
{ | ||
this["codeItems"] = value; | ||
} | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
CSharp/demo-CardsAttachments/SourceTool/CodeNodeComparer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace SourceTool | ||
{ | ||
using System.Collections.Generic; | ||
using System.Xml.Linq; | ||
|
||
internal class CodeNodeComparer : IEqualityComparer<XNode> | ||
{ | ||
public bool Equals(XNode x, XNode y) | ||
{ | ||
return (x as XElement).Attribute("type").ToString().Equals((y as XElement).Attribute("type").ToString()); | ||
} | ||
|
||
public int GetHashCode(XNode obj) | ||
{ | ||
return (obj as XElement).Attribute("type").ToString().GetHashCode(); | ||
} | ||
} | ||
} |
Oops, something went wrong.