private void btnFirewallBlockDisable_Click(object sender, EventArgs e) { Log("Disabling Firewall Block"); LiveboxAdapter a = CreateLiveboxAdapter(); a.LoginAsync().OnSuccess((t, o) => { a.SetFirewallToMedium().OnSuccess((t2, o2) => { var res = t2.Result; if (!res.Status.GetValueOrDefault()) { Log("Could not DISABLE firewall block, error: " + res.Errors.First().Description); } else { Log("Firewall block DISABLED: " + res.Status); } }, _uiScheduler).OnSuccess((t3, o3) => { a.GetFirewallLevel().OnSuccess(GetFirewallLevelSuccessHandler(), _uiScheduler); }); }); }
private void btnFirewallBlockEnable_Click(object sender, EventArgs e) { Log("Loading firewall rules from file 'ipblock.csv'"); var rules = ReadFirewallRules(); Log(rules.Length + " rules found"); Log("Enabling Firewall Block"); LiveboxAdapter a = CreateLiveboxAdapter(); a.LoginAsync().OnSuccess((t, o) => { a.SetFirewallToCustom(rules).OnSuccess((t2, o2) => { var res = t2.Result; if (!res.Status.GetValueOrDefault()) { Log("Could not ENABLE firewall block, error: " + res.Errors.First().Description); } else { Log("Firewall block ENABLED: " + res.Status); } }, _uiScheduler).OnSuccess((t3, o3) => { a.GetFirewallLevel().OnSuccess(GetFirewallLevelSuccessHandler(), _uiScheduler); }); }); }
private void btnGetDeviceInfo_Click(object sender, EventArgs e) { Log("Getting Device INFO"); LiveboxAdapter a = CreateLiveboxAdapter(); a.LoginAsync().OnSuccess((t, o) => { a.GetDeviceInfo().OnSuccess((t2, o2) => { var res = t2.Result; if (res == null) { Log("Error: No data returned"); } else { StringBuilder sb = new StringBuilder(); foreach (var p in res.Parameters) { sb.AppendLine(p.Name + ": " + p.Value); } Log(sb.ToString()); } }, _uiScheduler); }); }
private void btnGetFirewallCustomRules_Click(object sender, EventArgs e) { Log("Getting FIREWALL rules"); LiveboxAdapter a = CreateLiveboxAdapter(); a.LoginAsync().OnSuccess((t, o) => { a.GetFirewallCustomRules().OnSuccess((t2, o2) => { var res = t2.Result; if (res == null || res.Length <= 0) { Log("Error: NO data returned"); } else { StringBuilder sb = new StringBuilder(); foreach (var rule in res) { sb.AppendLine(rule.Id + " [" + rule.Enable + "]: " + rule.Target + " Protocol={" + rule.Protocol + "}"); } Log(sb.ToString()); } }, _uiScheduler); }); }
private void InitializeForm() { LiveboxAdapter a = CreateLiveboxAdapter(); if (a == null) { return; } Log("Connecting to Livebox Router at " + a.Origin); scMain.Enabled = true; a.LoginAsync().OnSuccess((t, o) => { a.GetDeviceInfo().OnSuccess((t2, o2) => { _deviceInfo = t2.Result; if (_deviceInfo == null) { Log("Error: No Device info data returned"); } else { StringBuilder sb = new StringBuilder(); foreach (var p in _deviceInfo.Parameters) { sb.AppendLine(p.Name + ": " + p.Value); } Log("Device info:"); Log(sb.ToString()); } }, _uiScheduler); a.GetNetworkStatus().OnSuccess((t2, o2) => { _WANInfo = t2.Result; if (_WANInfo == null) { Log("Error: No Network information found"); } else { Log("Network: "); Log(_WANInfo.ConnectionState + " : " + _WANInfo.IPAddress + " : " + _WANInfo.LinkState); } }, _uiScheduler); a.GetFirewallLevel().OnSuccess(GetFirewallLevelSuccessHandler(), _uiScheduler); }); }
private void btnGetWANStatus_Click(object sender, EventArgs e) { Log("Getting NETWORK status"); LiveboxAdapter a = CreateLiveboxAdapter(); a.LoginAsync().OnSuccess((t, o) => { a.GetNetworkStatus().OnSuccess((t2, o2) => { var res = t2.Result; if (res == null) { Log("Error: NO data returned"); } else { Log("Success: " + res.ConnectionState + " : " + res.IPAddress + " : " + res.LinkState); } }, _uiScheduler); }); }
private void btnApplyFirewallBlock_Click(object sender, EventArgs e) { Log("Setting Firewall to Custom"); LiveboxAdapter a = CreateLiveboxAdapter(); a.LoginAsync().OnSuccess((t, o) => { a.SetFirewallToCustom().OnSuccess((t2, o2) => { var res = t2.Result; if (!res.Status.GetValueOrDefault()) { Log("Error: " + res.Errors.First().Description); } else { Log("Success: " + res.Status); } }, _uiScheduler); }); }