Exemplo n.º 1
0
        internal static CardModel FromDataRow(Game game, DataRow row)
        {
            DataColumnCollection columns = row.Table.Columns;
            Guid alternateGuid;

            if (!Guid.TryParse(row["alternate"].ToString(), out alternateGuid))
            {
                alternateGuid = Guid.Empty;
            }                                  //If the guid fails, set to 0;
            var result = new CardModel
            {
                Id         = Guid.Parse(row["id"].ToString()),
                Name       = (string)row["name"],
                ImageUri   = (string)row["image"],
                Set        = game.GetSet(Guid.Parse(row["set_id"].ToString())),
                Alternate  = alternateGuid,
                Dependent  = (string)row["dependent"],
                Properties =
                    new SortedList <string, object>(columns.Count - 4,
                                                    StringComparer.InvariantCultureIgnoreCase)
            };

            for (int i = 4; i < columns.Count; ++i)
            {
                result.Properties.Add(columns[i].ColumnName.Replace(game.Id.ToString().Replace("-", ""), ""), row.IsNull(i) ? null : row[i]);
            }
            return(result);
        }
Exemplo n.º 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;
 }
Exemplo n.º 3
0
 public static Uri GetPictureUri(Game game, Guid setId, string imageUri)
 {
     return(new Uri(game.GetSet(setId).GetPackUri() + imageUri));
 }