Beispiel #1
0
        /// <summary>
        /// Build file list function that is used to
        /// grab all current files from the database and store them for use later
        /// </summary>
        private void buildFileList()
        {
            string[] fileColumns = { "id", "game_id", "title", "description", "filename" };                                         //what Columns I am wanting from the table
            string[] fileInfo    =
                SQLUltility.SelectSQL("files", cs, fileColumns).Split('_');                                                         //getting the requested columns from the table

            foreach (string info in fileInfo)                                                                                       //for every item returned by selectsql
            {
                if (info.Length > 0)                                                                                                //as long as it is not blank
                {
                    String[]    splitInfo  = info.Split('|');                                                                       //split the data from the SQL database up for easy parsing
                    FileElement newElement = new FileElement(splitInfo[1], splitInfo[2], splitInfo[3], splitInfo[4], splitInfo[5]); //make a new element with requested info
                    fileList.Add(newElement);                                                                                       //add it to filelist for later use
                }
            }

            //This section makes sure the dropdown list for the files is in line with the selected game on update
            if (GameDropDown.SelectedIndex != -1)                   //as long the drop down is not null
            {
                string text = GameDropDown.SelectedItem.ToString(); //grab the selected item into text
                string ID   = Regex.Match(text, @"\d+").Value;      //Grab the ID out of the string

                ClipDropDown.Items.Clear();                         //clear the file dropdown list

                foreach (FileElement info in fileList)              //check all the files
                {
                    if (info.GameID.Equals(ID))                     //if they match the current ID
                    {
                        ClipDropDown.Items.Add(info.Title);         //add it to the drop down list
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Build game list function that is used to
        /// grab all current games from the database and store them for use later
        /// </summary>
        private void buildGameList()
        {
            string[] gameColumns = { "id", "title" };                                     //what Columns I am wanting from the table
            string[] gameInfo    =
                SQLUltility.SelectSQL("games", cs, gameColumns).Split('_');               //parsing the data from the SQL data base into a string array

            foreach (string info in gameInfo)                                             //for every item returned by selectsql
            {
                if (info.Length > 0)                                                      //as long as it is not blank
                {
                    String[]    splitInfo  = info.Split('|');                             //Split the data up between the ID and Name
                    GameElement newElement = new GameElement(splitInfo[1], splitInfo[2]); //make a new element with the ID and name
                    gameList.Add(newElement);                                             //add it to the game list
                }
            }

            foreach (GameElement info in gameList)                           //for every game loaded from the database
            {
                GameDropDown.Items.Add("ID: " + info.ID + " " + info.Title); //add it to the dropdown list
            }
        }