Example #1
0
        public ActionResult CreateSubmission(uint id)
        {
            List <WeenieChange> data = SandboxContentProviderHost.CurrentProvider.GetMyWeenieChanges(GetUserToken());

            WeenieChange theOne = data.FirstOrDefault(wc => wc.Weenie.WeenieId == id);

            if (theOne != null)
            {
                theOne.Submitted      = true;
                theOne.SubmissionTime = DateTime.Now;
                SandboxContentProviderHost.CurrentProvider.UpdateWeenieChange(GetUserGuid(), theOne);

                WeenieSubmissionEvent wse = new WeenieSubmissionEvent();
                wse.SubmittingUserGuid = theOne.UserGuid;
                wse.ChangelogComment   = theOne.Weenie.UserChangeSummary;
                wse.SubmittingUser     = CurrentUser.DisplayName;
                wse.WeenieId           = theOne.Weenie.WeenieId;

                // icon generation data for thumbnail
                wse.ItemType   = theOne.Weenie.ItemType;
                wse.UnderlayId = theOne.Weenie.UnderlayId;
                wse.OverlayId  = theOne.Weenie.OverlayId;
                wse.IconId     = theOne.Weenie.IconId;
                wse.UiEffects  = theOne.Weenie.UIEffects;

                wse.WeenieName     = theOne.Weenie.Name;
                wse.SubmissionTime = DateTimeOffset.Now;
                DiscordController.PostToDiscordAsync(wse);
            }

            return(new EmptyResult()); // RedirectToAction("Sandbox");
        }
        public ActionResult CutWorldReleaseEx(ReleaseType type)
        {
            var results = ContentProviderHost.CurrentProvider.CutWorldRelease(GetUserToken(), type);
            // If null or unknown, there are no updates available:
            var success = (results == null || results.Type == ReleaseType.Unknown) ? false : true;

            if (success)
            {
                WorldReleaseEvent wre = new WorldReleaseEvent();
                wre.User        = CurrentUser.DisplayName;
                wre.ReleaseTime = DateTimeOffset.Now;
                wre.Name        = results.FileName;
                wre.Size        = results.FileSize;
                DiscordController.PostToDiscordAsync(wre);
            }

            return(RedirectToAction("Index", "WorldRelease"));
        }
Example #3
0
        public ActionResult AcceptChange(uint id, string userGuid)
        {
            List <WeenieChange> temp   = SandboxContentProviderHost.CurrentProvider.GetAllWeenieChanges();
            WeenieChange        change = temp.FirstOrDefault(x => x.Submitted && x.UserGuid == userGuid && x.Weenie.WeenieClassId == id);

            BaseModel baseModel = CurrentBaseModel ?? new BaseModel();

            if (change != null)
            {
                // apply the changelog
                if (!string.IsNullOrWhiteSpace(change.Weenie.UserChangeSummary))
                {
                    change.Weenie.Changelog.Add(new ChangelogEntry()
                    {
                        Author  = change.UserName,
                        Created = change.SubmissionTime,
                        Comment = change.Weenie.UserChangeSummary
                    });
                }

                // this goes to DF.com, and requires the current token, not a substituted one
                SandboxContentProviderHost.CurrentProvider.UpdateWeenieInSource(GetUserToken(), change.Weenie);
                baseModel.SuccessMessages.Add("Weenie updated.");
                CurrentBaseModel = baseModel;

                WeenieAcceptanceEvent wae = new WeenieAcceptanceEvent();
                wae.AcceptanceTime   = DateTimeOffset.Now;
                wae.AcceptingUser    = CurrentUser.DisplayName;
                wae.ChangelogComment = change.Weenie.UserChangeSummary;
                wae.SubmittingUser   = change.UserName;
                wae.WeenieId         = id;
                wae.WeenieName       = change.Weenie.Name;
                DiscordController.PostToDiscordAsync(wae);

                // delete the change request
                SandboxContentProviderHost.CurrentProvider.DeleteWeenieChange(change.UserGuid, change);
            }

            return(RedirectToAction("Submissions"));
        }
Example #4
0
        public ActionResult CreateSubmission(uint id)
        {
            List <WeenieChange> data = SandboxContentProviderHost.CurrentProvider.GetMyWeenieChanges(GetUserToken());

            WeenieChange theOne = data.FirstOrDefault(wc => wc.Weenie.WeenieClassId == id);

            if (theOne != null)
            {
                theOne.Submitted = true;
                SandboxContentProviderHost.CurrentProvider.UpdateWeenieChange(GetUserGuid(), theOne);

                WeenieSubmissionEvent wse = new WeenieSubmissionEvent();
                wse.SubmittingUserGuid = theOne.UserGuid;
                wse.ChangelogComment   = theOne.Weenie.UserChangeSummary;
                wse.SubmittingUser     = CurrentUser.DisplayName;
                wse.WeenieId           = theOne.Weenie.DataObjectId;
                wse.WeenieName         = theOne.Weenie.Name;
                wse.SubmissionTime     = DateTimeOffset.Now;
                DiscordController.PostToDiscordAsync(wse);
            }

            return(RedirectToAction("Sandbox"));
        }