Пример #1
0
        private static void LoadClientParameters(Main game)
        {
            string[] strArray1 = new string[2] {
                "-j", "-join"
            };
            string IP;

            if ((IP = LaunchInitializer.TryParameter(strArray1)) != null)
            {
                game.AutoJoin(IP);
            }
            string[] strArray2 = new string[2]
            {
                "-pass",
                "-password"
            };
            string str;

            if ((str = LaunchInitializer.TryParameter(strArray2)) != null)
            {
                Netplay.ServerPassword = str;
                game.AutoPass();
            }
            if (!LaunchInitializer.HasParameter("-host"))
            {
                return;
            }
            game.AutoHost();
        }
Пример #2
0
        // Token: 0x06000AB5 RID: 2741 RVA: 0x003C6B84 File Offset: 0x003C4D84
        private static void LoadClientParameters(Main game)
        {
            string iP;

            if ((iP = LaunchInitializer.TryParameter(new string[]
            {
                "-j",
                "-join"
            })) != null)
            {
                game.AutoJoin(iP);
            }
            string serverPassword;

            if ((serverPassword = LaunchInitializer.TryParameter(new string[]
            {
                "-pass",
                "-password"
            })) != null)
            {
                Netplay.ServerPassword = serverPassword;
                game.AutoPass();
            }
            if (LaunchInitializer.HasParameter(new string[]
            {
                "-host"
            }))
            {
                game.AutoHost();
            }
        }
Пример #3
0
        private static void LoadSharedParameters(Main game)
        {
            string[] strArray1 = new string[1] {
                "-loadlib"
            };
            string path;

            if ((path = LaunchInitializer.TryParameter(strArray1)) != null)
            {
                game.loadLib(path);
            }
            string[] strArray2 = new string[2] {
                "-p", "-port"
            };
            string s;
            int    result;

            if ((s = LaunchInitializer.TryParameter(strArray2)) == null || !int.TryParse(s, out result))
            {
                return;
            }
            Netplay.ListenPort = result;
        }
Пример #4
0
        // Token: 0x06000AB4 RID: 2740 RVA: 0x003C6B28 File Offset: 0x003C4D28
        private static void LoadSharedParameters(Main game)
        {
            string path;

            if ((path = LaunchInitializer.TryParameter(new string[]
            {
                "-loadlib"
            })) != null)
            {
                game.loadLib(path);
            }
            string s;
            int    listenPort;

            if ((s = LaunchInitializer.TryParameter(new string[]
            {
                "-p",
                "-port"
            })) != null && int.TryParse(s, out listenPort))
            {
                Netplay.ListenPort = listenPort;
            }
        }
