Пример #1
0
        public static void SetupURIValues()
        {
            string ExtractedArg = LocalVars.SharedArgs.Replace("novetus://", "").Replace("novetus", "").Replace(":", "").Replace("/", "").Replace("?", "");
            string ConvertedArg = SecurityFuncs.Base64DecodeOld(ExtractedArg);

            string[] SplitArg = ConvertedArg.Split('|');
            string   ip       = SecurityFuncs.Base64Decode(SplitArg[0]);
            string   port     = SecurityFuncs.Base64Decode(SplitArg[1]);
            string   client   = SecurityFuncs.Base64Decode(SplitArg[2]);

            GlobalVars.UserConfiguration.SelectedClient = client;
            GlobalVars.IP       = ip;
            GlobalVars.JoinPort = Convert.ToInt32(port);
            GlobalFuncs.ReadClientValues();
        }
Пример #2
0
    void LoadToolStripMenuItemClick(object sender, EventArgs e)
    {
        bool IsVersion2 = false;

        using (var ofd = new OpenFileDialog())
        {
            ofd.Filter      = "Novetus Clientinfo files (*.nov)|*.nov";
            ofd.FilterIndex = 1;
            ofd.FileName    = "clientinfo.nov";
            ofd.Title       = "Load clientinfo.nov";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                string file, usesplayername, usesid, warning, legacymode, clientmd5,
                       scriptmd5, desc, locked, fix2007, alreadyhassecurity,
                       cmdargsorclientoptions, commandargsver2;

                using (StreamReader reader = new StreamReader(ofd.FileName))
                {
                    file = reader.ReadLine();
                }

                string ConvertedLine = "";

                try
                {
                    IsVersion2    = true;
                    label9.Text   = "v2 (v" + GlobalVars.ProgramInformation.Version + ")";
                    ConvertedLine = SecurityFuncs.Base64DecodeNew(file);
                }
                catch (Exception)
                {
                    label9.Text   = "v1 (v1.1)";
                    ConvertedLine = SecurityFuncs.Base64DecodeOld(file);
                }

                string[] result = ConvertedLine.Split('|');
                usesplayername         = SecurityFuncs.Base64Decode(result[0]);
                usesid                 = SecurityFuncs.Base64Decode(result[1]);
                warning                = SecurityFuncs.Base64Decode(result[2]);
                legacymode             = SecurityFuncs.Base64Decode(result[3]);
                clientmd5              = SecurityFuncs.Base64Decode(result[4]);
                scriptmd5              = SecurityFuncs.Base64Decode(result[5]);
                desc                   = SecurityFuncs.Base64Decode(result[6]);
                locked                 = SecurityFuncs.Base64Decode(result[7]);
                fix2007                = SecurityFuncs.Base64Decode(result[8]);
                alreadyhassecurity     = SecurityFuncs.Base64Decode(result[9]);
                cmdargsorclientoptions = SecurityFuncs.Base64Decode(result[10]);
                commandargsver2        = "";
                try
                {
                    if (IsVersion2)
                    {
                        commandargsver2 = SecurityFuncs.Base64Decode(result[11]);
                    }
                }
                catch (Exception)
                {
                    if (!label9.Text.Equals("v1 (v1.1)"))
                    {
                        label9.Text = "v2 (v1.2 Snapshot 7440)";
                        IsVersion2  = false;
                    }
                }

                if (!GlobalVars.AdminMode)
                {
                    bool lockcheck = Convert.ToBoolean(locked);
                    if (lockcheck)
                    {
                        NewClientInfo();
                        MessageBox.Show("This client is locked and therefore it cannot be loaded.", "Novetus Launcher - Error when loading client", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    else
                    {
                        Locked            = lockcheck;
                        checkBox4.Checked = Locked;
                    }
                }
                else
                {
                    Locked            = Convert.ToBoolean(locked);
                    checkBox4.Checked = Locked;
                }

                SelectedClientInfo.UsesPlayerName     = Convert.ToBoolean(usesplayername);
                SelectedClientInfo.UsesID             = Convert.ToBoolean(usesid);
                SelectedClientInfo.Warning            = warning;
                SelectedClientInfo.LegacyMode         = Convert.ToBoolean(legacymode);
                SelectedClientInfo.ClientMD5          = clientmd5;
                SelectedClientInfo.ScriptMD5          = scriptmd5;
                SelectedClientInfo.Description        = desc;
                SelectedClientInfo.Fix2007            = Convert.ToBoolean(fix2007);
                SelectedClientInfo.AlreadyHasSecurity = Convert.ToBoolean(alreadyhassecurity);

                try
                {
                    if (IsVersion2)
                    {
                        if (cmdargsorclientoptions.Equals("True") || cmdargsorclientoptions.Equals("False"))
                        {
                            label9.Text = "v2 (v1.2.3)";
                            SelectedClientInfo.ClientLoadOptions = Settings.GraphicsOptions.GetClientLoadOptionsForBool(Convert.ToBoolean(cmdargsorclientoptions));
                        }
                        else
                        {
                            SelectedClientInfo.ClientLoadOptions = Settings.GraphicsOptions.GetClientLoadOptionsForInt(Convert.ToInt32(cmdargsorclientoptions));
                        }
                        SelectedClientInfo.CommandLineArgs = commandargsver2;
                    }
                }
                catch (Exception)
                {
                    //Again, fake it.
                    SelectedClientInfo.ClientLoadOptions = Settings.GraphicsOptions.ClientLoadOptions.Client_2008AndUp;
                    SelectedClientInfo.CommandLineArgs   = cmdargsorclientoptions;
                }

                SelectedClientInfoPath = Path.GetDirectoryName(ofd.FileName);
            }
        }

        checkBox1.Checked = SelectedClientInfo.UsesPlayerName;
        checkBox2.Checked = SelectedClientInfo.UsesID;
        checkBox3.Checked = SelectedClientInfo.LegacyMode;
        checkBox6.Checked = SelectedClientInfo.Fix2007;
        checkBox7.Checked = SelectedClientInfo.AlreadyHasSecurity;

        switch (SelectedClientInfo.ClientLoadOptions)
        {
        case Settings.GraphicsOptions.ClientLoadOptions.Client_2007:
            comboBox1.SelectedIndex = 1;
            break;

        case Settings.GraphicsOptions.ClientLoadOptions.Client_2008AndUp:
            comboBox1.SelectedIndex = 2;
            break;

        case Settings.GraphicsOptions.ClientLoadOptions.Client_2008AndUp_LegacyOpenGL:
            comboBox1.SelectedIndex = 3;
            break;

        case Settings.GraphicsOptions.ClientLoadOptions.Client_2008AndUp_QualityLevel21:
            comboBox1.SelectedIndex = 4;
            break;

        case Settings.GraphicsOptions.ClientLoadOptions.Client_2008AndUp_NoGraphicsOptions:
            comboBox1.SelectedIndex = 5;
            break;

        case Settings.GraphicsOptions.ClientLoadOptions.Client_2008AndUp_ForceAutomatic:
            comboBox1.SelectedIndex = 6;
            break;

        case Settings.GraphicsOptions.ClientLoadOptions.Client_2008AndUp_ForceAutomaticQL21:
            comboBox1.SelectedIndex = 7;
            break;

        case Settings.GraphicsOptions.ClientLoadOptions.Client_2008AndUp_HasCharacterOnlyShadowsLegacyOpenGL:
            comboBox1.SelectedIndex = 8;
            break;

        default:
            comboBox1.SelectedIndex = 0;
            break;
        }
        textBox1.Text = SelectedClientInfo.Description;
        textBox4.Text = SelectedClientInfo.CommandLineArgs;
        textBox5.Text = SelectedClientInfo.Warning;
    }
Пример #3
0
    void LoadToolStripMenuItemClick(object sender, EventArgs e)
    {
        bool IsVersion2 = false;

        using (var ofd = new OpenFileDialog())
        {
            ofd.Filter      = "Novetus Clientinfo files (*.nov)|*.nov";
            ofd.FilterIndex = 1;
            ofd.FileName    = "clientinfo.nov";
            ofd.Title       = "Load clientinfo.nov";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                string file, usesplayername, usesid, warning, legacymode, clientmd5,
                       scriptmd5, desc, locked, fix2007, alreadyhassecurity,
                       cmdargsorclientoptions, commandargsver2, folders,
                       usescustomname, customname;

                using (StreamReader reader = new StreamReader(ofd.FileName))
                {
                    file = reader.ReadLine();
                }

                string ConvertedLine = "";

                try
                {
                    IsVersion2    = true;
                    label9.Text   = curversion + " (v" + GlobalVars.ProgramInformation.Version + ")";
                    ConvertedLine = SecurityFuncs.Base64DecodeNew(file);
                }
                catch (Exception ex)
                {
                    GlobalFuncs.LogExceptions(ex);
                    label9.Text   = "v1 (v1.1)";
                    ConvertedLine = SecurityFuncs.Base64DecodeOld(file);
                }

                string[] result = ConvertedLine.Split('|');
                usesplayername         = SecurityFuncs.Base64Decode(result[0]);
                usesid                 = SecurityFuncs.Base64Decode(result[1]);
                warning                = SecurityFuncs.Base64Decode(result[2]);
                legacymode             = SecurityFuncs.Base64Decode(result[3]);
                clientmd5              = SecurityFuncs.Base64Decode(result[4]);
                scriptmd5              = SecurityFuncs.Base64Decode(result[5]);
                desc                   = SecurityFuncs.Base64Decode(result[6]);
                locked                 = SecurityFuncs.Base64Decode(result[7]);
                fix2007                = SecurityFuncs.Base64Decode(result[8]);
                alreadyhassecurity     = SecurityFuncs.Base64Decode(result[9]);
                cmdargsorclientoptions = SecurityFuncs.Base64Decode(result[10]);
                folders                = "False";
                usescustomname         = "False";
                customname             = "";
                commandargsver2        = "";

                try
                {
                    if (IsVersion2)
                    {
                        commandargsver2 = SecurityFuncs.Base64Decode(result[11]);

                        bool parsedValue;
                        if (bool.TryParse(commandargsver2, out parsedValue))
                        {
                            folders         = SecurityFuncs.Base64Decode(result[11]);
                            commandargsver2 = SecurityFuncs.Base64Decode(result[12]);
                            bool parsedValue2;
                            if (bool.TryParse(commandargsver2, out parsedValue2))
                            {
                                usescustomname  = SecurityFuncs.Base64Decode(result[12]);
                                customname      = SecurityFuncs.Base64Decode(result[13]);
                                commandargsver2 = SecurityFuncs.Base64Decode(result[14]);
                            }
                            else
                            {
                                if (!label9.Text.Equals("v1 (v1.1)"))
                                {
                                    label9.Text = "v2.2 (Last used in v1.3 v11.2021.1)";
                                }
                            }
                        }
                        else
                        {
                            if (!label9.Text.Equals("v1 (v1.1)"))
                            {
                                label9.Text = "v2.1 (Last used in v1.3 Pre-Release 5)";
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    GlobalFuncs.LogExceptions(ex);
                    if (!label9.Text.Equals("v1 (v1.1)"))
                    {
                        label9.Text = "v2 Alpha (Last used in v1.2 Snapshot 7440)";
                        IsVersion2  = false;
                    }
                }

                if (!GlobalVars.AdminMode)
                {
                    bool lockcheck = Convert.ToBoolean(locked);
                    if (lockcheck)
                    {
                        NewClientInfo();
                        MessageBox.Show("This client is locked and therefore it cannot be loaded.", "Novetus Launcher - Error when loading client", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    else
                    {
                        Locked            = lockcheck;
                        checkBox4.Checked = Locked;
                    }
                }
                else
                {
                    Locked            = Convert.ToBoolean(locked);
                    checkBox4.Checked = Locked;
                }

                SelectedClientInfo.UsesPlayerName          = Convert.ToBoolean(usesplayername);
                SelectedClientInfo.UsesID                  = Convert.ToBoolean(usesid);
                SelectedClientInfo.Warning                 = warning;
                SelectedClientInfo.LegacyMode              = Convert.ToBoolean(legacymode);
                SelectedClientInfo.ClientMD5               = clientmd5;
                SelectedClientInfo.ScriptMD5               = scriptmd5;
                SelectedClientInfo.Description             = desc;
                SelectedClientInfo.Fix2007                 = Convert.ToBoolean(fix2007);
                SelectedClientInfo.AlreadyHasSecurity      = Convert.ToBoolean(alreadyhassecurity);
                SelectedClientInfo.SeperateFolders         = Convert.ToBoolean(folders);
                SelectedClientInfo.UsesCustomClientEXEName = Convert.ToBoolean(usescustomname);
                SelectedClientInfo.CustomClientEXEName     = customname;

                try
                {
                    if (IsVersion2)
                    {
                        if (cmdargsorclientoptions.Equals("True") || cmdargsorclientoptions.Equals("False"))
                        {
                            label9.Text = "v2 (Last used in v1.2.3)";
                            SelectedClientInfo.ClientLoadOptions = Settings.GetClientLoadOptionsForBool(Convert.ToBoolean(cmdargsorclientoptions));
                        }
                        else
                        {
                            SelectedClientInfo.ClientLoadOptions = (Settings.ClientLoadOptions)Convert.ToInt32(cmdargsorclientoptions);
                        }
                        SelectedClientInfo.CommandLineArgs = commandargsver2;
                    }
                }
                catch (Exception ex)
                {
                    GlobalFuncs.LogExceptions(ex);
                    //Again, fake it.
                    SelectedClientInfo.ClientLoadOptions = Settings.ClientLoadOptions.Client_2008AndUp;
                    SelectedClientInfo.CommandLineArgs   = cmdargsorclientoptions;
                }

                SelectedClientInfoPath = Path.GetDirectoryName(ofd.FileName);
            }
        }

        LoadUIElements();
    }