Beispiel #1
0
 public void ActivateStep(SetupStep step)
 {
     Diglbug.Log("Activating SetupStep " + step.name);
     currentStep = step;
     currentStep.Activate(this);
     if (ShowMode.Instance.Mode.ModeName == ModeName.GUIDE)
     {
         if (currentStep.updateGuideInstructions)
         {
             if (Variables.Instance.language == Language.ENGLISH)
             {
                 stepInstructionText.text = currentStep.descriptionEnglishGuide;
             }
             else
             {
                 stepInstructionText.text = currentStep.descriptionMandarinGuide;
             }
         }
     }
     else
     {
         if (currentStep.updateAudienceInstructions)
         {
             if (Variables.Instance.language == Language.ENGLISH)
             {
                 stepInstructionText.text = currentStep.descriptionEnglish;
             }
             else
             {
                 stepInstructionText.text = currentStep.descriptionMandarin;
             }
         }
     }
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            //Reset text.txt 26.04.2021 2.28.29

            var setupStep = new SetupStep(new FileSystemWorker());

            var request = new FileSystemRequest()
            {
                Command    = "Status",
                FileStatus = new List <FileStatus>()
                {
                    new FileStatus()
                    {
                        Content    = null,
                        FileName   = "test1.txt",
                        FolderName = "C:/test",
                    }
                }
            };

            var response = setupStep.Step(request).Response;

            Console.WriteLine(response.IsSuccess);

            foreach (var item in response.FileStatus)
            {
                Console.WriteLine($"{item.FileName} --- {item.FileStatusSetings}");
            }
        }
 private void SetupHelperForm_Load(object sender, EventArgs e)
 {
     helperRichTextBox.LinkClicked += HelperRichTextBox_LinkClicked;
     _step = SetupStep.Welcome;
     helperRichTextBox.Rtf = GetResourceByName("AvorionServerManager.Setup.SetupHelperWelcome.rtf");
     doItButton.Visible    = false;
 }
Beispiel #4
0
        public void InstallWebserverPackage()
        {
            var packageConfiguration = new PackageConfiguration();

            var website = new Website();

            var product = new Product();

            var setupStep = new SetupStep();


            var package = new Package
            {
                Id                   = 92,
                Name                 = "TestPackage_1.0.17.zip",
                IsDeleted            = false,
                CreatedAt            = DateTime.UtcNow.AddDays(-20),
                UpdatedAt            = DateTime.UtcNow.AddDays(-18),
                PackageUrl           = @"\\path\to\test\package\TestPackage_1.0.17.zip",
                Version              = new Version(1, 0, 17),
                PackageConfiguration = null,
                Websites             = null,
                Product              = null,
                SetupSteps           = null
            };
        }
Beispiel #5
0
        private async Task <CardResult> RequestGuildCommandPrefix(IMessage message)
        {
            ActiveSetupStep = SetupStep.GuildCommandPrefix;
            InputStringCard = new InputStringCard("What character would you like to use for your command prefix?", true, 1, new string[] { "cancel" }, "What character would you like to use?");
            await CardStack.ShowCard(InputStringCard, message, Context);

            return(CardResult.Continue);
        }
Beispiel #6
0
        private async Task <CardResult> RequestAssignGuestRoleOnJoin(IMessage message)
        {
            ActiveSetupStep  = SetupStep.AssignGuestRoleOnJoin;
            InputBooleanCard = new InputBooleanCard("Should I assign a Guest role to users when they join? (yes|no)", true, new string[] { "cancel" }, "Should I auto-assign a guest role?", new string[] { "yes" }, new string[] { "no" });
            await CardStack.ShowCard(InputBooleanCard, message, Context);

            return(CardResult.Continue);
        }
Beispiel #7
0
        private async Task <CardResult> RequestGuildRole(SetupStep nextSetupStep, string question, string retryQuestion, IMessage message)
        {
            ActiveSetupStep = nextSetupStep;
            InputRoleCard   = new InputRoleCard(question, true, new string[] { "cancel" }, retryQuestion);
            await CardStack.ShowCard(InputRoleCard, message, Context);

            return(CardResult.Continue);
        }
 public SetupEngines(EnginesRoot enginesRoot, IEntityFactory entityFactory)
 {
     this.enginesRoot   = enginesRoot;
     this.entityFactory = entityFactory;
     setupStep          = new SetupStep(steps, engines);
     setupSequence      = new SetupSequence(sequences, steps, engines);
     createAddEngine    = new CreateAddEngine(enginesRoot, engines, sequences);
 }
