示例#1
0
            public static void LoadClientInfo()
            {
                //Find the newest XML file in APPDATA (the XML files share the same name as their XML files -> multiple .xml files possible!)
                string[] configfiles = new string[] { };
                try
                {
                    configfiles = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Guild Wars 2\", "*.exe.xml");
                }
                catch (Exception e)
                {
                    //TODO: Handle corrupt/missing Guild Wars install
                    MessageBox.Show("Guild Wars may not be installed. \n " + e.Message);
                    return;
                }
                Globals.ClientXmlpath = "";
                long max = 0;

                foreach (string config in configfiles)
                {
                    if (System.IO.File.GetLastWriteTime(config).Ticks > max)
                    {
                        max = System.IO.File.GetLastWriteTime(config).Ticks;
                        Globals.ClientXmlpath = config;
                    }
                }

                //Read the GFX Settings
                Globals.SelectedGFX = GFXManager.ReadFile(Globals.ClientXmlpath);
                //lv_gfx.ItemsSource = Globals.SelectedGFX.Config;
                //lv_gfx.Items.Refresh();

                // Read the XML file
                try
                {
                    //if (Properties.Settings.Default.use_reshade) cb_reshade.IsChecked = true;

                    StreamReader  stream = new System.IO.StreamReader(Globals.ClientXmlpath);
                    XmlTextReader reader = null;
                    reader = new XmlTextReader(stream);

                    while (reader.Read())
                    {
                        switch (reader.Name)
                        {
                        case "VERSIONNAME":
                            Regex filter = new Regex(@"\d*\d");
                            Version = filter.Match(reader.GetValue()).Value;
                            //lab_version.Content = "Client Version: " + ClientManager.ClientInfo.Version;
                            break;

                        case "INSTALLPATH":
                            InstallPath = reader.GetValue();
                            //lab_path.Content = "Install Path: " + ClientManager.ClientInfo.InstallPath;
                            break;

                        case "EXECUTABLE":
                            Executable = reader.GetValue();
                            //lab_path.Content += ClientManager.ClientInfo.Executable;
                            break;

                        case "EXECCMD":
                            //Filter arguments from path
                            //lab_para.Content = "Latest Start Parameters: ";
                            Regex           regex     = new Regex(@"(?<=^|\s)-(umbra.(\w)*|\w*)");
                            string          input     = reader.GetValue();
                            MatchCollection matchList = regex.Matches(input);

                            foreach (Argument argument in ArgumentManager.ArgumentCollection)
                            {
                                foreach (Match parameter in matchList)
                                {
                                    if (argument.Flag == parameter.Value && !argument.Blocker)
                                    {
                                        AccountArgumentManager.StopGap.IsSelected(parameter.Value, true);
                                    }
                                }
                            }

                            //RefreshUI();
                            break;
                        }
                    }
                }
                catch
                {
                    MessageBox.Show("Gw2 info file not found! Please choose the directory manually!");
                }
            }
示例#2
0
        public static void LoadGwClientInfo()
        {
            //Find the newest XML file in APPDATA (the XML files share the same name as their XML files -> multiple .xml files possible!)
            string[] configfiles = new string[] { };
            try
            {
                configfiles = Directory.GetFiles(GwAppdataPath, "*.exe.xml");
            }
            catch (Exception e)
            {
                MessageBox.Show("Guild Wars 2 may not be installed. \n " + e.Message);
                return;
            }
            GwClientXmlPath = "";
            long max = 0;

            foreach (string config in configfiles)
            {
                if (System.IO.File.GetLastWriteTime(config).Ticks > max)
                {
                    max             = System.IO.File.GetLastWriteTime(config).Ticks;
                    GwClientXmlPath = config;
                }
            }

            // Read the XML file
            try
            {
                StreamReader  stream = new System.IO.StreamReader(GwClientXmlPath);
                XmlTextReader reader = null;
                reader = new XmlTextReader(stream);
                while (reader.Read())
                {
                    switch (reader.Name)
                    {
                    case "VERSIONNAME":
                        Regex filter = new Regex(@"\d*\d");
                        GwClientVersion = filter.Match(reader.GetValue()).Value;
                        break;

                    case "INSTALLPATH":
                        GwClientPath = reader.GetValue();
                        break;

                    case "EXECUTABLE":
                        GwClientExeName = reader.GetValue();
                        break;

                    case "EXECCMD":
                        //Argument import not needed, now Account bound

                        /*
                         * Regex regex = new Regex(@"(?<=^|\s)-(umbra.(\w)*|\w*)");
                         * string input = reader.GetValue();
                         * MatchCollection matchList = regex.Matches(input);
                         *
                         * foreach (Argument argument in ArgumentManager.ArgumentCollection)
                         *  foreach (Match parameter in matchList)
                         *      if (argument.Flag == parameter.Value && !argument.Blocker)
                         *          AccountArgumentManager.StopGap.IsSelected(parameter.Value, true);
                         */
                        //RefreshUI();
                        break;
                    }
                }
            }
            catch
            {
                MessageBox.Show("Guild Wars 2 info file not found! Please choose the directory manually!");
            }
        }
示例#3
0
        private void Login_click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(pw.Text.ToString()))
            {
                MessageBox.Show("Please Fill in Password");
            }
            else
            {
                if (usn_type.Text.ToString() == "HR" || usn_type.Text.ToString() == "Agent" || usn_type.Text.ToString() == "Manager")
                {
                    string   usertype         = usn_type.Text.ToString();
                    string   username         = usn_select.Text.ToString();
                    string[] stringSeparators = new string[] { " " };
                    string[] nametokens;

                    nametokens = username.Split(stringSeparators,
                                                StringSplitOptions.RemoveEmptyEntries);

                    string paswoord = pw.Text.ToString();

                    string query = "";

                    if (usertype.ToString() == "HR" || usertype.ToString() == "Manager")
                    {
                        query = "select user_ID from users where user_fname = \"" + nametokens[0] + "\" and user_lname = \"" + nametokens[1] +
                                "\" and user_pass = \"" + paswoord + "\"";
                    }
                    else if (usertype.ToString() == "Agent")
                    {
                        query = "select Agent_ID from Agent where Agent_fname = \"" + nametokens[0] + "\" and Agent_lname = \"" + nametokens[1] +
                                "\" and Agent_PW = \"" + paswoord + "\"";
                    }

                    connection.Open();
                    MySqlCommand     cmd  = new MySqlCommand(query, connection);
                    MySqlDataAdapter mcmd = new MySqlDataAdapter();
                    MySqlDataReader  reader;
                    mcmd.SelectCommand = cmd;
                    reader             = cmd.ExecuteReader();

                    if (reader.Read())
                    {
                        switch (usertype)
                        {
                        case "HR": this.Hide();
                            HR newHRform = new HR(nametokens[0], nametokens[1], (int)reader.GetValue(0));
                            newHRform.ShowDialog();
                            break;

                        case "Agent": this.Hide();
                            Agent newAgentform = new Agent(nametokens[0], nametokens[1], (int)reader.GetValue(0));
                            newAgentform.ShowDialog();
                            break;

                        case "Manager": this.Hide();
                            Manager newManagerform = new Manager(nametokens[0], nametokens[1], (int)reader.GetValue(0));
                            newManagerform.ShowDialog();
                            break;

                        default: MessageBox.Show("invalid usertype");
                            break;
                        }
                    }
                    else
                    {
                        MessageBox.Show("password incorrect");
                    }
                    connection.Close();
                }
                else
                {
                    MessageBox.Show("Invalid usertype");
                }
            }
        }