The initial source comes from sdcuike/issueBlog#4
https://github.com/PacktPublishing free to download books code by Packet
https://github.com/EbookFoundation/free-programming-books Very immense
| #pragma warning disable KMEXP00 | |
| private static ILoggerFactory loggerFactory; | |
| static async Task<string> ExtractFile(string docPath, bool isUrl = false) | |
| { | |
| var mimeTypeDetection = new MimeTypesDetection(); | |
| string mimeType; | |
| BinaryData? fileBinary; | |
| if (isUrl) | |
| { |
https://github.com/PacktPublishing free to download books code by Packet
https://github.com/EbookFoundation/free-programming-books Very immense
| //using System.Security; | |
| public static class SecureStringExtension | |
| { | |
| public static SecureString ToSecureString(this char[] self) | |
| { | |
| var secureString = new SecureString(); | |
| foreach (char c in self) | |
| { | |
| secureString.AppendChar(c); | |
| } |
| var Page_ValidationVer = "125"; | |
| var Page_IsValid = true; | |
| var Page_BlockSubmit = false; | |
| function ValidatorUpdateDisplay(val) { | |
| if (typeof(val.display) == "string") { | |
| if (val.display == "None") { | |
| return; | |
| } | |
| if (val.display == "Dynamic") { | |
| val.style.display = val.isvalid ? "none" : "inline"; |
| const char dateRangeSeparator = '~'; | |
| var dateFormsts = new string[] | |
| { | |
| "yyyyMMdd HHmm", | |
| "yyyyMMdd HH", | |
| "yyyyMMdd", | |
| "MMdd HHmm", | |
| "MMdd HH", | |
| "MMdd" | |
| }; |
| using System; | |
| using System.Collections.Generic; | |
| using System.Diagnostics; | |
| using System.Linq; | |
| using System.Net; | |
| using System.Net.Http; | |
| using System.Security.Cryptography; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| using System.Web.Configuration; |
| public async Task<HttpResponseMessage> Post([FromBody]Activity activity) | |
| { | |
| if (activity.Type == ActivityTypes.Message) | |
| { | |
| var replyMessage = $"你輸入了 **{activity.Text}**,共輸入了**{activity.Text.Length}**個字"; | |
| //建立要回覆的 Activity | |
| var reply = activity.CreateReply(replyMessage); | |
| //建立連線 | |
| var connector = new ConnectorClient(new Uri(activity.ServiceUrl)); | |
| await connector.Conversations.ReplyToActivityAsync(reply); |
| public async Task<HttpResponseMessage> Post([FromBody]Activity activity) | |
| { | |
| if (activity.Type == ActivityTypes.Message) | |
| { | |
| var replyMessage = $"你輸入了 **{activity.Text}**,共輸入了**{activity.Text.Length}**個字"; | |
| var connector = new ConnectorClient(new Uri(activity.ServiceUrl)); | |
| // User的資訊是 From | |
| var userAccount = new ChannelAccount(activity.From.Id); | |
| // Bot 的資訊是 Recipient |
| public async Task<HttpResponseMessage> Post([FromBody]Activity activity) | |
| { | |
| if (activity.Type == ActivityTypes.Message) | |
| { | |
| var replyMessage = $"你輸入了 **{activity.Text}**,共輸入了**{activity.Text.Length}**個字"; | |
| var connector = new ConnectorClient(new Uri(activity.ServiceUrl)); | |
| // User的資訊是 From | |
| var userAccount = new ChannelAccount(activity.From.Id); | |
| // Bot 的資訊是 Recipient |