예제 #1
0
 public void AddRoms(List <string> files)
 {
     foreach (string file in files)
     {
         Roms.Add(new GameRom(file, new FileInfo(file).Name));
     }
 }
예제 #2
0
        protected virtual void LoadRoms()
        {
            try
            {
                var files = System.IO.Directory.GetFiles(RomsPath);

                string lastImageFile = string.Empty;

                foreach (var file in files)
                {
                    if (IsImagePath(file))
                    {
                        lastImageFile = file;
                        Rom rImageAux = new Rom(file);
                        var rom       = Roms.FirstOrDefault(x => x.GetRomName().Equals(rImageAux.GetRomName()));
                        if (rom != null)
                        {
                            rom.SetImagePath(file);
                        }
                    }
                    else
                    {
                        Rom r = new Rom(file);
                        if (lastImageFile.Contains(r.GetRomName()))
                        {
                            r.SetImagePath(lastImageFile);
                        }

                        Roms.Add(r);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception($"{nameof(LoadRoms)}: {ex.Message}");
            }
        }