Exemplo n.º 1
0
        private async void connectButton_Click(object sender, EventArgs e)
        {
            connectButton.Enabled = false;
            string input = ipInput.Text;

            if (input.IsIPv4Format() && IPAddress.TryParse(input, out IPAddress ip))
            {
                LSClient client = new LSClient();
                resultLabel.Text = "Connecting...";
                if (await client.TryConnectAsync(ip, 1337))
                {
                    ConnectionMade?.Invoke(client);
                    resultLabel.Text = "";
                }
                else
                {
                    resultLabel.Text = "Connection failed";
                }
            }
            else
            {
                resultLabel.Text = "Invalid IP entered";
            }
            connectButton.Enabled = true;
        }
Exemplo n.º 2
0
 public FileOperationUpdateReceiver(
     FileOperationType operationType, LSClient client)
 {
     OperationType = operationType;
     Client        = client;
     Decoder       = new MessageDecoder();
 }
Exemplo n.º 3
0
 public ConnectedClientForm(LSClient client, ServerInfoMessage serverInfo)
 {
     InitializeComponent();
     this.client = client;
     categorySelector.Categories = serverInfo.FileCategories;
     requestManager = new RequestManager(client);
 }
Exemplo n.º 4
0
 public TransferOperationUpdateReceiver(
     LSClient client, string folderPath, bool zipLocal)
     : base(FileOperationType.Transfer, client)
 {
     this.folderPath       = folderPath;
     this.zipLocal         = zipLocal;
     autoEvent             = new AutoResetEvent(false);
     operationMessageQueue = new ConcurrentQueue <TransferOperationMessage>();
 }
Exemplo n.º 5
0
        private async void connectButton_Click(object sender, EventArgs e)
        {
            connectButton.Enabled = false;
            LSClient client = new LSClient();

            if (await client.TryConnectAsync(IPAddress.Parse(selectedConnection.ConnectionIP), 1337))
            {
                Console.WriteLine("Waiting for server info...");
                ServerInfoMessage serverInfo = await new RequestManager(client).RetrieveServerInfo();
                //Console.WriteLine("Received server info: " +
                //  JsonConvert.SerializeObject(serverInfo, Formatting.Indented));
                new ConnectedClientForm(client, serverInfo).ShowDialog(this);
                client.Close();
            }
            connectButton.Enabled = true;
        }
Exemplo n.º 6
0
 public RequestManager(LSClient client)
 {
     this.client = client;
     decoder     = new MessageDecoder();
 }
Exemplo n.º 7
0
 public ZipOperationUpdateReceiver(LSClient client)
     : base(FileOperationType.Zip, client)
 {
 }