Exemplo n.º 1
0
        private void FillSaveListBox()
        {
            if (Globals.SavesHex.Length > 0)
            {
                DataTable  combDT = new DataTable();
                DataColumn dc     = new DataColumn("savePath", typeof(string));
                combDT.Columns.Add(dc);

                dc = new DataColumn("saveName", typeof(string));
                combDT.Columns.Add(dc);

                dc = new DataColumn("saveType", typeof(byte));
                combDT.Columns.Add(dc);

                dc = new DataColumn("saveDateTime", typeof(string));
                combDT.Columns.Add(dc);

                bool NotANumber = false;

                foreach (string profile in Globals.SavesHex)
                {
                    if (!File.Exists(profile + @"\game.sii") || !File.Exists(profile + @"\info.sii"))
                    {
                        continue;
                    }

                    string[] fold = profile.Split(new string[] { "\\" }, StringSplitOptions.None);

                    foreach (char c in fold[fold.Length - 1])
                    {
                        if (c < '0' || c > '9')
                        {
                            NotANumber = true;
                            break;
                        }
                    }

                    if (NotANumber)
                    {
                        string[] namearr     = fold[fold.Length - 1].Split(new char[] { '_' });
                        string   ProfileName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(namearr[0]);

                        for (int i = 1; i < namearr.Length; i++)
                        {
                            ProfileName += " " + namearr[i];
                        }

                        combDT.Rows.Add(profile, "- " + ProfileName + " -", 0, File.GetLastWriteTime(profile + @"\game.sii").ToString());
                    }
                    else
                    {
                        combDT.Rows.Add(profile, MainForm.GetCustomSaveFilename(profile, this, "statusStripCCpositions", "toolStripStatusMessages"), 1, File.GetLastWriteTime(profile + @"\game.sii").ToString());
                    }

                    NotANumber = false;
                }

                listBox1.DataSource = combDT;

                listBox1.ValueMember   = "savePath";
                listBox1.DisplayMember = "saveName";
            }

            toolStripStatusMessages.Text = "";
        }