コード例 #1
0
        private void LoggingIn(object sender, EventArgs args)
        {
            if (((LoginAck)args).message)
            {
                if (chatWindow.InvokeRequired)
                {
                    chatWindow.Invoke(new Action <object, EventArgs>(LoggingIn), new object[] { sender, args });
                    return;
                }
                username = ClientDriver.globalUsername;
                chatWindow.SetUserName(username);

                string key         = ((LoginAck)args).key;
                int    NumberChars = key.Length;
                personalKey = new byte[NumberChars / 2];
                for (int i = 0; i < NumberChars; i += 2)
                {
                    personalKey[i / 2] = System.Convert.ToByte(key.Substring(i, 2), 16);
                }
                logCrypto.SetNewKey(personalKey);
                fileManager.cyptoMessage.SetNewKey(personalKey);

                Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + @"\" + username);


                popup        = new PopupNotifier();
                popup.Image  = new Bitmap(Properties.Resources.logo, new Size(100, 100));
                popup.Click += new EventHandler(OnPopupClick);
                new Thread(() => chatWindow.ShowDialog()).Start();
            }
        }
コード例 #2
0
ファイル: P2PListener.cs プロジェクト: fiskmoz/Manchattan
 public P2PListener(NetworkStream netStream, string username, byte[] key)
 {
     this.username  = username;
     this.netStream = netStream;
     cc             = new ClientCrypto();
     cc.SetNewKey(key);
     stopListen = false;
 }
コード例 #3
0
ファイル: P2PWriter.cs プロジェクト: fiskmoz/Manchattan
 public P2PWriter(NetworkStream netStream, byte[] key)
 {
     this.netStream = netStream;
     cc             = new ClientCrypto();
     cc.SetNewKey(key);
 }