This file contains hidden or 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
| private static IWebHost CreateWebHost() | |
| { | |
| var scheme = Environment.GetEnvironmentVariable("SCHEME"); | |
| if (string.IsNullOrWhiteSpace(scheme)) | |
| { | |
| scheme = "http"; | |
| } | |
| var port = Environment.GetEnvironmentVariable("PORT"); | |
| if (string.IsNullOrWhiteSpace(port)) |
This file contains hidden or 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
| FROM microsoft/dotnet:1.1.1-runtime | |
| RUN mkdir /opt/app-release | |
| WORKDIR /opt/app-release | |
| COPY out . | |
| ENTRYPOINT ["dotnet", "My.Dotnet.Application.dll"] |
This file contains hidden or 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
| version: '3' | |
| services: | |
| web: | |
| image: microsoft/dotnet:1.1.1-sdk | |
| ports: | |
| - "5000:5000" | |
| env_file: .env | |
| depends_on: | |
| - db | |
| volumes: |
This file contains hidden or 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
| using System; | |
| using System.Security.Cryptography; | |
| using System.Text; | |
| using Microsoft.AspNetCore.DataProtection; | |
| namespace Home.Web | |
| { | |
| internal sealed class HmacDataProtector : IDataProtector | |
| { | |
| private const int HmacSize = 32; // for SHA256 |
This file contains hidden or 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
| #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
| ; #Warn ; Enable warnings to assist with detecting common errors. | |
| SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
| SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
| !-:: | |
| { | |
| SendInput — | |
| } | |
| return |
This file contains hidden or 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
| private static Message CreateReplyMessage(Message message, string text) | |
| { | |
| var reply = message.CreateReplyMessage(text); | |
| reply.BotUserData = message.BotUserData; | |
| return reply; | |
| } | |
| private Message HandleAddCommand(Command command, Message message) | |
| { |
This file contains hidden or 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
| public Message Post([FromBody]Message message) | |
| { | |
| const string NotSupportMessage = "Sorry, I could not understand that."; | |
| if (message.Type == "Message") | |
| { | |
| Command command = null; | |
| if (Command.TryParse(message.Text, out command) == false) | |
| { | |
| return message.CreateReplyMessage(NotSupportMessage); |
This file contains hidden or 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
| public class Command | |
| { | |
| public string Action { get; set; } | |
| public string Parameters { get; set; } | |
| public static bool TryParse(string text, out Command command) | |
| { | |
| command = null; |
This file contains hidden or 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
| public Message Post([FromBody]Message message) | |
| { | |
| if (message.Type == "Message") | |
| { | |
| // calculate something for us to return | |
| int length = (message.Text ?? string.Empty).Length; | |
| // return our reply to the user | |
| return message.CreateReplyMessage($"Hello from TallyBot! You sent {length} characters"); | |
| } |
This file contains hidden or 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
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| Console.WriteLine("Child1: {0}", new Child1().Caller); | |
| Console.WriteLine("Child2: {0}", new Child2().Caller); | |
| Console.WriteLine("Child3: {0}", new Child3().Caller); | |
| } | |
| public abstract class Parent |