Exemple #1
0
        private bool AddMonServer(IPAddress serverIP)
        {
            try
            {
                Uri           address = new Uri("net.tcp://" + serverIP + ":41993/IMonService/");
                NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);

                binding.MaxReceivedMessageSize = MAX_SIZE_WCF;
                binding.MaxBufferSize          = Convert.ToInt32(MAX_SIZE_WCF);
                binding.MaxBufferPoolSize      = MAX_SIZE_WCF;

                EndpointAddress monEndpoint             = new EndpointAddress(address);
                ChannelFactory <IMonService> monFactory = new ChannelFactory <IMonService>(binding, monEndpoint);
                IMonService monServer = monFactory.CreateChannel();
                if (monServer.TestConnection())
                {
                    MonServer server = new MonServer(monServer);
                    serverObjects.Add(server);
                    AddToListBoxClients(serverIP.ToString());
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Exemple #2
0
 public AuditForm(MonServer server)
 {
     InitializeComponent();
     foreach (var type in Enum.GetNames(typeof(EventLogEntryTypeFilter)))
     {
         EventTypeFilterComboBox.Items.Add(type);
     }
     FromFilterDatePicker.Value = DateTime.Now.Date;
     ToFilterDatePicker.Value   = DateTime.Now.Date.AddDays(1);
     _server = server;
 }
Exemple #3
0
 /// <summary>
 /// Добавить сервер
 /// </summary>
 private void AddServer(MonServer server)
 {
     serverObjects.Add(server);
     BeginInvoke(new Action(() =>
     {
         var item = new ListViewItem(string.Format("{0} ({1})", server.ServerName, server.IPaddr))
         {
             Tag = server
         };
         PCListView.Items.Add(item);
     }));
 }
Exemple #4
0
        private void TryConnect(string hostName, CancellationToken cancelToken)
        {
            IPAddress[] ips = null;
            try
            {
                ips = Dns.GetHostAddresses(hostName.Remove(0, 2));
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(hostName + ": " + ex.Message);
                goto finish;
            }
            foreach (var ip in ips.Where(a => a.AddressFamily == AddressFamily.InterNetwork))
            {
                var server = new MonServer(ip);
                try
                {
                    server.Initialize();
                    if (server.TestConnection())
                    {
                        Finded(this, new FindedEventArgs(server));
                    }
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine(ex.Message);
                }
                if (cancelToken.IsCancellationRequested)
                {
                    System.Diagnostics.Debug.WriteLine(string.Format("Операция для {0} отменена", hostName));
                    goto finish;
                }
            }
finish:
            ++NetworkProgress;
        }
Exemple #5
0
 public FindedEventArgs(MonServer monServer)
 {
     _monServer = monServer;
 }
Exemple #6
0
 public AuditForm(MonServer _server)
 {
     InitializeComponent();
     server = _server;
 }
Exemple #7
0
 public AuditLog(MonServer _server)
 {
     server = _server;
 }