Beispiel #9
0
 public SetupEngines(EnginesRoot enginesRoot, IEntityFactory entityFactory, bool isMobile, string persistentDataPath)
 {
     this.enginesRoot   = enginesRoot;
     this.entityFactory = entityFactory;
     setupStep          = new SetupStep(steps, engines);
     setupSequence      = new SetupSequence(sequences, steps, engines);
     createAddEngine    = new CreateAddEngine(enginesRoot, engines, sequences, isMobile, persistentDataPath);
 }
 private static async Task UpdateProgress(SetupInformation info, SetupStep currentStep, String stepDescription)
 {
     if (currentStep == SetupStep.Completed)
     {
         info.ViewModel.SetupProgress = 100;
     }
     else
     {
         info.ViewModel.SetupProgress = (100 / (Int32)SetupStep.Completed) * (Int32)currentStep;
     }
     info.ViewModel.SetupProgressDescription = stepDescription;
 }
Beispiel #11
0
        private async Task NextStep(string Message = null)
        {
            //add the current step to the history buffer.
            History.Push(CurrentStep);

            if (Message != null)
            {
                await SendAsync(Message);
            }

            SetupStep NextStep = CurrentStep + 1;

            await StartStep(NextStep);
        }
        private static void ValidateSetupStep(Instance instance, SetupStep setupStep)
        {
            Logger.Instance.Log(LogLevel.Info, "Validating setup step");

            ISet <string> componentIdSet = new HashSet <string>(instance.Components.Select(c => c.Id));

            foreach (string componentIdToSetup in setupStep.ComponentsIdList)
            {
                if (!componentIdSet.Contains(componentIdToSetup))
                {
                    throw new ValidationException(string.Format(CultureInfo.InvariantCulture, "Component '{0}', which should be setup, was not found in the <components>...</components> section.", componentIdToSetup));
                }
            }

            Logger.Instance.Log(LogLevel.Info, "OK");
        }
