private void ConnectToServer() { ClientInfoModel InfoModel = new ClientInfoModel(); InfoModel.arc = GetArchitecture(); InfoModel.macAddress = GetMacAddress(); InfoModel.admin = GetAdminBool(); sendRequest Request = new sendRequest(Properties.Settings.Default.ServerIP); if (Request.sendUpdateRequest(InfoModel, Properties.Settings.Default.SavePath)) { foreach (string file in System.IO.Directory.GetFiles(Properties.Settings.Default.SavePath)) { UnpackZip(file); } InstallProgramms(); } }
public frmSoftwareverteilung() { InitializeComponent(); TreeView1.Nodes[0].Expand(); if (!Directory.Exists(Server_Client.Properties.Settings.Default.SavePath + "\\Softwareverteilung")) { Directory.CreateDirectory(Server_Client.Properties.Settings.Default.SavePath + "\\Softwareverteilung"); } if (Server_Client.Properties.Settings.Default.ServerIP == "0") { MessageBox.Show("Bitte geben Sie die IP des Servers an."); frmSettings settings = new frmSettings(); settings.ShowDialog(); if (Server_Client.Properties.Settings.Default.ServerIP == "0") { MessageBox.Show("Sie haben keine IP für den Servers angegeben. Das Programm wird beendet."); this.Close(); } } string HostName = Dns.GetHostName(); IPAddress[] ownIpAddress = Dns.GetHostAddresses(HostName); string strIpAdresse = ""; for (int i = 0; i < ownIpAddress.Length; i++) { IPAddress ip = ownIpAddress[i]; string currentAddress = ip.ToString(); if (ip != null && currentAddress.Length >= 7 && currentAddress.Length <= 15) { strIpAdresse = ownIpAddress[i].ToString(); break; } } client.arc = GetArchitecture(); client.macAddress = GetMacAddress(strIpAdresse); client.admin = GetAdminBool(); List<GroupInfoModel> groupList = null; try { string ipAddress = Server_Client.Properties.Settings.Default.ServerIP; request = new sendRequest(ipAddress); groupList = request.getDatabaseGroups(client); if (groupList == null) { MessageBox.Show("Probleme beim Herstellen einer Verbindung. Bitte überprüfen Sie Ihre Einstellungen."); frmSettings settings = new frmSettings(); settings.ShowDialog(); try { groupList = request.getDatabaseGroups(client); } catch (Exception) { MessageBox.Show("Verbindung kann nicht hergestellt werden. Anwendung wird beendet."); this.Close(); } return; } } catch (Exception ex) { MessageBox.Show("Probleme beim Herstellen einer Verbindung. Bitte überprüfen Sie Ihre Einstellungen." + ex.Message); frmSettings settings = new frmSettings(); settings.ShowDialog(); try { groupList = request.getDatabaseGroups(client); } catch (Exception) { MessageBox.Show("Verbindung kann nicht hergestellt werden. Anwendung wird beendet."); this.Close(); } return; } foreach (GroupInfoModel Group in groupList) { TreeNode CurrentGroup = new TreeNode(Group.Name); CurrentGroup.Tag = Group.ID; TreeView1.Nodes[0].Nodes.Add(CurrentGroup); } }