Example #1
0
        private void _netflixStatusChecker_UnblockUsStatus(object sender, UnblockUsEventArgs e)
        {
            var lines = new List <string>();

            lines.Add(e.Action + " (" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ")");
            lines.AddRange(new[]
            {
                "CountryCode: " + e.CountryCode,
                "DnsActive: " + e.DnsActive,
                "New IP: " + e.Config?.ip_changed
            });
            lines.Add("--------------");

            foreach (var line in lines)
            {
                tbUnblockLog.AppendText(line + Environment.NewLine);
            }

            // Select the right country in the dropdown if it has changed
            cmbNetflixRegionPicker.SelectedItem = CountryCodes.FirstOrDefault(x => x.Code.Equals(e.CountryCode, StringComparison.OrdinalIgnoreCase));

            var selectedCountry = cmbNetflixRegionPicker.SelectedItem as CountryCode;

            if (selectedCountry == null || e.Config == null)
            {
                return;
            }

            btnVerifyUsername.Image = tbUsername.Text.Equals(e.Config.email, StringComparison.OrdinalIgnoreCase) ? _imageOK : _imageError;
            btnUnblockActive.Image  = e.DnsActive ? _imageOK : _imageError;
            btnUnblockCountry.Image = selectedCountry.Code.Equals(e.CountryCode, StringComparison.OrdinalIgnoreCase) ? _imageOK : _imageError;
        }
Example #2
0
        private void ParseUnblockUsStatus(string statusMessage, string action)
        {
            var e = new UnblockUsEventArgs
            {
                Action  = action,
                Message = "Error"
            };

            if (!string.IsNullOrWhiteSpace(statusMessage))
            {
                // Extract the actual data from the status message (it might be a raw message from a socket)
                var statusMessageClean = statusMessage.Substring(statusMessage.IndexOf("callback("));

                var msg = statusMessageClean.Substring(0, statusMessageClean.IndexOf('}') + 1);
                msg       = msg.Substring(msg.IndexOf('{'));
                e.Message = msg;

                e.Config      = new JavaScriptSerializer().Deserialize <UnblockUsConfig>(msg);
                e.DnsActive   = e.Config.our_dns;
                e.CountryCode = e.Config.current?.ToLower();
            }

            OnUnblockUsStatus(e);
        }
Example #3
0
 protected virtual void OnUnblockUsStatus(UnblockUsEventArgs e)
 {
     UnblockUsStatus?.Invoke(this, e);
 }