Beispiel #1
0
        public frmNetworkInfo(BitChatClient service)
        {
            InitializeComponent();

            _service = service;

            listView1.Items.Add("Local Peer ID").SubItems.Add("Loading...");
            listView1.Items.Add("Local Port").SubItems.Add("Loading...");
            listView1.Items.Add("DHT Node ID").SubItems.Add("Loading...");
            listView1.Items.Add("DHT Port").SubItems.Add("Loading...");
            listView1.Items.Add("DHT Nodes").SubItems.Add("Loading...");
            listView1.Items.Add("Internet Status").SubItems.Add("Loading...");
            listView1.Items.Add("UPnP Status").SubItems.Add("Loading...");
            listView1.Items.Add("UPnP Device IP").SubItems.Add("Loading...");
            listView1.Items.Add("UPnP External IP").SubItems.Add("Loading...");
            listView1.Items.Add("Proxy Server").SubItems.Add("Loading...");
            listView1.Items.Add("External End Point").SubItems.Add("Loading...");
            listView1.Items.Add("Tcp Relays").SubItems.Add("Loading...");

            updateTimer_Tick(null, null);

            _updateTimer          = new Timer();
            _updateTimer.Interval = 2000;
            _updateTimer.Tick    += updateTimer_Tick;
            _updateTimer.Start();
        }
Beispiel #2
0
        public frmShareFileSelection(BitChatClient client, SharedFile sharedFile)
        {
            InitializeComponent();

            BitChat[] sharedChats = sharedFile.GetChatList();

            foreach (BitChat chat in client.GetBitChatList())
            {
                bool found = false;

                foreach (BitChat sharedChat in sharedChats)
                {
                    if (sharedChat == chat)
                    {
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    checkedListBox1.Items.Add(chat);
                }
            }
        }
        private void Client_InvalidCertificateDetected(BitChatClient client, InvalidCertificateException e)
        {
            MessageBox.Show(e.Message + "\r\n\r\nClick OK to logout from this Bit Chat profile.", "Invalid Certificate Detected", MessageBoxButtons.OK, MessageBoxIcon.Error);

            this.Hide();
            this.DialogResult = DialogResult.Ignore;
            this.Close();
        }
        private void Client_BitChatInvitationReceived(BitChatClient client, BitChat chat)
        {
            AddChatView(chat);

            if (lstChats.Controls.Count == 1)
            {
                lstChats.SelectItem(lstChats.GetFirstItem());
                ShowSelectedChatView();
            }
        }
        public frmMain(BitChatProfile profile, string profileFilePath, string cmdLine)
        {
            InitializeComponent();

            _profile         = profile;
            _profileFilePath = profileFilePath;

            SecureChannelCryptoOptionFlags cryptoOptions;

            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Win32NT:
                if (Environment.OSVersion.Version.Major > 5)
                {
                    cryptoOptions = SecureChannelCryptoOptionFlags.ECDHE256_RSA_WITH_AES256_CBC_HMAC_SHA256 | SecureChannelCryptoOptionFlags.DHE2048_RSA_WITH_AES256_CBC_HMAC_SHA256;
                }
                else
                {
                    cryptoOptions = SecureChannelCryptoOptionFlags.DHE2048_RSA_WITH_AES256_CBC_HMAC_SHA256;
                }

                break;

            default:
                cryptoOptions = SecureChannelCryptoOptionFlags.DHE2048_RSA_WITH_AES256_CBC_HMAC_SHA256;
                break;
            }

            //start bitchat client
            _client = new BitChatClient(profile, Program.TRUSTED_CERTIFICATES, cryptoOptions);

            _client.InvalidCertificateDetected += Client_InvalidCertificateDetected;
            _client.BitChatInvitationReceived  += Client_BitChatInvitationReceived;

            _client.Start();
        }