protected override DetectedLocations getPaths(APlayStationID get_me) { DetectedLocations return_me = new DetectedLocations(); if (get_me.suffix == null || get_me.prefix == null) { return(return_me); } Type check = get_me.GetType(); if (check.Equals(typeof(PlayStation1ID))) { return_me.AddRange(detectPS3Export(get_me as APlayStationID)); } else if (check.Equals(typeof(PlayStation2ID))) { return_me.AddRange(detectPS3Export(get_me as APlayStationID)); } else if (check.Equals(typeof(PlayStation3ID))) { return_me.AddRange(detectPSGame(get_me as PlayStation3ID, EnvironmentVariable.PS3Save)); } else if (check.Equals(typeof(PlayStationPortableID))) { return_me.AddRange(detectPSGame(get_me as PlayStationPortableID, EnvironmentVariable.PSPSave)); } return(return_me); }
protected override DetectedLocations getPaths(ScummVM get_me) { DetectedLocations locs = base.getPaths(get_me); if (install_path != null) { LocationPath loc = SystemLocationHandler.translateToVirtualStore(install_path); DetectedLocations vlocs = Core.locations.getPaths(loc); List <string> keys = new List <string>(vlocs.Keys); foreach (string key in keys) { if (!filterLocation(vlocs[key], get_me, vlocs[key].owner)) { locs.Remove(key); } } locs.AddRange(locs); } return(locs); }
public DetectedLocations interpretPath(params string[] interpret_me) { if (interpret_me.Length == 0) { throw new Exception("Not enough paths!"); } string path = interpret_me[0].TrimEnd(Path.DirectorySeparatorChar); for (int i = 1; i < interpret_me.Length; i++) { path = Path.Combine(path, interpret_me[i].TrimEnd(Path.DirectorySeparatorChar)); } DetectedLocations return_me = new DetectedLocations(); path = correctPath(path); if (path == null) { return(return_me); } foreach (KeyValuePair <HandlerType, ALocationHandler> handler in handlers) { return_me.AddRange(handler.Value.interpretPath(path)); } return(return_me); }
protected override DetectedLocations getPaths(LocationShortcut get_me) { FileInfo the_shortcut; //StringBuilder start_menu; DetectedLocations return_me = new DetectedLocations(); String path; List <string> paths = this.getPaths(get_me.ev); the_shortcut = null; foreach (string check_me in paths) { the_shortcut = new FileInfo(Path.Combine(check_me, get_me.path)); if (the_shortcut.Exists) { break; } } if (the_shortcut != null && the_shortcut.Exists) { IWshRuntimeLibrary.WshShell shell = new IWshRuntimeLibrary.WshShell(); IWshRuntimeLibrary.IWshShortcut link = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(the_shortcut.FullName); try { path = Path.GetDirectoryName(link.TargetPath); path = get_me.modifyPath(path); return_me.AddRange(Core.locations.interpretPath(path)); } catch { } } return(return_me); }
public DetectedLocations getPaths(ALocation get_me) { DetectedLocations return_me = new DetectedLocations(); foreach (KeyValuePair <HandlerType, ALocationHandler> handler in handlers) { return_me.AddRange(handler.Value.getPaths(get_me)); } return(return_me); }
protected override DetectedLocations getPaths(LocationRegistry get_me) { DetectedLocations return_me = new DetectedLocations(); RegistryHandler reg; // This handles if the root is a registry key if (get_me.Key != null) { reg = new RegistryHandler(get_me.Root, get_me.Key, false); if (reg.key_found) { try { string path; if (get_me.Value == null) { path = reg.getValue(""); } else { path = reg.getValue(get_me.Value); } if (path != null) { if (path.Contains("/")) { path = path.Split('/')[0].Trim(); } if (path.Contains("\"")) { path = path.Trim('\"').Trim(); } if (Path.HasExtension(path)) { path = Path.GetDirectoryName(path); } path = get_me.modifyPath(path); if (Directory.Exists(path)) { return_me.AddRange(Core.locations.interpretPath(new DirectoryInfo(path).FullName)); } } } catch (Exception e) { throw new TranslateableException("RegistryKeyLoadError", e); } } } return(return_me); }
protected override DetectedLocations getPaths(ScummVM get_me) { if (get_me.Name == "scummvm") { Console.Out.Write(""); } List <DetectedLocationPathHolder> paths = new List <DetectedLocationPathHolder>(); if (Locations == null) { setup(); } if (install_path != null) { paths.AddRange(loadLocations(install_path, get_me, null)); } DetectedLocations return_me = new DetectedLocations(); foreach (string user in Locations.Keys) { if (get_me.Name != "scummvm" && Locations[user].ContainsKey("scummvm")) { foreach (DetectedLocationPathHolder path in loadLocations(Locations[user]["scummvm"], get_me, user)) { DirectoryInfo info = new DirectoryInfo(path.FullDirPath); if (info.GetFiles(get_me.Name + "*").Length > 0) { return_me.Add(path); } } } if (Locations[user].ContainsKey(get_me.Name)) { return_me.AddRange(loadLocations(Locations[user][get_me.Name], get_me, user)); } } return(return_me); }
protected override DetectedLocations getPaths(LocationPath get_me) { DetectedLocations return_me = new DetectedLocations(); DirectoryInfo test; DetectedLocationPathHolder add_me; switch (get_me.EV) { case EnvironmentVariable.InstallLocation: LocationPath temp = new LocationPath(get_me); string[] chopped = temp.Path.Split(Path.DirectorySeparatorChar); for (int i = 0; i < chopped.Length; i++) { temp.ReplacePath(chopped[i]); for (int j = i + 1; j < chopped.Length; j++) { temp.AppendPath(chopped[j]); } temp.EV = EnvironmentVariable.Drive; return_me.AddRange(getPaths(temp)); temp.EV = EnvironmentVariable.AltSavePaths; return_me.AddRange(getPaths(temp)); } break; case EnvironmentVariable.AltSavePaths: foreach (AltPathHolder alt_path in Core.settings.save_paths) { if (PermissionsHelper.isReadable(alt_path.path)) { if (get_me.Path != null && get_me.Path.Length > 0) { test = new DirectoryInfo(Path.Combine(alt_path.path, get_me.Path)); } else { test = new DirectoryInfo(alt_path.path); } if (test.Exists) { DetectedLocations locs = Core.locations.interpretPath(test.FullName); foreach (DetectedLocationPathHolder loc in locs) { return_me.Add(loc); } } } } break; case EnvironmentVariable.Drive: foreach (string drive in drives) { if (get_me.Path != null && get_me.Path.Length > 0) { test = new DirectoryInfo(Path.Combine(drive, get_me.Path)); } else { test = new DirectoryInfo(drive); } if (test.Exists) { add_me = new DetectedLocationPathHolder(get_me, drive, null); return_me.Add(add_me); } } break; default: return(base.getPaths(get_me)); } return(return_me); }
protected override DetectedLocations getPaths(LocationPath get_me) { //if(get_me.rel_root!= EnvironmentVariable.Public) // return new List<DetectedLocationPathHolder>(); DetectedLocations return_me = new DetectedLocations(); DetectedLocationPathHolder add_me; DirectoryInfo test; switch (get_me.EV) { case EnvironmentVariable.InstallLocation: LocationPath temp = new LocationPath(get_me); string[] chopped = temp.Path.Split(Path.DirectorySeparatorChar); for (int i = 0; i < chopped.Length; i++) { temp.ReplacePath(chopped[i]); for (int j = i + 1; j < chopped.Length; j++) { temp.AppendPath(chopped[j]); } temp.EV = EnvironmentVariable.ProgramFiles; return_me.AddRange(getPaths(temp)); } return_me.AddRange(base.getPaths(get_me)); break; case EnvironmentVariable.ProgramFiles: case EnvironmentVariable.ProgramFilesX86: // Always checks both the VirtualStore and the real Program Files, // to make sure nothing is missed, especially in the case of old games // that may or may not use the VirtualStore if (!get_me.override_virtual_store && platform_version == "WindowsVista") { LocationPath virtualstore_info = new LocationPath(get_me); virtualstore_info.EV = EnvironmentVariable.LocalAppData; if (x64) { virtualstore_info.ReplacePath(Path.Combine("VirtualStore", global.getFolder(EnvironmentVariable.ProgramFilesX86).BaseFolder.Substring(3), virtualstore_info.Path)); return_me.AddRange(getPaths(virtualstore_info)); virtualstore_info = new LocationPath(get_me); virtualstore_info.EV = EnvironmentVariable.LocalAppData; } virtualstore_info.ReplacePath(Path.Combine("VirtualStore", global.getFolder(EnvironmentVariable.ProgramFiles).BaseFolder.Substring(3), virtualstore_info.Path)); return_me.AddRange(getPaths(virtualstore_info)); } if (x64) { if (get_me.Path != null && get_me.Path.Length > 0) { test = new DirectoryInfo(Path.Combine(global.getFolder(EnvironmentVariable.ProgramFilesX86).BaseFolder, get_me.Path)); } else { test = new DirectoryInfo(global.getFolder(EnvironmentVariable.ProgramFilesX86).BaseFolder); } if (test.Exists) { add_me = new DetectedLocationPathHolder(get_me, global.getFolder(EnvironmentVariable.ProgramFilesX86).BaseFolder, null); return_me.Add(add_me); } } if (get_me.Path != null && get_me.Path.Length > 0) { test = new DirectoryInfo(Path.Combine(global.getFolder(EnvironmentVariable.ProgramFiles).BaseFolder, get_me.Path)); } else { test = new DirectoryInfo(global.getFolder(EnvironmentVariable.ProgramFiles).BaseFolder); } if (test.Exists) { add_me = new DetectedLocationPathHolder(get_me, global.getFolder(EnvironmentVariable.ProgramFiles).BaseFolder, null); return_me.Add(add_me); } break; default: return(base.getPaths(get_me)); } return(return_me); }