Пример #5
0
        private static void LoadServerParameters(Main game)
        {
            try
            {
                string[] strArray = new string[1]
                {
                    "-forcepriority"
                };
                string s;
                if ((s = LaunchInitializer.TryParameter(strArray)) != null)
                {
                    Process currentProcess = Process.GetCurrentProcess();
                    int     result;
                    if (int.TryParse(s, out result))
                    {
                        switch (result)
                        {
                        case 0:
                            currentProcess.PriorityClass = ProcessPriorityClass.RealTime;
                            break;

                        case 1:
                            currentProcess.PriorityClass = ProcessPriorityClass.High;
                            break;

                        case 2:
                            currentProcess.PriorityClass = ProcessPriorityClass.AboveNormal;
                            break;

                        case 3:
                            currentProcess.PriorityClass = ProcessPriorityClass.Normal;
                            break;

                        case 4:
                            currentProcess.PriorityClass = ProcessPriorityClass.BelowNormal;
                            break;

                        case 5:
                            currentProcess.PriorityClass = ProcessPriorityClass.Idle;
                            break;

                        default:
                            currentProcess.PriorityClass = ProcessPriorityClass.High;
                            break;
                        }
                    }
                    else
                    {
                        currentProcess.PriorityClass = ProcessPriorityClass.High;
                    }
                }
                else
                {
                    Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
                }
            }
            catch
            {
            }
            string[] strArray1 = new string[2]
            {
                "-maxplayers",
                "-players"
            };
            string s1;
            int    result1;

            if ((s1 = LaunchInitializer.TryParameter(strArray1)) != null && int.TryParse(s1, out result1))
            {
                game.SetNetPlayers(result1);
            }
            string[] strArray2 = new string[2]
            {
                "-pass",
                "-password"
            };
            string str1;

            if ((str1 = LaunchInitializer.TryParameter(strArray2)) != null)
            {
                Netplay.ServerPassword = str1;
            }
            string[] strArray3 = new string[1] {
                "-lang"
            };
            string s2;
            int    result2;

            if ((s2 = LaunchInitializer.TryParameter(strArray3)) != null && int.TryParse(s2, out result2))
            {
                LanguageManager.Instance.SetLanguage(result2);
            }
            string[] strArray4 = new string[1] {
                "-language"
            };
            string cultureName;

            if ((cultureName = LaunchInitializer.TryParameter(strArray4)) != null)
            {
                LanguageManager.Instance.SetLanguage(cultureName);
            }
            string[] strArray5 = new string[1] {
                "-worldname"
            };
            string world1;

            if ((world1 = LaunchInitializer.TryParameter(strArray5)) != null)
            {
                game.SetWorldName(world1);
            }
            string[] strArray6 = new string[1] {
                "-motd"
            };
            string newMOTD;

            if ((newMOTD = LaunchInitializer.TryParameter(strArray6)) != null)
            {
                game.NewMOTD(newMOTD);
            }
            string[] strArray7 = new string[1] {
                "-banlist"
            };
            string str2;

            if ((str2 = LaunchInitializer.TryParameter(strArray7)) != null)
            {
                Netplay.BanFilePath = str2;
            }
            if (LaunchInitializer.HasParameter("-autoshutdown"))
            {
                game.EnableAutoShutdown();
            }
            if (LaunchInitializer.HasParameter("-secure"))
            {
                Netplay.spamCheck = true;
            }
            string[] strArray8 = new string[1] {
                "-autocreate"
            };
            string worldSize;

            if ((worldSize = LaunchInitializer.TryParameter(strArray8)) != null)
            {
                game.autoCreate(worldSize);
            }
            if (LaunchInitializer.HasParameter("-noupnp"))
            {
                Netplay.UseUPNP = false;
            }
            if (LaunchInitializer.HasParameter("-experimental"))
            {
                Main.UseExperimentalFeatures = true;
            }
            string[] strArray9 = new string[1] {
                "-world"
            };
            string world2;

            if ((world2 = LaunchInitializer.TryParameter(strArray9)) != null)
            {
                game.SetWorld(world2, false);
            }
            else if (SocialAPI.Mode == SocialMode.Steam)
            {
                string[] strArray10 = new string[1] {
                    "-cloudworld"
                };
                string world3;
                if ((world3 = LaunchInitializer.TryParameter(strArray10)) != null)
                {
                    game.SetWorld(world3, true);
                }
            }
            string[] strArray11 = new string[1] {
                "-config"
            };
            string configPath;

            if ((configPath = LaunchInitializer.TryParameter(strArray11)) != null)
            {
                game.LoadDedConfig(configPath);
            }
            string[] strArray12 = new string[1] {
                "-seed"
            };
            string str3;

            if ((str3 = LaunchInitializer.TryParameter(strArray12)) == null)
            {
                return;
            }
            Main.AutogenSeedName = str3;
        }
Пример #6
0
 public static void LoadParameters(Main game)
 {
     LaunchInitializer.LoadSharedParameters(game);
     LaunchInitializer.LoadServerParameters(game);
 }
