Пример #1
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            TrophyNode t = (TrophyNode)listBox1.SelectedItem;

            this.labelName.Text = t.Name;

            switch (t.TType)
            {
            case "B":
                this.labelTType.Text = "Bronze";
                break;

            case "S":
                this.labelTType.Text = "Silver";
                break;

            case "G":
                this.labelTType.Text = "Gold";
                break;

            case "P":
                this.labelTType.Text = "Platinum";
                break;

            default:
                this.labelTType.Text = t.TType;
                break;
            }

            this.labelDescription.Text = t.Detail;

            if (t.Hidden)
            {
                this.labelHidden.Text = "Hidden";
            }
            else
            {
                this.labelHidden.Text = "Visible";
            }

            this.labelTrophyID.Text = t.ID;

            TropUsrSingleTrophy u = TrophyFile.TropUsrFile.TrophyInfos[UInt32.Parse(t.ID)];

            if (u.Unlocked == 1)
            {
                this.labelUnlocked.Text   = "Acquired";
                this.labelTimestamp.Text  = Util.PS3TimeToDateTime(u.Timestamp1).ToString();
                this.labelTimestamp2.Text = Util.PS3TimeToDateTime(u.Timestamp2).ToString();
            }
            else
            {
                this.labelUnlocked.Text   = "Locked";
                this.labelTimestamp.Text  = "";
                this.labelTimestamp2.Text = "";
            }
        }
Пример #2
0
        public static List <TrophyNode> GetSQL(String ConnectionString, String GracesJapaneseConnectionString)
        {
            //List<ScenarioFile> Trophies = new List<TrophyNode>();
            Dictionary <string, TrophyNode> Trophies = new Dictionary <string, TrophyNode>();

            SQLiteConnection Connection = new SQLiteConnection(ConnectionString);

            Connection.Open();

            using (SQLiteTransaction Transaction = Connection.BeginTransaction())
                using (SQLiteCommand Command = new SQLiteCommand(Connection)) {
                    Command.CommandText =
                        "SELECT english, PointerRef, StringID, t_id, t_hidden, t_ttype, t_pid FROM Text ORDER BY ID";
                    SQLiteDataReader r = Command.ExecuteReader();
                    while (r.Read())
                    {
                        String SQLText;
                        String T_ID;
                        bool   T_Hidden;
                        String T_TType;
                        String T_PID;

                        try {
                            SQLText  = r.GetString(0).Replace("''", "'");
                            T_ID     = r.GetString(3);
                            T_Hidden = r.GetInt32(4) == 1;
                            T_TType  = r.GetString(5);
                            T_PID    = r.GetString(6);
                        } catch (System.InvalidCastException) {
                            SQLText  = null;
                            T_ID     = null;
                            T_Hidden = false;
                            T_TType  = null;
                            T_PID    = null;
                        }

                        int PointerRef = r.GetInt32(1);
                        int StringID   = r.GetInt32(2);

                        if (Trophies.ContainsKey(T_ID))
                        {
                            if (PointerRef == 0)
                            {
                                Trophies[T_ID].Name = SQLText;
                            }
                            else if (PointerRef == 1)
                            {
                                Trophies[T_ID].Detail = SQLText;
                            }
                        }
                        else
                        {
                            String Name   = null;
                            String Detail = null;
                            if (PointerRef == 0)
                            {
                                Name = SQLText;
                            }
                            else if (PointerRef == 1)
                            {
                                Detail = SQLText;
                            }
                            TrophyNode Trophy = new TrophyNode(T_ID, T_Hidden, T_TType, T_PID, Name, Detail, null);
                            Trophies[T_ID] = Trophy;
                        }
                    }

                    Transaction.Rollback();
                }

            Connection.Close();

            return(Trophies.Values.ToList());
        }
Пример #3
0
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            // Make sure we're not trying to draw something that isn't there.
            if (e.Index >= this.Items.Count || e.Index <= -1)
            {
                return;
            }

            // Get the item object.
            object item = this.Items[e.Index];

            if (item == null)
            {
                return;
            }


            // Draw the item.
            if (IsGameList)
            {
                if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
                {
                    e.Graphics.FillRectangle(new SolidBrush(Color.LightBlue), e.Bounds);
                }
                else
                {
                    e.Graphics.FillRectangle(new SolidBrush(Color.White), e.Bounds);
                }

                TrophyConfNode tc = (TrophyConfNode)item;
                e.Graphics.DrawImage(tc.GameThumbnail, 0, e.Bounds.Y, 160, 88);

                string text       = tc.TitleName;
                SizeF  stringSize = e.Graphics.MeasureString(text, this.Font);
                e.Graphics.DrawString(text, this.Font, new SolidBrush(Color.Black),
                                      new PointF(163, e.Bounds.Y + (e.Bounds.Height - stringSize.Height) / 2));
            }
            else
            {
                TrophyNode t = (TrophyNode)item;

                if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
                {
                    e.Graphics.FillRectangle(new SolidBrush(Color.LightBlue), e.Bounds);
                }
                else
                {
                    if (CurrentGame.TropUsrFile.TrophyInfos[UInt32.Parse(t.ID)].Unlocked == 1)
                    {
                        e.Graphics.FillRectangle(new SolidBrush(Color.LightGreen), e.Bounds);
                    }
                    else
                    {
                        e.Graphics.FillRectangle(new SolidBrush(Color.White), e.Bounds);
                    }
                }

                e.Graphics.DrawImage(t.TrophyThumbnail, 0, e.Bounds.Y, 60, 60);

                string text       = item.ToString();
                SizeF  stringSize = e.Graphics.MeasureString(text, this.Font);
                e.Graphics.DrawString(text, this.Font, new SolidBrush(Color.Black),
                                      new PointF(63, e.Bounds.Y + (e.Bounds.Height - stringSize.Height) / 2));
            }
        }