Пример #1
0
 public static CollectionViewModel CopyFrom(Collection collection)
 => new CollectionViewModel
 {
     Id          = collection.Id,
     Name        = collection.Name,
     Index       = collection.Index,
     ImagePath   = collection.ImagePath,
     Description = collection.Description,
     CreateTime  = collection.CreateTime,
     Locked      = collection.Locked
 };
Пример #2
0
        public static async Task AddToCollectionAsync(Collection col, BeatmapEntry entry)
        {
            if (string.IsNullOrEmpty(col.ImagePath))
            {
                var osuFile =
                    await OsuFile.ReadFromFileAsync(Path.Combine(Domain.OsuSongPath, entry.FolderName,
                                                                 entry.BeatmapFileName));

                if (osuFile.Events.BackgroundInfo != null)
                {
                    var imgPath = Path.Combine(Domain.OsuSongPath, entry.FolderName, osuFile.Events.BackgroundInfo.Filename);
                    if (File.Exists(imgPath))
                    {
                        col.ImagePath = imgPath;
                        DbOperate.UpdateCollection(col);
                    }
                }
            }
            DbOperate.AddMapToCollection(entry, col);
        }