// to keep sane during testing period private static void ProvidePasswordPatch(On.ZNet.orig_RPC_ClientHandshake orig, ZNet self, ZRpc rpc, bool needPassword) { if (Environment.GetCommandLineArgs().Any(x => x.ToLower() == "+password")) { var args = Environment.GetCommandLineArgs(); // find password argument index var index = 0; while (index < args.Length && args[index].ToLower() != "+password") { index++; } index++; // is there a password after +password? if (index < args.Length) { // do normal handshake self.m_connectingDialog.gameObject.SetActive(false); self.SendPeerInfo(rpc, args[index]); return; } } orig(self, rpc, needPassword); }
// Send client module list to server private static void ZNet_RPC_ClientHandshake(On.ZNet.orig_RPC_ClientHandshake orig, ZNet self, ZRpc rpc, bool needPassword) { rpc.Invoke(nameof(RPC_Jotunn_ReceiveVersionData), new ModuleVersionData(GetEnforcableMods().ToList()).ToZPackage()); orig(self, rpc, needPassword); }