public CreateNewGroup(ref List<Group> groups, Database db, ServerMain s) { InitializeComponent(); this.groups = groups; this.db = db; this.p = s; }
public DatabaseSettings(Database db) { InitializeComponent(); this.db = db; try { if (this.db.GetUser() == "" || this.db.GetUser() == null) { this.txtDBUserName.Text = "NOT SET"; this.txtDBPassword.Text = "NOT SET"; this.txtDBHost.Text = "NOT SET"; } else { this.txtDBUserName.Text = this.db.GetUser(); this.txtDBPassword.Text = this.db.GetPass(); this.txtDBHost.Text = this.db.GetHost(); } } catch (System.Exception ex) { this.txtDBUserName.Text = "NOT SET"; this.txtDBPassword.Text = "NOT SET"; this.txtDBHost.Text = "NOT SET"; } }
public ChooseGroup(ref List<Group> groups, object client, ServerMain ad, Database db) { InitializeComponent(); this.db = db; this.groups = groups; this.client = (ClientThread)client; this.ad = ad; }
public ServerMain() { InitializeComponent(); db = new Database(); groups = new List<Group>(); groups = db.GetGroups(); offlineClients = new List<KnownClient>(); ProcessDataTable = new DataTable("Processes"); ProcessDataTable.Columns.Add("Process ID", typeof(int)); ProcessDataTable.Columns.Add("Process Name", typeof(string)); ProcessDataTable.Columns.Add("CPU %", typeof(int)); ProcessDataTable.Columns.Add("Memory KB", typeof(int)); ProcessDataTable.Columns.Add("Thread Count", typeof(int)); ServiceDataTable = new DataTable("Services"); ServiceDataTable.Columns.Add("Service Name", typeof(string)); ServiceDataTable.Columns.Add("Service Type", typeof(string)); ServiceDataTable.Columns.Add("Display Name", typeof(string)); ServiceDataTable.Columns.Add("Current Status", typeof(string)); ServiceDataTable.Columns.Add("Startup Type", typeof(string)); TaskDataTable = new DataTable("Tasks"); TaskDataTable.Columns.Add("Task Name", typeof(string)); TaskDataTable.Columns.Add("Task Description", typeof(string)); TaskTriggerDataTable = new DataTable("TasksTriggers"); TaskTriggerDataTable.Columns.Add("Trigger", typeof(string)); TaskTriggerDataTable.Columns.Add("Trigger Details", typeof(string)); TaskTriggerDataTable.Columns.Add("Trigger Status", typeof(string)); TaskActionDataTable = new DataTable("TasksActions"); TaskActionDataTable.Columns.Add("Action", typeof(string)); TaskActionDataTable.Columns.Add("File To Run", typeof(string)); foreach (DataGridViewColumn column in dataGridTask.Columns) { column.SortMode = DataGridViewColumnSortMode.NotSortable; } foreach (DataGridViewColumn column in dataGridTaskTrigger.Columns) { column.SortMode = DataGridViewColumnSortMode.NotSortable; } foreach (DataGridViewColumn column in dataGridTaskAction.Columns) { column.SortMode = DataGridViewColumnSortMode.NotSortable; } }
/// <summary> /// Form Constructor /// </summary> /// <param name="ProcList">Current Known Processes, Built from parent form data grid</param> /// <param name="client">Client for commands to be sent too</param> /// <param name="parent">parent form</param> public NewProcess(ClientThread client, ServerMain parent, Database db) { s = parent; List<string> ProcList = db.GetProcesses(client.GetCompID()); ProcList.Sort(); InitializeComponent(); this.client = client; string clientName = client.GetComputerName().Split('\0')[0]; lstBoxProcesses.Items.Clear(); toolLblConnectedClient.Text += clientName; foreach(string procname in ProcList) { lstBoxProcesses.Items.Add(procname + ".exe"); } }
private void SaveDatabase(Database db) { Stream fs = File.Create("db.bin"); BinaryFormatter serializer = new BinaryFormatter(); serializer.Serialize(fs, db); fs.Close(); }
public void RunLocalServer() { mainDatabase = new Database(); mainDatabase.ConnectToDatabase(); unloggedClients = new List<Client>(); Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socket.Bind(new IPEndPoint(IPAddress.Loopback, 8888)); socket.Listen(10); mainSocket = socket; Thread socketListening = new Thread(SocketListening); socketListening.Start(); Console.WriteLine("Database test"); List<string> users = mainDatabase.SelectUsers("Pepa", "1234"); for (int i = 0; i < users.Count; i++) { Console.WriteLine(users[i]); } }