Exemplo n.º 1
0
        protected override void Initialize()
        {
            _Booru         = new BooruClient();
            _Textures      = new List <FallingBooruTexture>();
            _Font          = new BitmapFontRenderer(GraphicsDevice);
            _BackgroundHue = R.NextDouble() * 360;

            if (_Options.Debug)
            {
                string  productName = ScreensaverHelper.GetAssemblyAttribute <AssemblyProductAttribute>(x => x.Product);
                Version version     = Assembly.GetExecutingAssembly().GetName().Version;
                _ProductNameAndVersion = string.Format("{0} V{1}", productName, version);
            }

            graphics.PreferredBackBufferWidth       = W;
            graphics.PreferredBackBufferHeight      = H;
            graphics.PreferMultiSampling            = true;
            graphics.SynchronizeWithVerticalRetrace = !_Options.NoVSync;
            graphics.ApplyChanges();
            graphics.ToggleFullScreen();

            if (_Options.FPSLimit > 0)
            {
                TargetElapsedTime = new TimeSpan(10000000L / _Options.FPSLimit);
            }
            else
            {
                IsFixedTimeStep = false;
            }

            IsMouseVisible = false;

            base.Initialize();
        }
Exemplo n.º 2
0
        public async Task Konachan(CommandContext ctx, params string[] tag)
        {
            if (tag.Any(x => x.ToLower().Contains("loli")) || tag.Any(x => x.ToLower().Contains("shota")))
            {
                await ctx.RespondAsync("no.");

                return;
            }
            var dan = new BooruClient();
            var res = await dan.GetKonaChanImagesAsync(tag);

            if (res.Count == 0)
            {
                await ctx.RespondAsync("No Results!");
            }
            var          hc  = new HttpClient();
            MemoryStream str = new MemoryStream(await hc.GetByteArrayAsync(Other.resizeLink(res[new Random().Next(0, res.Count)].ImageUrl)));

            str.Position = 0;
            var em = new DiscordEmbedBuilder();

            em.WithImageUrl($"attachment://image.{MimeGuesser.GuessExtension(str)}");
            em.WithFooter("by Konachan");
            await ctx.RespondWithFileAsync($"image.{MimeGuesser.GuessExtension(str)}", str, embed : em.Build());
        }
Exemplo n.º 3
0
 public ImageManager(Random R, GraphicsDevice GD, BooruClient Booru, List <ulong> IDs, double MaxSideLength, bool UseImages)
 {
     _GD            = GD;
     _R             = R;
     _IDs           = IDs;
     _Booru         = Booru;
     _MaxSideLength = MaxSideLength;
     _Thread        = new Thread(_ThreadMethod);
     _Textures      = new List <Texture2D>();
     _UseImages     = UseImages;
 }
Exemplo n.º 4
0
 public Booru(string Site, bool nsfw)
 {
     userSite    = Site;
     isNsfw      = nsfw;
     booruClient = new BooruClient(Site, nsfw);
 }