Пример #1
0
 static DB()
 {
     ActiveEvents        = new ActiveEvents();
     ActiveGiveaways     = new ActiveGiveaways();
     BackgroundInventory = new BackgroundInventory();
     Cooldowns           = new Cooldowns();
     Events             = new Database.Events();
     EventLogs          = new EventLogs();
     EventSchedule      = new EventSchedule();
     GiveawayLogs       = new GiveawayLogs();
     Giveaways          = new Giveaways();
     Inventory          = new Inventory();
     LeagueData         = new LeagueData();
     Mappings           = new Mappings();
     ModerationLogs     = new ModerationLogs();
     PendingUsers       = new PendingUsers();
     ProfileBackgrounds = new ProfileBackgrounds();
     Rewards            = new Rewards();
     RoleInventory      = new RoleInventory();
     Roles        = new Roles();
     Settings     = new Settings();
     Statistics   = new Statistics();
     Streamers    = new Streamers();
     SystemTimers = new SystemTimers();
     TempRoles    = new TempRoles();
     Toxicity     = new Toxicity();
     Users        = new Users();
 }
Пример #2
0
        public async Task Join(Blacklist blacklist, bool sort, bool sortToMore, string lang)
        {
            LogMessage.Instance.AddMessage(await LoadGiveaways(blacklist, lang));

            if (Giveaways?.Count > 0)
            {
                if (sort)
                {
                    if (sortToMore)
                    {
                        Giveaways.Sort((a, b) => b.Price.CompareTo(a.Price));
                    }
                    else
                    {
                        Giveaways.Sort((a, b) => a.Price.CompareTo(b.Price));
                    }
                }

                foreach (var giveaway in Giveaways)
                {
                    if (giveaway.Price <= Points && PointsReserv <= Points - giveaway.Price)
                    {
                        LogMessage.Instance.AddMessage(await JoinGiveaway(giveaway, lang));
                    }
                }
            }
        }
Пример #3
0
        public async Task Join(Steam steam, bool sort, bool sortToMore)
        {
            LogMessage.Instance.AddMessage(await LoadGiveawaysAsync());

            if (Giveaways?.Count > 0)
            {
                if (sort)
                {
                    if (sortToMore)
                    {
                        Giveaways.Sort((a, b) => b.Price.CompareTo(a.Price));
                    }
                    else
                    {
                        Giveaways.Sort((a, b) => a.Price.CompareTo(b.Price));
                    }
                }

                foreach (var giveaway in Giveaways)
                {
                    if (giveaway.Price <= Points && PointsReserv <= Points - giveaway.Price)
                    {
                        LogMessage.Instance.AddMessage(await JoinGiveaway(giveaway, steam));
                    }
                }
            }
        }
Пример #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            Giveaways giveaways = db.Giveaways.Find(id);

            db.Giveaways.Remove(giveaways);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #5
0
        private int AddGiveaways(JsonRootObject json)
        {
            var count = 0;

            if (json != null)
            {
                foreach (var giveaway in json.Giveaways)
                {
                    var lot = new GameMinerGiveaway();
                    if (giveaway.Golden && giveaway.Price != 0)
                    {
                        break;
                    }

                    if (lot.Price > Points)
                    {
                        break;
                    }

                    if (lot.Price >= JoinPointsLimit)
                    {
                        break;
                    }

                    if (lot.Price > PointsReserv)
                    {
                        break;
                    }

                    lot.Name      = giveaway.Game.Name;
                    lot.Id        = giveaway.Code;
                    lot.IsRegular = giveaway.Sandbox == null;
                    lot.IsSandbox = giveaway.Sandbox != null;
                    lot.IsGolden  = giveaway.Golden;
                    lot.Page      = json.Page;
                    lot.Price     = giveaway.Price;

                    if (giveaway.RegionlockTypeId != null)
                    {
                        lot.Region = giveaway.RegionlockTypeId;
                    }

                    if (giveaway.Game.Url != "javascript:void(0);")
                    {
                        lot.StoreId = giveaway.Game.Url.Split('/')[4];
                    }
                    else
                    {
                        break;
                    }

                    Giveaways?.Add(lot);
                    count++;
                }
            }

            return(count);
        }
