Пример #1
0
        public void DisplayDhcpNodesInfo()
        {
            var wiFiToString = IsWifi ? $"{SignalQuality.ToString().PadLeft(3)}%" : "";
            var toString     = $"{HostName.Trim().PadRight(20, ' ').Substring(0, 20)}, " +
                               $"{IpAddress.Trim().PadRight(15)}, {MacAddress}, {LeaseTime:c}  {wiFiToString}";

            Console.WriteLine(toString);
        }
Пример #2
0
 public ClientConfiguration BuildClientConfiguration()
 {
     return(new ClientConfiguration
     {
         ApiPort = Port,
         Servers = new List <Uri> {
             new Uri($"http://{HostName.Trim()}")
         }
     });
 }
Пример #3
0
        public void DisplayWiFiNodesInfo()
        {
            var toString = $"{HostName.Trim().PadRight(20, ' ').Substring(0, 20)}, " +
                           $"{IpAddress.Trim().PadRight(15)}, {MacAddress}," +
                           //$"{ Interface}, " +
                           $"{ UpTime.ToString("c").PadLeft(11)}, { TxRateMb.ToString().PadLeft(3)}, { RxRateMb.ToString().PadLeft(3)}, " +
                           //$"{ Info}, " +
                           $"{SignalLeveldB.ToString().PadLeft(3)}, {NoiseLeveldB.ToString().PadLeft(4)}, {SignalToNoiseRatiodB.ToString().PadLeft(4)}, {SignalQuality.ToString().PadLeft(3)}%";

            Console.WriteLine(toString);
        }
Пример #4
0
 private void HostNameChange(object sender, EventArgs e)
 {
     if (HostName == null || string.IsNullOrEmpty(HostName.Trim()))
     {
         AddHost = false;
         CheckBoxAddHostEntry.Enabled = false;
     }
     else
     {
         CheckBoxAddHostEntry.Enabled = true;
     }
 }
Пример #5
0
        public void DisplayGeneralInfo()
        {
            var wiFiToString = IsWifi ? $"{SignalQuality.ToString().PadLeft(3)}%" : "";
            var toString     = $"{HostName.Trim().PadRight(20, ' ').Substring(0, 20)}, " +
                               $"{IpAddress.Trim().PadRight(15)}, {MacAddress}, {ConnectionsCount.ToString().PadLeft(3)}, {wiFiToString}";
            var originalFontColor = Console.ForegroundColor;
            var fontColor         = IsActive ? ConsoleColor.White : ConsoleColor.DarkGray;

            Console.ForegroundColor = fontColor;
            Console.WriteLine(toString);
            Console.ForegroundColor = originalFontColor;
        }
Пример #6
0
 /// <summary>
 /// Trims all.
 /// </summary>
 public void TrimAll()
 {
     File        = File?.Trim() ?? string.Empty;
     Method      = Method?.Trim() ?? string.Empty;
     Class       = Class?.Trim() ?? string.Empty;
     Throwable   = Throwable.Trim();
     App         = App?.Trim() ?? string.Empty;
     HostName    = HostName?.Trim() ?? string.Empty;
     UserName    = UserName?.Trim() ?? string.Empty;
     MachineName = MachineName?.Trim() ?? string.Empty;
     Message     = Message.Trim();
     Thread      = Thread?.Trim() ?? string.Empty;
     Level       = Level?.Trim() ?? string.Empty;
     LogName     = LogName?.Trim() ?? string.Empty;
     Line        = Line.Trim();
     Identity    = Identity?.Trim() ?? string.Empty;
     Ndc         = Ndc?.Trim() ?? string.Empty;
     Logger      = Logger?.Trim() ?? string.Empty;
 }
Пример #7
0
 /// <summary>
 /// Trims all.
 /// </summary>
 public void TrimAll()
 {
     File        = File == null ? string.Empty : File.Trim();
     Method      = Method == null ? string.Empty : Method.Trim();
     Class       = Class == null ? string.Empty : Class.Trim();
     Throwable   = Throwable.Trim();
     App         = App == null ? string.Empty : App.Trim();
     HostName    = HostName == null ? string.Empty : HostName.Trim();
     UserName    = UserName == null ? string.Empty : UserName.Trim();
     MachineName = MachineName == null ? string.Empty : MachineName.Trim();
     Message     = Message.Trim();
     Thread      = Thread == null ? string.Empty : Thread.Trim();
     Level       = Level == null ? string.Empty : Level.Trim();
     LogName     = LogName == null ? string.Empty : LogName.Trim();
     Line        = Line.Trim();
     Identity    = Identity == null ? string.Empty : Identity.Trim();
     NDC         = NDC == null ? string.Empty : NDC.Trim();
     Logger      = Logger == null ? string.Empty : Logger.Trim();
 }
Пример #8
0
        public ClientConfiguration BuildClientConfiguration()
        {
            var config = new ClientConfiguration
            {
                ApiPort = Port,
                Servers = new List <Uri> {
                    new Uri($"http://{HostName.Trim()}")
                }
            };

            config.BucketConfigs.Clear();

            foreach (var bucket in Buckets)
            {
                var parts = bucket.Split(':');
                config.BucketConfigs.Add(parts[0], new BucketConfiguration {
                    BucketName = parts[0]
                });
            }

            return(config);
        }
Пример #9
0
        public MainWindow()
        {
            InitializeComponent();
            _cancellationTokenSource = new CancellationTokenSource();
            Hosts              = new ObservableCollection <Host>();
            ConnectCommand     = new RelayCommand(Connect, () => !string.IsNullOrEmpty(Address));
            RefreshCommand     = new RelayCommand(async() => await RefreshAsync());
            CreateHostCommand  = new RelayCommand(CreateHost, () => !string.IsNullOrEmpty(HostName?.Trim()));
            SendMessageCommand = new RelayCommand(SendMessage, () => !string.IsNullOrEmpty(Message?.Trim()));
            DeleteHostCommand  = new RelayCommand(DeleteHost);
            DataContext        = this;

            _client = new PixelsClient();
            _client.ConnectionSucceeded += Client_ConnectionSucceeded;
            _client.ConnectionFailed    += Client_ConnectionFailed;
            _client.Initialize          += Client_Initialize;
            _client.ElementChanged      += Client_ElementChanged;
            _client.ConnectionRefused   += Client_ConnectionRefused;
            _client.Disconnected        += Client_Disconnected;
            _client.ConnectionClosed    += Client_ConnectionClosed;
        }
Пример #10
0
 private string GetDistinctString(bool ShowPathInfo)
 {
     return(String.Format(@"{0} at {1}", HostName.Trim(), LastMsgId));
 }
Пример #11
0
 public string BuildRestUrl(string bucketName, int skip)
 {
     return(string.Format(BaseUrl, HostName.Trim(), Port, bucketName, ViewName.Trim(), BatchSize, skip));
 }
Пример #12
0
 public override string ToString()
 {
     return($"{HostName.Trim().PadRight(20,' ').Substring(0,20)}, " +
            $"{IpAddress.Trim().PadRight(15)}, {MacAddress}");
 }
Пример #13
0
 private void CheckInput()
 {
     InputComplete = !string.IsNullOrEmpty(HostName.Trim()) && PortNumber != 0;
 }