예제 #1
0
        private string Markup(string content, IMarkdownObjectRewriter rewriter, TestLoggerListener listener = null)
        {
            var pipelineBuilder  = new MarkdownPipelineBuilder();
            var documentRewriter = new MarkdownDocumentVisitor(rewriter);

            pipelineBuilder.DocumentProcessed += document =>
            {
                ValidationExtension.SetSchemaName(document);
                documentRewriter.Visit(document);
            };
            var pipeline = pipelineBuilder.Build();

            if (listener != null)
            {
                Logger.RegisterListener(listener);
            }

            var html = Markdown.ToHtml(content, pipeline);

            if (listener != null)
            {
                Logger.UnregisterListener(listener);
            }

            return(html);
        }
예제 #2
0
 public GUI_DoiMK(TAIKHOAN tmp)
 {
     db = new CMART8Entities();
     vl = new ValidationExtension();
     TK = tmp;
     InitializeComponent();
     controlFunction(TK.QUYEN);
     txtTen.Text = TK.HOTEN;
 }
            public void InitializeContext()
            {
                this.store.TransactionManager.DoWithinTransaction(() =>
                {
                    var patternModel  = store.ElementFactory.CreateElement <PatternModelSchema>();
                    this.product      = patternModel.Create <PatternSchema>();
                    this.product.Name = "WebService";
                });

                this.validationExtension = ExtensionElement.GetExtension <ValidationExtension>(this.product);
            }
예제 #4
0
        static public async Task LinkScoresaberWithDiscord(DiscordSocketClient discordSocketClient, SocketMessage message)
        {
            var r = new RoleAssignment(discordSocketClient);

            if (r.CheckIfDiscordIdIsLinked(message.Author.Id.ToString()))
            {
                await message.Channel.SendMessageAsync("", false, EmbedBuilderExtension.NullEmbed("Pog", $"Your Discord ID is already linked with your scoresaber, No worries {message.Author.Username}. If you want to unlink, type !bs unlink.").Build());

                await message.Channel.SendMessageAsync("Your Discord ID is already linked with your scoresaber, No worries " + message.Author.Username);

                return;
            }
            else
            {
                var ScoresaberId = message.Content.Substring(9);
                ScoresaberId = Regex.Replace(ScoresaberId, "[^0-9]", "");

                if (!ValidationExtension.IsDigitsOnly(ScoresaberId))
                {
                    await message.Channel.SendMessageAsync("Scoresaber ID is wrong");

                    return;
                }

                if (await ValidationExtension.IsDutch(ScoresaberId))
                {
                    var guildChannel = message.Channel as SocketGuildChannel;
                    if (guildChannel.Guild.Id != 505485680344956928)
                    {
                        message.Channel.SendMessageAsync("It seems that you are Dutch and trying to link your account outside the Dutch Discord. A Dutch request needs to be validated. Consider joining the Dutch Beat Saber Discord. (https://discord.gg/cH7mTyq)");
                    }
                    r.MakeRequest(message);
                }
                else
                {
                    JsonExtension.InsertJsonData("../../../GlobalAccounts.txt", message.Author.Id.ToString(), ScoresaberId);
                    await message.Channel.SendMessageAsync("", false, EmbedBuilderExtension.NullEmbed("Added user to the list", "Added " + message.Author.Id.ToString() + " with scoresaberID " + ScoresaberId + " to the global list", null, null).Build());

                    return;
                }
            }

            var moderationHelper = new GuildService(discordSocketClient, 505485680344956928);

            var user = message.Author;

            if (moderationHelper.UserHasRole(user, "Nieuwkomer"))
            {
                await moderationHelper.AddRole("Link my discord please", user);

                await moderationHelper.DeleteRole("Nieuwkomer", user);
            }
        }
예제 #5
0
 public GUI_CTHD(string gui, TAIKHOAN tmp, HOADON tmp2, string pos)
 {
     TK    = tmp;
     HD    = tmp2;
     GUI   = gui;
     POS   = pos;
     ctlSP = new BUS_SanPham();
     ctl   = new BUS_QLHD();
     db    = new CMART8Entities();
     vl    = new ValidationExtension();
     InitializeComponent();
     controlFunction(GUI);
     lstCTHD.Click += lstCTHD_Click;
 }
예제 #6
0
        static public async Task SendDM(DiscordSocketClient discordSocketClient, SocketMessage message)
        {
            var guildUserSender = message.Author as SocketGuildUser;

            if (guildUserSender.IsDutchAdmin() || ValidationExtension.IsOwner(message.Author.Id))
            {
                //!bs senddm <@!32432424> hello
                var content      = message.Content.Substring(11);
                var splitContent = Regex.Split(content, @"<@!([0-9]+)>");
                var user         = discordSocketClient.GetUser(ulong.Parse(splitContent[1]));

                await user.SendDMMessage(splitContent[2], discordSocketClient);

                await message.Channel.SendMessageAsync($"DM send to {splitContent[1]}");
            }
        }