Пример #1
0
        public void OnArgumentsReceived(string arguments)
        {
            if (!string.IsNullOrEmpty(arguments))
            {
                string launchArgs = arguments.TrimEnd('\0');
                launchArgs = StringExtension.ReplaceFirst(launchArgs, "?", OPT.Instance.GetString("codepage"));
                launchArgs = StringExtension.ReplaceFirst(launchArgs, "?", OPT.Instance.GetString("country"));
                launchArgs = StringExtension.ReplaceFirst(launchArgs, "?", OPT.Instance.GetString("username"));
                launchArgs = StringExtension.ReplaceFirst(launchArgs, "?", otp);

                if (OPT.Instance.GetBool("showfps"))
                {
                    launchArgs += " /winfps";
                }

                if (SFrameBypass.Start(10, launchArgs))
                {
                    if (OPT.Instance.GetBool("closeonstart"))
                    {
                        Instance.Invoke(new MethodInvoker(delegate { Instance.Close(); }));
                    }
                }
                else
                {
                    MessageBox.Show("The SFrame.exe has failed to start", "Fatal Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); Instance.Close();
                }
            }
        }
Пример #2
0
        internal void OnArgumentsReceived(string arguments, int startType, bool isMaintenance)
        {
            if (!string.IsNullOrEmpty(arguments))
            {
                string launchArgs = arguments.TrimEnd('\0');
                launchArgs = StringExtension.ReplaceFirst(launchArgs, "?", OPT.Instance.GetString("codepage"));
                launchArgs = StringExtension.ReplaceFirst(launchArgs, "?", OPT.Instance.GetString("country"));

                if (authenticationType == 1)
                {
                    launchArgs = StringExtension.ReplaceFirst(launchArgs, "?", OPT.Instance.GetString("username"));
                    launchArgs = StringExtension.ReplaceFirst(launchArgs, "?", otp);
                }

                if (OPT.Instance.GetBool("showfps"))
                {
                    launchArgs += " /winfps";
                }

                if (!isMaintenance)
                {
                    if (startType == 1) // Use SFrameBypass
                    {
                        if (!SFrameBypass.Start(10, launchArgs))
                        {
                            MessageBox.Show("The SFrame.exe has failed to start", "Fatal Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); Instance.close_Click(null, EventArgs.Empty);
                        }
                    }
                    else
                    {
                        var p = new ProcessStartInfo();
                        p.FileName         = string.Concat(OPT.Instance.GetString("clientdirectory"), @"\SFrame.exe");
                        p.WorkingDirectory = OPT.Instance.GetString("clientdirectory");
                        p.UseShellExecute  = false;
                        p.Arguments        = launchArgs;
                        Process.Start(p);
                    }

                    if (OPT.Instance.GetBool("closeonstart"))
                    {
                        Instance.Invoke(new MethodInvoker(delegate { Instance.close_Click(null, EventArgs.Empty); }));
                    }
                }
                else
                {
                    MessageBox.Show("Cannot start because the server is currently in maintenance!\n\nTry again in a little bit!", "Maintenance Exception", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
            }
        }