TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ LoadServerParameters()

static void Terraria.Initializers.LaunchInitializer.LoadServerParameters ( Main game)
inlinestaticprivate

Definition at line 95 of file LaunchInitializer.cs.

96 {
97 if (!OperatingSystem.IsWindows())
98 {
99 if (TryParameter("-forcepriority") != null)
100 {
101 Logging.tML.Warn((object)"The -forcepriority command line parameter has no effect on non-Windows OS. You'll have to set priority manually within your OS.");
102 }
103 }
104 else
105 {
106 try
107 {
108 string s;
109 if ((s = TryParameter("-forcepriority")) != null)
110 {
111 Process currentProcess = Process.GetCurrentProcess();
112 if (int.TryParse(s, out var result))
113 {
114 switch (result)
115 {
116 case 0:
117 currentProcess.PriorityClass = ProcessPriorityClass.RealTime;
118 break;
119 case 1:
120 currentProcess.PriorityClass = ProcessPriorityClass.High;
121 break;
122 case 2:
123 currentProcess.PriorityClass = ProcessPriorityClass.AboveNormal;
124 break;
125 case 3:
126 currentProcess.PriorityClass = ProcessPriorityClass.Normal;
127 break;
128 case 4:
129 currentProcess.PriorityClass = ProcessPriorityClass.BelowNormal;
130 break;
131 case 5:
132 currentProcess.PriorityClass = ProcessPriorityClass.Idle;
133 break;
134 default:
135 currentProcess.PriorityClass = ProcessPriorityClass.High;
136 break;
137 }
138 }
139 else
140 {
141 currentProcess.PriorityClass = ProcessPriorityClass.High;
142 }
143 }
144 else
145 {
146 Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
147 }
148 }
149 catch
150 {
151 }
152 }
153 string value;
154 if ((value = TryParameter("-maxplayers", "-players")) != null)
155 {
156 int num = Convert.ToInt32(value);
157 if (num <= 255 && num >= 1)
158 {
159 game.SetNetPlayers(num);
160 }
161 }
162 string arg;
163 if ((arg = TryParameter("-pass", "-password")) != null)
164 {
165 Netplay.ServerPassword = Main.ConvertFromSafeArgument(arg);
166 }
167 string s2;
168 if ((s2 = TryParameter("-lang")) != null && int.TryParse(s2, out var result2))
169 {
170 LanguageManager.Instance.SetLanguage(result2);
171 }
172 if ((s2 = TryParameter("-language")) != null)
173 {
174 LanguageManager.Instance.SetLanguage(s2);
175 }
176 string publish = TryParameter("-publish");
177 if (publish != null)
178 {
180 }
181 string install = TryParameter("-install");
182 if (install != null)
183 {
185 }
186 string worldName;
187 if ((worldName = TryParameter("-worldname")) != null)
188 {
189 game.SetWorldName(worldName);
190 }
191 string newMOTD;
192 if ((newMOTD = TryParameter("-motd")) != null)
193 {
194 game.NewMOTD(newMOTD);
195 }
196 string modPath = TryParameter("-modpath");
197 if (modPath != null)
198 {
199 ModOrganizer.modPath = modPath;
200 }
201 if (HasParameter("-showserverconsole"))
202 {
203 Main.showServerConsole = true;
204 }
205 string banFilePath;
206 if ((banFilePath = TryParameter("-banlist")) != null)
207 {
208 Netplay.BanFilePath = banFilePath;
209 }
210 if (HasParameter("-autoshutdown"))
211 {
212 game.EnableAutoShutdown();
213 }
214 if (HasParameter("-secure"))
215 {
216 Netplay.SpamCheck = true;
217 }
219 if ((serverWorldRollbacks = TryParameter("-worldrollbackstokeep")) != null)
220 {
221 game.setServerWorldRollbacks(serverWorldRollbacks);
222 }
223 string worldSize;
224 if ((worldSize = TryParameter("-autocreate")) != null)
225 {
226 game.autoCreate(worldSize);
227 }
228 if (HasParameter("-noupnp"))
229 {
230 Netplay.UseUPNP = false;
231 }
232 if (HasParameter("-experimental"))
233 {
234 Main.UseExperimentalFeatures = true;
235 }
236 string world;
237 if ((world = TryParameter("-world")) != null)
238 {
239 game.SetWorld(world, cloud: false);
240 }
241 else if (SocialAPI.Mode == SocialMode.Steam && (world = TryParameter("-cloudworld")) != null)
242 {
243 game.SetWorld(world, cloud: true);
244 }
245 string configPath;
246 if ((configPath = TryParameter("-config")) != null)
247 {
248 game.LoadDedConfig(configPath);
249 }
250 string autogenSeedName;
251 if ((autogenSeedName = TryParameter("-seed")) != null)
252 {
253 Main.AutogenSeedName = autogenSeedName;
254 }
255 }
static string TryParameter(params string[] keys)
static bool HasParameter(params string[] keys)
static void PublishModCommandLine(string modName)
static SocialMode Mode
Definition SocialAPI.cs:38

References Terraria.Main.ConvertFromSafeArgument(), Terraria.ModLoader.Engine.FileAssociationSupport.HandleFileAssociation(), Terraria.Initializers.LaunchInitializer.HasParameter(), Terraria.Localization.LanguageManager.Instance, Terraria.Social.SocialAPI.Mode, Terraria.ModLoader.UI.UIModSourceItem.PublishModCommandLine(), Terraria.ModLoader.Logging.tML, and Terraria.Initializers.LaunchInitializer.TryParameter().

Referenced by Terraria.Initializers.LaunchInitializer.LoadParameters().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: