Example #1
0
        private bool IsFormValid()
        {
            if (!IsEQValid())
            {
                return(false);
            }

            // loot minutes
            if (String.IsNullOrEmpty(txtLootMinutes.Text))
            {
                MessageBox.Show("Invalid Loot Minutes");
                return(false);
            }

            // loot lookup minutes
            if (String.IsNullOrEmpty(txtLootLookupMinutes.Text))
            {
                MessageBox.Show("Invalid Loot Lookup Minutes");
                return(false);
            }

            // website username/pass
            FuHttp h = new FuHttp();

            if (!h.Login(txtFuUsername.Text, txtFuPassword.Text))
            {
                return(false);
            }

            return(true);
        }
Example #2
0
        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()));
            }
        }
Example #3
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            FuHttp h = new FuHttp();

            if (h.Login(txtFuUsername.Text, txtFuPassword.Text))
            {
                MessageBox.Show("Login Succeeded");
            }
            //else
            // {
            //    MessageBox.Show("Login Failed!");
            ///}
        }
Example #4
0
        static void Main(string[] args)
        {
            bool debug = false;

            if (IsInstalled() || debug)
            {
                if (!HasConfig() && !debug)
                {
                    // make an empty config file
                    BuildEmptyConfigFile();
                    command = "config";
                }
            }
            else
            {
                // install and create config file
                if (MessageBox.Show("About to install", "FuRaidTool", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    Install();
                }
                return; // probably wont get hit because install kills this process
            }

            appFolder = Path.GetDirectoryName(Application.ExecutablePath);

            float minutes = -1;

            if (command == "config" || args.Length == 0)
            {
                command = "config";
                //command = "loot";
            }
            else if (args.Length == 1)
            {
                command = args[0];
            }
            else
            {
                command = args[0].ToLower();
                toon    = args[1];

                if (args.Length > 2)
                {
                    server = args[2];
                }
                else
                {
                    server = "bristle";
                }
            }

            switch (command)
            {
            case "config":
                FuHttp     f  = new FuHttp();
                ConfigForm cf = new ConfigForm();
                cf.AppPath = Application.ExecutablePath;
                cf.ShowDialog();
                break;

            case "loot":
                if (minutes == -1)
                {
                    if (!float.TryParse(Cfg.get("LootMinutes"), out minutes))
                    {
                        minutes = 10;
                    }
                }
                if (UpdateLoot(toon, server, minutes))
                {
                    SendLogsToServer();
                    Process.Start("http://fuworldorder.net/admin/loot/loot_assignments.php");
                }
                break;

            case "lootlookup":
                if (minutes == -1)
                {
                    if (!float.TryParse(Cfg.get("LootLookupMinutes"), out minutes))
                    {
                        minutes = 3;
                    }
                }
                DoLootLookup(toon, server, minutes);
                break;

            case "attendance":
                if (UpdateRaidAttendance(toon, server))
                {
                    SendLogsToServer();
                    Process.Start("http://fuworldorder.net/admin/raid/attendance.php");
                }
                break;

            case "guildroster":
                if (UpdateGuildRoster(toon, server))
                {
                    SendLogsToServer();
                    Process.Start("http://fuworldorder.net/admin/raid/attendance.php");
                }
                break;

            case "sendlogs":
                SendLogsToServer();
                break;
            }
        }