Пример #6
0
 public ActionResult Edit([Bind(Include = "GivewayId,Name,_idDiscography")] Giveaways giveaways)
 {
     if (ModelState.IsValid)
     {
         db.Entry(giveaways).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag._idDiscography = new SelectList(db.Discography, "DiscographyId", "Title", giveaways._idDiscography);
     return(View(giveaways));
 }
Пример #7
0
        private async Task <Log> LoadGiveawaysAsync()
        {
            var task = new TaskCompletionSource <Log>();
            await Task.Run(() =>
            {
                var content = string.Empty;
                Giveaways?.Clear();
                WishlistGiveaways?.Clear();

                if (WishList)
                {
                    content += LoadGiveawaysByUrl(
                        $"{Links.SteamCompanionSearch}?wishlist=true",
                        strings.ParseLoadGiveaways_WishListGiveAwaysIn,
                        WishlistGiveaways);
                }

                if (Contributors)
                {
                    content += LoadGiveawaysByUrl(
                        $"{Links.SteamCompanionSearch}?type=contributor",
                        strings.ParseLoadGiveaways__ContributorsIn,
                        Giveaways);
                }

                if (Group)
                {
                    content += LoadGiveawaysByUrl(
                        $"{Links.SteamCompanionSearch}?type=group",
                        strings.ParseLoadGiveaways_GroupGiveAwaysIn,
                        Giveaways);
                }

                if (Regular)
                {
                    content += LoadGiveawaysByUrl(
                        $"{Links.SteamCompanionSearch}?type=public",
                        strings.ParseLoadGiveaways_RegularGiveawaysIn,
                        Giveaways);
                }

                if (Giveaways?.Count == 0 && WishlistGiveaways?.Count == 0)
                {
                    task.SetResult(Messages.ParseGiveawaysEmpty(content, "SteamCompanion"));
                }
                else
                {
                    task.SetResult(Messages.ParseGiveawaysFoundMatchGiveaways(content, "SteamCompanion",
                                                                              (Giveaways?.Count + WishlistGiveaways?.Count).ToString()));
                }
            });

            return(task.Task.Result);
        }
Пример #8
0
        // GET: Giveaways/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Giveaways giveaways = db.Giveaways.Find(id);

            if (giveaways == null)
            {
                return(HttpNotFound());
            }
            return(View(giveaways));
        }
Пример #9
0
        // GET: Giveaways/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Giveaways giveaways = db.Giveaways.Find(id);

            if (giveaways == null)
            {
                return(HttpNotFound());
            }
            ViewBag._idDiscography = new SelectList(db.Discography, "DiscographyId", "Title", giveaways._idDiscography);
            return(View(giveaways));
        }
Пример #10
0
        public MainWindow()
        {
            InitializeComponent();

            HPage = new Home();
            SPage = new SettingsPage();
            CPage = new Codes();
            GPage = new Giveaways();

            StartSetup();
            bot                = new Bot(this);
            Width              = SystemParameters.WorkArea.Width / 1.5;
            Height             = SystemParameters.WorkArea.Height / 1.5;
            header.DataContext = bot;
        }
Пример #11
0
        private async Task <Log> LoadGiveawaysAsync(Blacklist blackList)
        {
            var task = new TaskCompletionSource <Log>();
            await Task.Run(() =>
            {
                var content = string.Empty;
                Giveaways?.Clear();
                WishlistGiveaways?.Clear();

                if (WishList)
                {
                    content += LoadGiveawaysByUrl(
                        $"{Links.SteamGiftsSearch}?type=wishlist",
                        strings.ParseLoadGiveaways_WishListGiveAwaysIn,
                        WishlistGiveaways);
                }

                if (Group)
                {
                    content += LoadGiveawaysByUrl(
                        $"{Links.SteamGiftsSearch}?type=group",
                        strings.ParseLoadGiveaways_GroupGiveAwaysIn,
                        Giveaways);
                }

                if (Regular)
                {
                    content += LoadGiveawaysByUrl(
                        $"{Links.SteamGiftsSearch}",
                        strings.ParseLoadGiveaways_RegularGiveawaysIn,
                        Giveaways);
                }

                if (Giveaways?.Count == 0 && WishlistGiveaways?.Count == 0)
                {
                    task.SetResult(Messages.ParseGiveawaysEmpty(content, "SteamGifts"));
                }
                else
                {
                    blackList.RemoveGames(Giveaways);
                    blackList.RemoveGames(WishlistGiveaways);
                    task.SetResult(Messages.ParseGiveawaysFoundMatchGiveaways(content, "SteamGifts",
                                                                              (Giveaways?.Count + WishlistGiveaways?.Count).ToString()));
                }
            });

            return(task.Task.Result);
        }
