예제 #1
0
        public IEnumerable <MarkerModel> GetAllMarkers()
        {
            var ret = new List <MarkerModel>();

            using (SQLiteCommand com = GamesRepository.DatabaseConnection.CreateCommand())
            {
                com.CommandText =
                    "SElECT id, name, icon, (SELECT id FROM sets WHERE real_id=markers.[set_real_id]) as set_id FROM [markers] WHERE [game_id]=@game_id;";

                com.Parameters.AddWithValue("@game_id", Id.ToString());
                using (SQLiteDataReader dr = com.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        var did   = dr["id"] as string;
                        var setID = dr["set_id"] as string;
                        if (setID == null || did == null)
                        {
                            return(ret);
                        }
                        var result = new MarkerModel(
                            Guid.Parse(did),
                            (string)dr["name"],
                            (string)dr["icon"],
                            GetSet(Guid.Parse(setID))
                            );
                        ret.Add(result);
                    }
                }
            }
            return(ret);
        }
예제 #2
0
 internal static MarkerModel FromDataRow(Game game, IVistaDBRow row)
 {
     var result = new MarkerModel
     {
         id = (Guid)row["id"].Value,
         name = (string)row["name"].Value,
         iconUri = (string)row["icon"].Value,
         set = game.GetSet((Guid)row["setId"].Value)
     };
     return result;
 }
예제 #3
0
파일: Game.cs 프로젝트: Zhevranacci/OCTGN
        public IEnumerable<MarkerModel> GetAllMarkers()
        {
            var ret = new List<MarkerModel>();
            using (SQLiteCommand com = GamesRepository.DatabaseConnection.CreateCommand())
            {
                com.CommandText =
                    "SElECT id, name, icon, (SELECT id FROM sets WHERE real_id=markers.[set_real_id]) as set_id FROM [markers] WHERE [game_id]=@game_id;";

                com.Parameters.AddWithValue("@game_id", Id.ToString());
                using (SQLiteDataReader dr = com.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        var did = dr["id"] as string;
                        var setID = dr["set_id"] as string;
                        if (setID == null || did == null) return ret;
                        var result = new MarkerModel(
                            Guid.Parse(did),
                            (string) dr["name"],
                            (string) dr["icon"],
                            GetSet(Guid.Parse(setID))
                            );
                        ret.Add(result);
                    }
                }
            }
            return ret;
        }
예제 #4
0
파일: Card.cs 프로젝트: bejumi/OCTGN
 internal void AddMarker(MarkerModel model)
 {
     AddMarker(model, 1);
 }
예제 #5
0
파일: Card.cs 프로젝트: bejumi/OCTGN
 internal void AddMarker(MarkerModel model, ushort count)
 {
     Marker marker = _markers.FirstOrDefault(m => m.Model.Equals(model));
     if (marker != null)
         marker.SetCount((ushort) (marker.Count + count));
     else if (count > 0)
         _markers.Add(new Marker(this, model, count));
 }
예제 #6
0
파일: Marker.cs 프로젝트: 0M3G4/OCTGN
 public Marker(Card card, MarkerModel model, ushort count)
     : this(card, model)
 {
     _count = count;
 }
예제 #7
0
파일: Marker.cs 프로젝트: 0M3G4/OCTGN
 public Marker(Card card, MarkerModel model)
 {
     _card = card;
     _model = model;
 }