internal Proxy(bool bIsPrimary) { if (bIsPrimary) { try { NetworkChange.NetworkAvailabilityChanged += new NetworkAvailabilityChangedEventHandler(this.NetworkChange_NetworkAvailabilityChanged); NetworkChange.NetworkAddressChanged += new NetworkAddressChangedEventHandler(this.NetworkChange_NetworkAddressChanged); } catch { } try { this.watcherPrefNotify = new PreferenceBag.PrefWatcher?(KProxyApplication.Prefs.AddWatcher("KProxy.network", new EventHandler <PrefChangeEventArgs>(this.onNetworkPrefsChange))); this.SetDefaultEgressEndPoint(KProxyApplication.Prefs["KProxy.network.egress.ip"]); KPCONFIG.SetNoDecryptList(KProxyApplication.Prefs["KProxy.network.https.NoDecryptionHosts"]); KPCONFIG.sKProxyListenHostPort = KProxyApplication.Prefs.GetStringPref("KProxy.network.proxy.RegistrationHostName", "127.0.0.1") + ":" + KPCONFIG.ListenPort.ToString(); ClientChatter._cbClientReadBuffer = KProxyApplication.Prefs.GetInt32Pref("KProxy.network.sockets.ClientReadBufferSize", 0x2000); ServerChatter._cbServerReadBuffer = KProxyApplication.Prefs.GetInt32Pref("KProxy.network.sockets.ServerReadBufferSize", 0x8000); } catch { } } }
private void onNetworkPrefsChange(object sender, PrefChangeEventArgs oPCE) { if (oPCE.PrefName == "KProxy.network.sockets.ClientReadBufferSize") { ClientChatter._cbClientReadBuffer = KProxyApplication.Prefs.GetInt32Pref("KProxy.network.sockets.ClientReadBufferSize", 0x2000); } if (oPCE.PrefName == "KProxy.network.sockets.ServerReadBufferSize") { ServerChatter._cbServerReadBuffer = KProxyApplication.Prefs.GetInt32Pref("KProxy.network.sockets.ServerReadBufferSize", 0x8000); } if (oPCE.PrefName == "KProxy.network.egress.ip") { this.SetDefaultEgressEndPoint(oPCE.ValueString); } else if (oPCE.PrefName == "KProxy.network.https.NoDecryptionHosts") { KPCONFIG.SetNoDecryptList(oPCE.ValueString); } else if (oPCE.PrefName == "KProxy.network.proxy.RegistrationHostName") { KPCONFIG.sKProxyListenHostPort = KProxyApplication.Prefs.GetStringPref("KProxy.network.proxy.RegistrationHostName", "127.0.0.1") + ":" + KPCONFIG.ListenPort.ToString(); } }