Exemplo n.º 1
0
        public static string GetImageLocation(this IBeatmap beatmap, ISettings settings)
        {
            var    songsDirectory  = BeatmapHelpers.GetFullSongsLocation(settings);
            var    osuFileLocation = beatmap.FullOsuFileLocation(songsDirectory);
            string ImageLocation   = string.Empty;

            using (StreamReader file = new StreamReader(osuFileLocation))
            {
                string line;
                while ((line = file.ReadLine()) != null)
                {
                    if (line.ToLower().Contains(".jpg") || line.ToLower().Contains(".png") || line.ToLower().Contains(".jpeg"))
                    {
                        var split = line.Split(',');
                        if (split.Length < 3)
                        {
                            continue;
                        }

                        ImageLocation = Path.Combine(beatmap.BeatmapDirectory(songsDirectory), split[2].Trim('"'));
                        if (!File.Exists(ImageLocation))
                        {
                            return(string.Empty);
                        }
                        break;
                    }
                }
            }
            return(ImageLocation);
        }
Exemplo n.º 2
0
        public static bool IsValidBeatmap(this IBeatmap beatmap, ISettings settings, out string fullFileLocation)
        {
            fullFileLocation = beatmap.FullOsuFileLocation(settings);

            if (!File.Exists(fullFileLocation))
            {
                return(false);
            }
            FileInfo file = new FileInfo(fullFileLocation);

            return(file.Length != 0);
        }
Exemplo n.º 3
0
 public static string FullOsuFileLocation(this IBeatmap beatmap, ISettings settings)
 {
     return(beatmap.FullOsuFileLocation(GetFullSongsLocation(settings)));
 }