Пример #12
0
        private async Task <Log> LoadGiveaways(Blacklist blackList, string lang)
        {
            var task = new TaskCompletionSource <Log>();
            await Task.Run(() =>
            {
                var content = string.Empty;

                Giveaways?.Clear();

                if (FreeGolden)
                {
                    content += LoadGiveawaysByUrl(Links.GameMinerGoldenGiveaways,
                                                  strings.ParseLoadGiveaways_FreeGoldenGiveawaysIn,
                                                  lang);
                }

                if (Regular)
                {
                    content += LoadGiveawaysByUrl(Links.GameMinerRegularGiveaways,
                                                  strings.ParseLoadGiveaways_RegularGiveawaysIn, lang);
                }

                if (Sandbox)
                {
                    content += LoadGiveawaysByUrl(Links.GameMinerSandboxGiveaways,
                                                  strings.ParseLoadGiveaways_SandboxGiveawaysIn, lang);
                }

                if (Giveaways == null)
                {
                    task.SetResult(Messages.ParseGiveawaysEmpty(content, "GameMiner"));
                }
                else
                {
                    blackList.RemoveGames(Giveaways);
                    task.SetResult(Messages.ParseGiveawaysFoundMatchGiveaways(content, "GameMiner",
                                                                              Giveaways.Count.ToString()));
                }
            });

            return(task.Task.Result);
        }
Пример #13
0
        public async Task Join(Blacklist blacklist, bool sort, bool sortToMore, bool wishlistNotSort)
        {
            LogMessage.Instance.AddMessage(await LoadGiveawaysAsync(blacklist));

            if (Giveaways?.Count > 0)
            {
                if (sort)
                {
                    if (sortToMore)
                    {
                        Giveaways.Sort((a, b) => b.Price.CompareTo(a.Price));
                    }
                    else
                    {
                        Giveaways.Sort((a, b) => a.Price.CompareTo(b.Price));
                    }
                }

                if (SortToLessLevel)
                {
                    Giveaways.Sort((a, b) => b.Level.CompareTo(a.Level));
                }
                else if (SortToMoreCopies)
                {
                    Giveaways.Sort((a, b) => a.Copies.CompareTo(b.Copies));
                }

                foreach (var giveaway in Giveaways)
                {
                    if (giveaway.Price <= Points && PointsReserv <= Points - giveaway.Price)
                    {
                        LogMessage.Instance.AddMessage(await JoinGiveaway(giveaway));
                    }
                }
            }

            if (WishlistGiveaways?.Count > 0)
            {
                if (sort)
                {
                    if (sortToMore)
                    {
                        if (!wishlistNotSort)
                        {
                            WishlistGiveaways.Sort((a, b) => b.Price.CompareTo(a.Price));
                        }
                    }
                    else
                    {
                        if (!wishlistNotSort)
                        {
                            WishlistGiveaways.Sort((a, b) => a.Price.CompareTo(b.Price));
                        }
                    }
                }

                if (SortToLessLevel)
                {
                    if (!wishlistNotSort)
                    {
                        WishlistGiveaways.Sort((a, b) => b.Level.CompareTo(a.Level));
                    }
                }

                foreach (var giveaway in WishlistGiveaways)
                {
                    if (giveaway.Price <= Points && PointsReserv <= Points - giveaway.Price)
                    {
                        LogMessage.Instance.AddMessage(await JoinGiveaway(giveaway));
                    }
                }
            }
        }