Beispiel #13
0
        private RoleLevel GetRoleFromStep(SetupStep Step)
        {
            switch (Step)
            {
            case SetupStep.Role_Guest:
                return(RoleLevel.Guest);

            case SetupStep.Role_Member:
                return(RoleLevel.Member);

            case SetupStep.Role_Officer:
                return(RoleLevel.Officer);

            case SetupStep.Role_Leader:
                return(RoleLevel.Leader);

            case SetupStep.Role_ServerAdmin:
                return(RoleLevel.ServerAdmin);

            default:
                throw new Exception("Bad input. That step does not have an associated role.");
            }
        }
        private void SetStep(SetupStep step)
        {
            if (step == SetupStep.SelectPath)
            {
                this.view.SetSetupText("Setup will install " + this.game.Name + " into the selected folder." + Environment.NewLine + Environment.NewLine +
                    "To continue, click next. If you want to select a different folder, click Browse.");
            }
            else if (step == SetupStep.SelectDependencies)
            {
                this.view.SetSetupText("This game has a few dependencies, this means you'll need to own this content to play the game. "
                    + Environment.NewLine + Environment.NewLine + "This usually includes the original Fallout 2 content.");
                this.view.SetDependencies(installHandler.GetDependencies(game.Id));
            }
            else if (step == SetupStep.InstallPreview)
            {
                this.view.SetSetupText("You are now ready to install. If you want to review that the install script is not malicious, check that option below.");
            }
            else if (step == SetupStep.Install)
            {
                this.installPath = this.view.GetInstallPath();
                this.view.Close();
                if (!this.installHandler.InstallGame(this.game, this.scriptPath, this.tempPath, this.installPath, selectedDependencies.Values.ToList(), this.view.ReviewCode()))
                {
                    this.view.ShowError(this.installHandler.GetInstallError());
                    this.IsSuccess = false;
                    return;
                }
                this.IsSuccess = true;
            }

            this.view.SetStep(currentStep, step);
            this.currentStep = step;
        }
        private void GoToPreviousStep()
        {
            switch (_step)
            {
            case SetupStep.Welcome:
                break;

            case SetupStep.InstallServer:
                _step = SetupStep.ManagerSettings;
                helperRichTextBox.Rtf = GetResourceByName("AvorionServerManager.Setup.ManagerSettings.rtf");
                _managerMainForm.ChangeTabBarItem(1);
                Activate();
                ScrollToTop();
                break;

            case SetupStep.ManagerSettings:
                doItButton.Visible = false;
                _step = SetupStep.Welcome;
                helperRichTextBox.Rtf = GetResourceByName("AvorionServerManager.Setup.SetupHelperWelcome.rtf");
                Activate();
                ScrollToTop();
                break;

            case SetupStep.ServerSettings:
                _step = SetupStep.InstallServer;
                helperRichTextBox.Rtf = GetResourceByName("AvorionServerManager.Setup.ServerInstallation.rtf");
                _managerMainForm.ChangeTabBarItem(4);
                Activate();
                ScrollToTop();
                break;

            case SetupStep.BackupSettings:
                _step = SetupStep.ServerSettings;
                helperRichTextBox.Rtf = GetResourceByName("AvorionServerManager.Setup.AvorionServerSettings.rtf");
                _managerMainForm.ChangeTabBarItem(2);
                Activate();
                ScrollToTop();
                break;

            case SetupStep.SetupFinished:
                doItButton.Visible = true;
                _step = SetupStep.BackupSettings;
                helperRichTextBox.Rtf = GetResourceByName("AvorionServerManager.Setup.BackupSettings.rtf");
                ScrollToTop();
                break;

            case SetupStep.LuaCommands:
                _step = SetupStep.SetupFinished;
                helperRichTextBox.Rtf = GetResourceByName("AvorionServerManager.Setup.AdditionalSteps.rtf");
                ScrollToTop();
                break;

            case SetupStep.WebApiSsl:
                _step = SetupStep.LuaCommands;
                helperRichTextBox.Rtf = GetResourceByName("AvorionServerManager.Setup.LuaCommands.rtf");
                ScrollToTop();
                break;

            case SetupStep.WebApiSslSetup:
                _step = SetupStep.WebApiSsl;
                helperRichTextBox.Rtf = GetResourceByName("AvorionServerManager.Setup.WebApiSsl.rtf");
                ScrollToTop();
                break;

            case SetupStep.WebApiKeys:
                _step = SetupStep.WebApiSslSetup;
                helperRichTextBox.Rtf = GetResourceByName("AvorionServerManager.Setup.WebApiSetupSsl.rtf");
                ScrollToTop();
                break;

            case SetupStep.WebApiCommands:
                _step = SetupStep.WebApiKeys;
                helperRichTextBox.Rtf = GetResourceByName("AvorionServerManager.Setup.ApiKeys.rtf");
                ScrollToTop();
                break;

            default:
                break;
            }
        }
        public void SetStep(SetupStep currentStep, SetupStep step)
        {
            if (this.setupControls.ContainsKey(currentStep))
                foreach (Control ctrl in this.setupControls[currentStep])
                    this.Form.flowArea.Controls.Remove(ctrl);

            this.Form.chkReviewCode.Visible = false;

            if (step == SetupStep.SelectPath)
            {
                this.Form.btnBack.Enabled = false;

                if (!this.setupControls.ContainsKey(SetupStep.SelectPath))
                {
                    this.setupControls[step] = new List<Control>();
                    FlowLayoutPanel flow = new FlowLayoutPanel();
                    flow.AutoSize = true;
                    flow.Controls.Add(this.txtInstallPath);
                    flow.Controls.Add(this.btnBrowsePath);
                    this.setupControls[step].Add(flow);
                }
            }
            else if (step == SetupStep.SelectDependencies)
            {
                this.Form.btnBack.Enabled = true;
                this.Form.btnNext.Text = "Next >";
            }
            else if (step == SetupStep.InstallPreview)
            {
                this.Form.btnNext.Text = "Install";
                this.Form.chkReviewCode.Visible = true;
            }

            if (this.setupControls.ContainsKey(step))
                foreach (Control ctrl in this.setupControls[step])
                    this.Form.flowArea.Controls.Add(ctrl);
        }
Beispiel #17
0
 public SkipAttribute(SetupStep Skip)
 {
     this.SkipStep = Skip;
 }
