/[EmuXPortal]/trunk/EmuXPortal/Api/RomConfig.cs
ViewVC logotype

Diff of /trunk/EmuXPortal/Api/RomConfig.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/EmuXPortal/Api/RomConfig.cs	2012/04/04 04:13:17	29
+++ trunk/EmuXPortal/Api/RomConfig.cs	2012/06/19 03:38:40	85
@@ -31,11 +31,39 @@
             {
                 FileInfo fi = new FileInfo(rom_file);
                 this.RomFile =fi.FullName;
-                this.RomTitle = fi.Name;
+                this.RomTitle = EMUConfig.GameTitle == "" ? fi.Name : EMUConfig.GameTitle;                
                 string rom_img = "";
                 // load image
                 if (File.Exists(string.Format("{0}.jpg", fi.FullName.Replace(fi.Extension, "")))) { rom_img = string.Format("{0}.jpg", fi.FullName.Replace(fi.Extension, "")); }
                 this.RomImage = (rom_img == "") ? Properties.Resources.DefaultGameImage : Image.FromFile(rom_img);
+
+
+                if (EMUConfig.GameImage != string.Empty)
+                {
+                    FileInfo fi_gameimage = new FileInfo(EMUConfig.GameImage);
+                    if (fi_gameimage.Exists) { this.RomImage = Image.FromFile(fi_gameimage.FullName); }
+                    else
+                    {
+                        FileInfo t = new FileInfo(EMUConfig.ConfigPath);
+                        string path = t.FullName.Replace(t.Name, "").Replace(t.Extension, "");
+                        string image_path = string.Format(@"{0}{1}", path, fi_gameimage.Name);
+                        FileInfo x = new FileInfo(image_path);
+                        if (x.Exists) { this.RomImage = Image.FromFile(x.FullName); }
+                        else
+                        {
+                            if (EMUConfig.GameExe != string.Empty)
+                            {
+                                FileInfo fi_gamexe = new FileInfo(EMUConfig.GameExe);
+                                path = fi_gamexe.FullName.Replace(fi_gamexe.Name, "").Replace(fi_gamexe.Extension, "");
+                                image_path = string.Format(@"{0}{1}", path, fi_gameimage.Name);
+                                x = new FileInfo(image_path);
+                                if (x.Exists) { this.RomImage = Image.FromFile(x.FullName); }
+                            }
+                        }
+                    }
+                }
+
+
                 //string config_dir = fi.Directory.Parent.FullName;
                 //Config = EmuConfigLoader.Load(config_dir);
                 Config = EMUConfig;

 

  ViewVC Help
Powered by ViewVC 1.1.22