Пример #7
0
        // Token: 0x06000AB6 RID: 2742 RVA: 0x003C6C00 File Offset: 0x003C4E00
        private static void LoadServerParameters(Main game)
        {
            try
            {
                string s;
                if ((s = LaunchInitializer.TryParameter(new string[]
                {
                    "-forcepriority"
                })) != null)
                {
                    Process currentProcess = Process.GetCurrentProcess();
                    int     num;
                    if (int.TryParse(s, out num))
                    {
                        switch (num)
                        {
                        case 0:
                            currentProcess.PriorityClass = ProcessPriorityClass.RealTime;
                            break;

                        case 1:
                            currentProcess.PriorityClass = ProcessPriorityClass.High;
                            break;

                        case 2:
                            currentProcess.PriorityClass = ProcessPriorityClass.AboveNormal;
                            break;

                        case 3:
                            currentProcess.PriorityClass = ProcessPriorityClass.Normal;
                            break;

                        case 4:
                            currentProcess.PriorityClass = ProcessPriorityClass.BelowNormal;
                            break;

                        case 5:
                            currentProcess.PriorityClass = ProcessPriorityClass.Idle;
                            break;

                        default:
                            currentProcess.PriorityClass = ProcessPriorityClass.High;
                            break;
                        }
                    }
                    else
                    {
                        currentProcess.PriorityClass = ProcessPriorityClass.High;
                    }
                }
                else
                {
                    Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
                }
            }
            catch
            {
            }
            string s2;
            int    netPlayers;

            if ((s2 = LaunchInitializer.TryParameter(new string[]
            {
                "-maxplayers",
                "-players"
            })) != null && int.TryParse(s2, out netPlayers))
            {
                game.SetNetPlayers(netPlayers);
            }
            string serverPassword;

            if ((serverPassword = LaunchInitializer.TryParameter(new string[]
            {
                "-pass",
                "-password"
            })) != null)
            {
                Netplay.ServerPassword = serverPassword;
            }
            string text;
            int    language;

            if ((text = LaunchInitializer.TryParameter(new string[]
            {
                "-lang"
            })) != null && int.TryParse(text, out language))
            {
                LanguageManager.Instance.SetLanguage(language);
            }
            if ((text = LaunchInitializer.TryParameter(new string[]
            {
                "-language"
            })) != null)
            {
                LanguageManager.Instance.SetLanguage(text);
            }
            string worldName;

            if ((worldName = LaunchInitializer.TryParameter(new string[]
            {
                "-worldname"
            })) != null)
            {
                game.SetWorldName(worldName);
            }
            string newMOTD;

            if ((newMOTD = LaunchInitializer.TryParameter(new string[]
            {
                "-motd"
            })) != null)
            {
                game.NewMOTD(newMOTD);
            }
            string banFilePath;

            if ((banFilePath = LaunchInitializer.TryParameter(new string[]
            {
                "-banlist"
            })) != null)
            {
                Netplay.BanFilePath = banFilePath;
            }
            if (LaunchInitializer.HasParameter(new string[]
            {
                "-autoshutdown"
            }))
            {
                game.EnableAutoShutdown();
            }
            if (LaunchInitializer.HasParameter(new string[]
            {
                "-secure"
            }))
            {
                Netplay.spamCheck = true;
            }
            string worldSize;

            if ((worldSize = LaunchInitializer.TryParameter(new string[]
            {
                "-autocreate"
            })) != null)
            {
                game.autoCreate(worldSize);
            }
            if (LaunchInitializer.HasParameter(new string[]
            {
                "-noupnp"
            }))
            {
                Netplay.UseUPNP = false;
            }
            if (LaunchInitializer.HasParameter(new string[]
            {
                "-experimental"
            }))
            {
                Main.UseExperimentalFeatures = true;
            }
            string world;

            if ((world = LaunchInitializer.TryParameter(new string[]
            {
                "-world"
            })) != null)
            {
                game.SetWorld(world, false);
            }
            else if (SocialAPI.Mode == SocialMode.Steam && (world = LaunchInitializer.TryParameter(new string[]
            {
                "-cloudworld"
            })) != null)
            {
                game.SetWorld(world, true);
            }
            string configPath;

            if ((configPath = LaunchInitializer.TryParameter(new string[]
            {
                "-config"
            })) != null)
            {
                game.LoadDedConfig(configPath);
            }
            string autogenSeedName;

            if ((autogenSeedName = LaunchInitializer.TryParameter(new string[]
            {
                "-seed"
            })) != null)
            {
                Main.AutogenSeedName = autogenSeedName;
            }
        }