// Copy and zip logs private void CreateLogs() { ClientFunctions.CreateClientServerLogFolder(); ClientFunctions.CopyLogs(ClientFunctions.ClientLogsPath, ClientFunctions.ClientLogsTempPath, true); ClientFunctions.CopyLogs(ClientFunctions.ClientConfPath, ClientFunctions.ClientConfTempPath, true); ClientFunctions.CopyLogs(ClientFunctions.ServerLogsPath, ClientFunctions.ServerLogsTempPath, true); ClientFunctions.ZipLogs(ClientFunctions.LogsTempPath, ClientFunctions.LogsTempPathZip); log.Info("Logs successfully created."); // Send logs to server this.Send(); log.Info("Send logs to the server."); // Wait until logs has been sent sendDone.WaitOne(); log.Info("Logs have been successfully sent to the server."); log.Info(""); // Delete the temporary logs folder ClientFunctions.DeleteLogFolderAfterSent(); this.WaitForSignal(); }
public static void Main() { //Console.WriteLine("1...Start Battle"); ClientFunctions conetction = new ClientFunctions(); conetction.SocketConnection(); return; }
public ClientWindow() { InitializeComponent(); // Starts method to read the client configuration from the xml file. // Create a xml configuration file if it doenst exist ClientFunctions.ClientStartPreparation(); client = new AsynchronousClient(); this.StartConnectingToServer(); }
protected override void OnShown(EventArgs e) { if (ClientFunctions.cookieInfo != "") { ClientFunctions.Send (ClientFunctions.Login( ClientFunctions.cookieInfo.Split('\n')[0], ClientFunctions.cookieInfo.Split('\n')[1])); } else { base.OnShown(e); } }
public MainWindow() { Size = new Size(1024, 768); var linksList = new CheckedListBox { Location = new Point(5, 10), Size = new Size(ClientSize.Width / 2 - 5, ClientSize.Height), SelectionMode = SelectionMode.None, }; linksList.ItemCheck += (sender, args) => { if (args.CurrentValue == CheckState.Unchecked || args.CurrentValue == CheckState.Indeterminate) { args.NewValue = CheckState.Checked; } else { args.NewValue = CheckState.Unchecked; } }; var downloadButton = new Button { Text = "Download", Location = new Point(linksList.Right + 5, 10), Size = new Size(100, 20), }; downloadButton.Click += (sender, args) => { ClientFunctions .Download(LinkList .Where(a => !linksList .CheckedItems .Contains(a)) .ToArray()); foreach (var i in LinkList .Where(a => ClientFunctions .IsDownloaded(a .Split('/') .Last()))) { linksList.SetItemChecked(linksList.Items.IndexOf(i), true); } }; var getButton = new Button { Text = "Get Links", Location = new Point (downloadButton.Location.X, downloadButton.Bottom + 5), Size = downloadButton.Size, }; getButton.Click += (sender, args) => { if (LinkList != null) { linksList.Items.Clear(); } ClientFunctions.Send(ClientFunctions.DownloadLinks(LoggedNickname)); linksList.Items.AddRange(LinkList.ToArray()); }; Controls.Add(linksList); Controls.Add(downloadButton); Controls.Add(getButton); Load += (sender, args) => { ClientWindows.CurrentWindow = new LoginWindow(); }; Shown += (sender, args) => { if (ClientWindows.CurrentWindow is LoginWindow) { Hide(); } else { ClientFunctions.Send(ClientFunctions.DownloadLinks(LoggedNickname)); } }; }
protected override void OnClosing(CancelEventArgs e) { ClientFunctions.LogOut(LoggedNickname); base.OnClosing(e); }
public RegistrationForm() { var controlList = new List <Control>(); controlList.Add(new Label { Text = "Nickname", Location = new Point(ClientSize.Width / 2, 0), Size = new Size(ClientSize.Width / 2, 30), }); controlList.Add(new TextBox { Location = new Point(ClientSize.Width / 2, controlList.Last().Bottom), Size = controlList.Last().Size, }); controlList.Add(new Label { Text = "E-mail", Location = new Point(ClientSize.Width / 2, controlList.Last().Bottom), Size = controlList.Last().Size, }); controlList.Add(new TextBox { Location = new Point(ClientSize.Width / 2, controlList.Last().Bottom), Size = controlList.Last().Size, }); controlList.Add(new Label { Text = "Password", Location = new Point(ClientSize.Width / 2, controlList.Last().Bottom), Size = controlList.Last().Size, }); controlList.Add(new TextBox { Location = new Point(ClientSize.Width / 2, controlList.Last().Bottom), Size = controlList.Last().Size, UseSystemPasswordChar = true, }); controlList.Add(new Button { Text = "Submit", Location = new Point(ClientSize.Width / 2, controlList.Last().Bottom), Size = controlList.Last().Size, }); ((Button)controlList.Last()).Click += (sender, args) => { ClientFunctions.Send(ClientFunctions.Register (controlList[1].Text, controlList[3].Text, controlList[5].Text )); }; foreach (var ctrl in controlList) { Controls.Add(ctrl); } }
public LoginWindow() { var controlList = new List <Control>(); controlList.Add(new Label { Location = new Point(0, 0), Size = new Size(ClientSize.Width / 2, 30), Text = "Nickname", }); controlList.Add(new TextBox { Location = new Point(0, controlList.Last().Bottom), Size = controlList.Last().Size, }); controlList.Add(new Label { Location = new Point(0, controlList.Last().Bottom), Size = new Size(ClientSize.Width / 2, 30), Text = "Password", }); controlList.Add(new TextBox { Location = new Point(0, controlList.Last().Bottom), Size = controlList.Last().Size, UseSystemPasswordChar = true, }); controlList.Add(new CheckBox { Location = new Point(controlList.Last().Right + 10, controlList[2].Bottom), Size = new Size(30, 30), Text = "Remember Me", AutoCheck = false, Name = "CookieCheckBox", }); ((CheckBox)controlList.Last()).Click += (sender, args) => { var check = (CheckBox)controlList[4]; if (check.Checked) { CookieEnabled = false; check.Checked = false; } else { CookieEnabled = true; check.Checked = true; } }; controlList.Add(new Button { Location = new Point(0, controlList[3].Bottom), Size = new Size(controlList[3].Size.Width / 2, controlList[3].Size.Height), Text = "Login", }); ((Button)controlList.Last()).Click += (sender, args) => { ClientFunctions .Send(ClientFunctions .Login(controlList[1].Text, controlList[3].Text)); }; controlList.Add(new Button { Location = new Point(controlList.Last().Right, controlList[3].Bottom), Size = new Size(controlList[3].Size.Width / 2, controlList[3].Size.Height), Text = "Register", }); ((Button)controlList.Last()).Click += (sender, args) => { ClientWindows.CurrentWindow = new RegistrationForm(); }; foreach (var ctrl in controlList) { Controls.Add(ctrl); } }