Пример #1
0
        private void PatchAuthIniFile()
        {
            string file          = Path.Combine(Setting.IniDirectoryName, "Auth.ini");
            string fileBackup    = Path.Combine(Setting.IniDirectoryName, "Auth.ini.orig");
            bool   patchRequired = false;

            if (File.Exists(file) == false && File.Exists(fileBackup))
            {
                // Restore Backup
                File.Copy(fileBackup, file);
            }

            string RegHostName = Setting.RegistrationHostname;

            if (Setting.UseLocalCert)
            {
                RegHostName = "local.net-7.org";
            }

            UriBuilder builder = new UriBuilder();

            builder.Scheme = Setting.UseSecureAuthentication ? "https" : "http";
            builder.Host   = RegHostName;
            builder.Path   = "misc/touchsession.jsp";
            builder.Query  = "lkey=%s";

            string url = builder.ToString();

            if (String.Equals(IniUtility.GetValue(file, "General", "AAIUrl"), RegHostName, StringComparison.InvariantCultureIgnoreCase) == false)
            {
                patchRequired = true;
            }
            else if (String.Equals(IniUtility.GetValue(file, "General", "LKeyUrl"), url, StringComparison.InvariantCultureIgnoreCase) == false)
            {
                patchRequired = true;
            }

            if (patchRequired == false)
            {
                return;
            }

            // Create Backup
            File.Copy(file, fileBackup, true);

            IniUtility.SetValue(file, "General", "AAIUrl", RegHostName);
            IniUtility.SetValue(file, "General", "LKeyUrl", url);
        }
Пример #2
0
        private void PatchRegDataFile()
        {
            string file          = Path.Combine(Setting.IniDirectoryName, "rg_regdata.ini");
            string fileBackup    = Path.Combine(Setting.IniDirectoryName, "rg_regdata.ini.orig");
            bool   patchRequired = false;

            string RegHostName = Setting.RegistrationHostname;

            if (Setting.UseLocalCert)
            {
                RegHostName = "local.net-7.org";
            }

            if (File.Exists(file) == false && File.Exists(fileBackup))
            {
                // Restore Backup
                File.Copy(fileBackup, file);
            }

            UriBuilder builder = new UriBuilder();

            builder.Scheme = Setting.UseSecureAuthentication ? "https" : "http";
            builder.Host   = RegHostName;
            builder.Path   = "subsxml";

            string registrationUrl = builder.ToString();

            if (String.Equals(IniUtility.GetValue(file, "Connection", "regserverurl"), registrationUrl, StringComparison.InvariantCultureIgnoreCase) == false)
            {
                patchRequired = true;
            }

            if (patchRequired == false)
            {
                return;
            }

            // Create Backup
            File.Copy(file, fileBackup, true);

            IniUtility.SetValue(file, "Connection", "regserverurl", registrationUrl);
        }
Пример #3
0
        private void PatchNetworkIniFile()
        {
            string file          = Path.Combine(Setting.CommonDirectoryName, "Network.ini");
            string fileBackup    = Path.Combine(Setting.CommonDirectoryName, "Network.ini.orig");
            bool   patchRequired = false;

            if (File.Exists(file) == false && File.Exists(fileBackup))
            {
                // Restore Backup
                File.Copy(fileBackup, file);
            }

            string hostName = Setting.Hostname;

            if (Setting.UseLocalCert)
            {
                hostName = "local.net-7.org";
            }

            if (String.Equals(IniUtility.GetValue(file, "MasterServer", "Name"), hostName, StringComparison.InvariantCultureIgnoreCase) == false)
            {
                patchRequired = true;
            }
            else if (String.Equals(IniUtility.GetValue(file, "RegisterServer", "Name"), hostName, StringComparison.InvariantCultureIgnoreCase) == false)
            {
                patchRequired = true;
            }
            else if (String.Equals(IniUtility.GetValue(file, "ReporterServer", "Name"), hostName, StringComparison.InvariantCultureIgnoreCase) == false)
            {
                patchRequired = true;
            }
            else if (String.Equals(IniUtility.GetValue(file, "GlobalServer_Directory", "Name"), hostName, StringComparison.InvariantCultureIgnoreCase) == false)
            {
                patchRequired = true;
            }
            else if (String.Equals(IniUtility.GetValue(file, "GlobalServer_Client", "Name"), hostName, StringComparison.InvariantCultureIgnoreCase) == false)
            {
                patchRequired = true;
            }
            else if (String.Equals(IniUtility.GetValue(file, "GlobalServer_Register", "Name"), hostName, StringComparison.InvariantCultureIgnoreCase) == false)
            {
                patchRequired = true;
            }
            else if (String.Equals(IniUtility.GetValue(file, "GlobalServer_Parent", "Name"), hostName, StringComparison.InvariantCultureIgnoreCase) == false)
            {
                patchRequired = true;
            }
            else if (String.Equals(IniUtility.GetValue(file, "ChatServer", "Name"), hostName, StringComparison.InvariantCultureIgnoreCase) == false)
            {
                patchRequired = true;
            }
            else if (String.Equals(IniUtility.GetValue(file, "ChatServer_Basic", "Name"), hostName, StringComparison.InvariantCultureIgnoreCase) == false)
            {
                patchRequired = true;
            }
            else if (String.Equals(IniUtility.GetValue(file, "GroupServer", "Name"), hostName, StringComparison.InvariantCultureIgnoreCase) == false)
            {
                patchRequired = true;
            }
            else if (String.Equals(IniUtility.GetValue(file, "GuildServer", "Name"), hostName, StringComparison.InvariantCultureIgnoreCase) == false)
            {
                patchRequired = true;
            }

            if (patchRequired == false)
            {
                return;
            }

            // Create Backup
            File.Copy(file, fileBackup, true);

            IniUtility.SetValue(file, "MasterServer", "Name", hostName);
            IniUtility.SetValue(file, "RegisterServer", "Name", hostName);
            IniUtility.SetValue(file, "ReporterServer", "Name", hostName);
            IniUtility.SetValue(file, "GlobalServer_Directory", "Name", hostName);
            IniUtility.SetValue(file, "GlobalServer_Client", "Name", hostName);
            IniUtility.SetValue(file, "GlobalServer_Register", "Name", hostName);
            IniUtility.SetValue(file, "GlobalServer_Parent", "Name", hostName);
            IniUtility.SetValue(file, "ChatServer", "Name", hostName);
            IniUtility.SetValue(file, "ChatServer_Basic", "Name", hostName);
            IniUtility.SetValue(file, "GroupServer", "Name", hostName);
            IniUtility.SetValue(file, "GuildServer", "Name", hostName);
        }