Beispiel #18
0
        private async Task StartStep(SetupStep step)
        {
            CurrentStep = step;

            const string suffix = "\n\r\n*You may always say 'skip' to disable this feature, 'back' to return to the previous step, or 'stop' to cancel this dialog.*\r";

            switch (step)
            {
            case SetupStep.Initial:
                await SendAsync("Welcome to the guild setup dialog.\r" +
                                "\nI will walk you through the process of configuring me, by asking simple questions.");

                return;

            case SetupStep.WarBot_Prefix:
                await SendAsync("Lets start by asking what my prefix should be.\r" +
                                $"\nYou also may always address me by tagging me, like this:\r" +
                                $"\n**{this.Bot.Client.CurrentUser.Mention}, help**\r" +
                                $"\nWhat prefix should I use?\r" +
                                $"\nMy default is 'bot,'" +
                                suffix);

                return;

            case SetupStep.User_Join_Channel:
                await SendAsync("Which channel would you like me to use for greeting new users?\r" +
                                "\nIt is recommend the new users can see the new channel, but, you can set this to a private channel to notify your officers.\r" +
                                $"\nPlease tag the channel like this: {this.Channel.Mention}"
                                + suffix);

                break;

            case SetupStep.User_Join_Message:
                await SendAsync("What message would you like me to send to new users?\r" +
                                "You may use {User} in your message, which will automatically tag the user." +
                                "\nYou may 'skip' to use a default message.");

                break;

            case SetupStep.User_Left_Channel:
                await SendAsync("What channel would you like me to send a notification to when users leave?\r" +
                                $"\nPlease tag the channel like this: {this.Channel.Mention}"
                                + suffix);

                break;

            case SetupStep.User_Left_Message:
                await SendAsync("What message would you like me to send when somebody leaves your server?\r" +
                                "You may use {User} in your message, which will be replaced with the user's name" +
                                "\nYou may 'skip' to use a default message.");

                break;

            case SetupStep.Channel_Updates:
                await SendAsync("Occasionally, my developer will add significant new features to me.\r" +
                                "\nWould you like to receive those updates in a channel?\r" +
                                "\nIf so, please tell me which channel to send update notices to. If you do not want this, say 'No'.\r" +
                                suffix);

                break;

            case SetupStep.Channel_Officers:
                await SendAsync("Occasionally, I need to communicate with the clan's leadership.\r" +
                                "\nWould you like to receive those updates in a channel? (They are not very frequent.)\r" +
                                "\nIf so, please tell me which channel to use. If you do not want this, say 'No'.\r" +
                                suffix);

                break;

            case SetupStep.WAR_Channel:
                await SendAsync("I assume you invited me to your server, for the purpose of alerting for Hustle Castle War events.\r" +
                                "\nPlease let me know which channel I should send war announcements to.\r" +
                                "\nIf you say 'No' or 'Skip', I will disable all war-related announcements.");

                break;

            case SetupStep.WAR_SendPrepStarted:
                await SendAsync("Would you like me to send an announcement when the war preperation peroid starts?" +
                                "\r\nYes or No?");

                break;

            case SetupStep.WAR_PrepStartedMessage:
                await SendAsync("What message would you like for me to send to members when the war preperation peroid starts?" +
                                "\r\nYou may 'skip' to use a default message.");

                break;

            case SetupStep.WAR_SendPrepEnding:
                await SendAsync("Would you like me to send an announcement 15 minutes before the war starts?" +
                                "\r\nYes or No?");

                break;

            case SetupStep.WAR_PrepEndingMessage:
                await SendAsync("What message would you like for me to send before the war starts?" +
                                "\r\nYou may 'skip' to use a default message.");

                break;

            case SetupStep.WAR_SendWarStarted:
                await SendAsync("Would you like me to send an announcement when the war starts?" +
                                "\r\nYes or No?");

                break;

            case SetupStep.WAR_WarStartedMessage:
                await SendAsync("What message would you like for me to send when the war starts?" +
                                "\r\nYou may 'skip' to use a default message.");

                break;

            case SetupStep.Enable_Specific_Wars:
                await SendAsync("Would you like to only enable specific wars?" +
                                "\r\nYou may 'skip' or 'no' to enable all 4 war notifications.");

                break;

            case SetupStep.WAR_1_Enabled:
                await SendAsync("Would you like notifications for War 1? It occurs at 7am UTC\r" +
                                "\nPlease be sure to convert to your current time zone.");

                break;

            case SetupStep.WAR_2_Enabled:
                await SendAsync("Would you like notifications for War 2? It occurs at 1pm UTC\r" +
                                "\nPlease be sure to convert to your current time zone.");

                break;

            case SetupStep.WAR_3_Enabled:
                await SendAsync("Would you like notifications for War 3? It occurs at 7pm UTC\r" +
                                "\nPlease be sure to convert to your current time zone.");

                break;

            case SetupStep.WAR_4_Enabled:
                await SendAsync("Would you like notifications for War 4? It occurs at 1am UTC\r" +
                                "\nPlease be sure to convert to your current time zone.");

                break;

            case SetupStep.WAR_Clear_Channel:
                await SendAsync("I can automatically delete all non-pinned messages in the WAR channel when a new war preperation peroid is started.\r" +
                                "\nWould you like to enable this feature?.");

                break;

            case SetupStep.Portal_Channel:
                await SendAsync("If you would like a reminder every week when the portal opens, " +
                                "Please let me know which channel I should send portal messages to.\r" +
                                "\nIf you say 'No' or 'Skip', I will not send portal open notifications");

                break;

            case SetupStep.Portal_Started_Message:
                await SendAsync("What message would you like for me to send when the portal opens?" +
                                "\r\nYou may 'skip' to use a default message.");

                break;

            case SetupStep.Should_Set_Roles:
                await SendAsync("Would you like me to assist you with managing the roles of your discord server?\r" +
                                "\nI can help by promoting users, demoting users, and setting users to specific roles\r" +
                                "\nAs well, many of my functions requires a user to have a specific role\r" +
                                "\nPlease say yes or no.");

                break;

            case SetupStep.Role_Guest:
                await SendAsync("Which role would you like to utilize for guests?\r" +
                                "\nTypically, users in this role will not have access to many of the protected channels, or features of mine.\r" +
                                "\nPlease tag a role, like so: @Guests, or say 'skip'");

                break;

            case SetupStep.Role_Member:
                await SendAsync("Which role would you like to use for members?\r" +
                                "\nThese users will have access to basic commands.\r" +
                                "\nPlease tag a role, like so: @Members, or say 'skip'");

                break;

            case SetupStep.Role_Officer:
                await SendAsync("Which role would you like to use for officers?\r" +
                                "\nThese users will have access to a few user management commands, and will be able to set users to roles less then officer\r" +
                                "\nPlease tag a role, like so: @Officers, or say 'skip'");

                break;

            case SetupStep.Role_Leader:
                await SendAsync("Which role would you like to use for Leaders?\r" +
                                "\nThese users will have access to nearly all of my features around user and clan management.\r" +
                                "\nPlease tag a role, like so: @Leaders, or say 'skip'");

                break;

            case SetupStep.Role_ServerAdmin:
                await SendAsync("Which role would you like to use for Server Admins?\r" +
                                "\nThese users will have access to all of my commands. It is not required that you set this role, as I can detect users who have administrative permissions.\r" +
                                "\nPlease tag a role, like so: @Admins, or say 'skip'");

                break;

            case SetupStep.Set_Website:
                await SendAsync("I can assist in directing users to a website, or message you specify when somebody says, 'bot, website'\r" +
                                "If you would like to use this feature, please tell me the message to send. Else, say 'skip'.");

                break;

            case SetupStep.Set_Loot:
                await SendAsync("I can assist in pointing users to how your loot is managed when somebody says, 'bot, loot'.\r" +
                                "If you would like to use this feature, please tell me the message to send. Else, say 'skip'.");

                break;

            case SetupStep.Done:
            {
                await SendAsync("You have successfully completed my setup wizard.\r" +
                                "\nYou may always type 'bot, setup' to re-run this wizard, or 'bot, help' to show your available commands.\r" +
                                "\nIf you run into any issues, you may submit an issue at https://github.com/XtremeOwnage/WarBot or, join the support server for me.\r" +
                                "\nThanks for trusting WarBOT with all of your needs!");

                await Config.SaveConfig();

                await Bot.CloseDialog(this);
            }
            break;
            }
        }