/// <summary> /// /// </summary> public void BrowseFile() { try { if (_connected) { #region System.Windows.Forms.OpenFileDialog ppmacScriptFile = new System.Windows.Forms.OpenFileDialog { Filter = "global includes (*.pmh)|*.pmh|libraries files (*.pmc)|*.pmc|script files (*.plc)|*.plc", FilterIndex = 2, RestoreDirectory = true }; if (ppmacScriptFile.ShowDialog() == System.Windows.Forms.DialogResult.OK) { FilePath = ppmacScriptFile.FileName; ErrorList = string.Empty; LogfilePath = string.Empty; } #endregion } else { ExpressionDark.DarkMessageBox.Show(_connectMessgeText, "Warning"); } } catch (Exception ex) { DiagnosticException.ExceptionHandler(ex.Message); } }
/// <summary> /// /// </summary> private void SetLanguageTranslations() { try { } catch (Exception ex) { DiagnosticException.ExceptionHandler(ex.Message); } }
/// <summary> /// /// </summary> public SingleFileControllerDownloader() { try { SetLanguageTranslations(); DeltaTauIPAddress = "192.168.0.200"; Connection = _connectText; //this.ErrorFilePathTextBox.Visibility = Visibility.Visible; //this.ErrorFilePathLabel.Visibility = Visibility.Visible; } catch (Exception ex) { DiagnosticException.ExceptionHandler(ex.Message); } }
/// <summary> /// /// </summary> public void Disconnect() { try { _connected = false; Connection = _connectText; ConnectState = _notConnectText; CPUType = string.Empty; Version = string.Empty; FilePath = string.Empty; ErrorList = string.Empty; LogfilePath = string.Empty; } catch (Exception ex) { DiagnosticException.ExceptionHandler(ex.Message); } }
/// <summary> /// /// </summary> /// <param name="strIP"></param> /// <returns></returns> private bool IsValidIp(string strIP) { // Split string by ".", check that array length is 3 char chrFullStop = '.'; string[] arrOctets = strIP.Split(chrFullStop); try { if (arrOctets.Length != 4) { return(false); } // Check each substring checking that the int value is less than 255 and that is char[] length is !> 2 Int16 MAXVALUE = 255; Int32 temp; // Parse returns Int32 foreach (String strOctet in arrOctets) { if (strOctet.Length > 3) { return(false); } if (strOctet.Length > 0) { temp = int.Parse(strOctet); if (temp > MAXVALUE) { return(false); } } else { return(false); } } } catch (Exception ex) { DiagnosticException.ExceptionHandler(ex.Message); } return(true); }
/// <summary> /// /// </summary> /// <param name="IP"></param> /// <returns></returns> private bool CheckPing(string IP) { Ping ping = new Ping(); PingReply pingreply; bool result = false; try { if (NetworkInterface.GetIsNetworkAvailable()) { if (IsValidIp(IP)) { #region pingreply = ping.Send(System.Net.IPAddress.Parse(IP), 15); if (pingreply.RoundtripTime >= 0 && pingreply.Status.ToString() == "Success") { result = true; } else { result = false; } #endregion } } } catch (Exception ex) { DiagnosticException.ExceptionHandler(ex.Message); } return(result); }