public override string getAbsoluteRoot(LocationPathHolder parse_me, string user) { switch(parse_me.rel_root) { case EnvironmentVariable.Drive: DetectedLocationPathHolder holder = (DetectedLocationPathHolder)parse_me; return holder.abs_root; default: return base.getAbsoluteRoot(parse_me, user); } }
protected override List<DetectedLocationPathHolder> getPaths(LocationPathHolder get_me) { List<DetectedLocationPathHolder> return_me = new List<DetectedLocationPathHolder>(); DirectoryInfo test; DetectedLocationPathHolder add_me; switch(get_me.rel_root) { case EnvironmentVariable.InstallLocation: LocationPathHolder temp = new LocationPathHolder(get_me); string[] chopped = temp.path.Split(Path.DirectorySeparatorChar); for(int i = 0;i<chopped.Length;i++) { temp.path = chopped[i]; for(int j=i+1;j<chopped.Length;j++) { temp.path = Path.Combine(temp.path,chopped[j]); } temp.rel_root = EnvironmentVariable.Drive; return_me.AddRange(getPaths(temp)); temp.rel_root = EnvironmentVariable.AltSavePaths; return_me.AddRange(getPaths(temp)); } break; case EnvironmentVariable.AltSavePaths: foreach(AltPathHolder alt_path in Core.settings.alt_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) { add_me = new DetectedLocationPathHolder(get_me); add_me.abs_root = alt_path.path; return_me.Add(add_me); } } } 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); add_me.abs_root = drive; return_me.Add(add_me); } } break; default: return base.getPaths(get_me); } return return_me; }
public DetectedLocationPathHolder(LocationPathHolder path) { this.append_path = path.append_path; this.detract_path = path.detract_path; this.IsEnabled = path.IsEnabled; this.IsExpanded = path.IsExpanded; this.IsSelected = path.IsSelected; this.language = path.language; this.platform_version = path.platform_version; this.path = path.path; this.read_only = path.read_only; this.rel_root = path.rel_root; }
public override List<DetectedLocationPathHolder> interpretPath(string interpret_me) { List<DetectedLocationPathHolder> return_me = new List<DetectedLocationPathHolder>(); LocationPathHolder new_location; if(ready) { return_me.AddRange(base.interpretPath(interpret_me)); if(return_me.Count==0) { foreach(string drive in drives) { if(interpret_me.StartsWith(drive)) { new_location = new LocationPathHolder(); new_location.rel_root = EnvironmentVariable.Drive; if(interpret_me.Length==drive.Length) new_location.path = ""; else new_location.path = interpret_me.Substring(drive.Length); return_me.AddRange(getPaths(new_location)); } } } } return return_me; }
private void parseInstallFolder() { output.AppendLine( Environment.NewLine + "Install Folder Dump: "); travelSaveFolder(game_path); backgroundWorker1.ReportProgress(6,"Dumping VirtualStore Folders..."); if(Core.locations.uac_enabled) { output.AppendLine( Environment.NewLine + "UAC Enabled" + Environment.NewLine); output.AppendLine( Environment.NewLine + "VirtualStore Folders: "); string virtual_path; foreach(string user in Core.locations.getUsers(EnvironmentVariable.LocalAppData)) { LocationPathHolder parse_me = new LocationPathHolder(); parse_me.path = "VirtualStore"; parse_me.rel_root = EnvironmentVariable.LocalAppData; virtual_path = Path.Combine(Core.locations.getAbsoluteRoot(parse_me,user),"VirtualStore"); backgroundWorker1.ReportProgress(6,"VirtualStore for user " + user + ": " + virtual_path); virtual_path = Path.Combine(virtual_path,game_path.Substring(3)); if(Directory.Exists(virtual_path)) travelSaveFolder(virtual_path); } } else { output.AppendLine( Environment.NewLine + "UAC Disabled or not present" + Environment.NewLine); } }
public LocationPathHolder(LocationPathHolder copy_me) : base(copy_me) { rel_root = copy_me.rel_root; path = copy_me.path; }
private string getFolder(EnvironmentVariable ev, string path) { LocationPathHolder parse_me = new LocationPathHolder(); parse_me.path = path; parse_me.rel_root = ev; foreach(string user in Core.locations.getUsers(ev)) { return Core.locations.getAbsoluteRoot(parse_me,user); } return Core.locations.getAbsoluteRoot(parse_me,null); }
public string getAbsoluteRoot(LocationPathHolder parse_me, string user) { foreach(KeyValuePair<HandlerType,ALocationHandler> handler in handlers) { string result = handler.Value.getAbsoluteRoot(parse_me, user); if(result!=null) return result; } return null; }
protected override List<DetectedLocationPathHolder> getPaths(LocationPathHolder get_me) { //if(get_me.rel_root!= EnvironmentVariable.Public) // return new List<DetectedLocationPathHolder>(); List<DetectedLocationPathHolder> return_me = new List<DetectedLocationPathHolder>(); DetectedLocationPathHolder add_me; DirectoryInfo test; switch(get_me.rel_root) { case EnvironmentVariable.InstallLocation: LocationPathHolder temp = new LocationPathHolder(get_me); string[] chopped = temp.path.Split(Path.DirectorySeparatorChar); for(int i = 0;i<chopped.Length;i++) { temp.path = chopped[i]; for(int j=i+1;j<chopped.Length;j++) { temp.path = Path.Combine(temp.path,chopped[j]); } temp.rel_root = 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== PlatformVersion.Vista) { LocationPathHolder virtualstore_info = new LocationPathHolder(get_me); virtualstore_info.rel_root = EnvironmentVariable.LocalAppData; if(x64) { virtualstore_info.path = Path.Combine("VirtualStore", global.getFolder(EnvironmentVariable.ProgramFilesX86).Substring(3), virtualstore_info.path); return_me.AddRange(getPaths(virtualstore_info)); virtualstore_info = new LocationPathHolder(get_me); virtualstore_info.rel_root = EnvironmentVariable.LocalAppData; } virtualstore_info.path = Path.Combine("VirtualStore", global.getFolder(EnvironmentVariable.ProgramFiles).Substring(3), virtualstore_info.path); return_me.AddRange(getPaths(virtualstore_info)); } add_me = new DetectedLocationPathHolder(get_me); if(x64) { if(get_me.path!=null&&get_me.path.Length>0) test = new DirectoryInfo(Path.Combine(global.getFolder(EnvironmentVariable.ProgramFilesX86), get_me.path)); else test = new DirectoryInfo(global.getFolder(EnvironmentVariable.ProgramFilesX86)); if (test.Exists) { add_me.abs_root = global.getFolder(EnvironmentVariable.ProgramFilesX86); return_me.Add(add_me); } } if(get_me.path!=null&&get_me.path.Length>0) test = new DirectoryInfo(Path.Combine(global.getFolder(EnvironmentVariable.ProgramFiles), get_me.path)); else test = new DirectoryInfo(global.getFolder(EnvironmentVariable.ProgramFiles)); if (test.Exists) { add_me.abs_root= global.getFolder(EnvironmentVariable.ProgramFiles); return_me.Add(add_me); } break; default: return base.getPaths(get_me); } return return_me; }