public static void SendLogsToServer() { // check for logs that didnt make it (either new or failed last time) string logPath = Path.Combine(GetAppFolder(), LogFolder); // should do them in the right order var logs = Directory.EnumerateFiles(logPath); List <string> failures = new List <string>(); FuHttp h = new FuHttp(); if (!h.Login(Cfg.getEncrypted("HttpUsername"), Cfg.getEncrypted("HttpPassword"))) { //MessageBox.Show("There was a problem with your Fu Website credentials"); return; } foreach (string log in logs) { string fname = log; string logFile = Path.GetFileName(log); if (logFile.StartsWith("COMPLETE_") || logFile.StartsWith("INCOMPLETE_")) { // already finished, skip } else { try { string response = h.UploadLog(fname); if (response.ToLower() == "success") { string newFilePath = Path.Combine(Path.GetDirectoryName(fname), String.Format("COMPLETE_{0}", Path.GetFileName(fname))); System.IO.File.Move(fname, newFilePath); } else { string newFilePath = Path.Combine(Path.GetDirectoryName(fname), String.Format("INCOMPLETE_{0}", Path.GetFileName(fname))); System.IO.File.Move(fname, newFilePath); failures.Add(response); } } catch (Exception e) { string newFilePath = Path.Combine(Path.GetDirectoryName(fname), String.Format("INCOMPLETE_{0}", Path.GetFileName(fname))); System.IO.File.Move(fname, newFilePath); failures.Add(e.Message); } } } if (failures.Count > 0) { MessageBox.Show("Transmission error(s)!" + Environment.NewLine + String.Join(Environment.NewLine, failures.ToArray())); } }
private void LoadConfig() { cmbToons.Items.Clear(); cmbToons.Items.AddRange(FuEQ.GetToons().ToArray()); if (cmbToons.Items.Count > 0) { cmbToons.Enabled = true; if (m_currentToon.Length > 0 && m_currentServer.Length > 0) { int i = cmbToons.Items.IndexOf(String.Format("{0} - {1}", m_currentServer, m_currentToon)); if (i > -1) { cmbToons.SelectedIndex = i; } } else if (cmbToons.Items.Count > 0) { cmbToons.SelectedIndex = 0; } string[] toonBits = cmbToons.Items[cmbToons.SelectedIndex].ToString().Split(new string[] { " - " }, StringSplitOptions.None); if (toonBits.Length == 2) { m_currentToon = toonBits[1]; m_currentServer = toonBits[0]; EnableRestOfUI(); } } else { cmbToons.Enabled = false; // force them to add a toon DisableRestOfUI(); } txtEqFolder.Text = FuEQ.GetEQFolderForToon(m_currentToon, m_currentServer); // txtEqFolder.Text = Cfg.get("EqFolder"); txtLootMinutes.Text = Cfg.get("LootMinutes"); txtLootLookupMinutes.Text = Cfg.get("LootLookupMinutes"); txtEqCharacter.Text = ""; txtEqServer.Text = "bristle"; txtFuUsername.Text = Cfg.getEncrypted("HttpUsername"); txtFuPassword.Text = Cfg.getEncrypted("HttpPassword"); }