public void ScanDrives() { storageDevices.Clear(); foreach (SavePath a in GlobalConfig.paths) { if (a.path.StartsWith("ftp://")) { int indexofslash = a.path.IndexOf("/", 8); storageDevices.Add(new FTPSaveDir(a.path.Substring(indexofslash), a.path.Substring(0, indexofslash), a.name)); } else { storageDevices.Add(new PSPSaveDir(a.path, a.name)); } } string cmaPath = Environment.GetEnvironmentVariable("USERPROFILE") + "/Documents/PS Vita/PSAVEDATA/"; if (Directory.Exists(cmaPath)) { foreach (string a in Directory.GetDirectories(cmaPath)) { storageDevices.Add(new PSPSaveDir(a, $"PS Vita Content Manager [{GetGameID(a)}]")); } } foreach (string a in Directory.GetLogicalDrives()) { if (Directory.Exists(a + "/pspemu/PSP/")) { storageDevices.Add(new PSPSaveDir(a + "/pspemu/PSP/SAVEDATA/", $"[{a}] PS Vita (SD or USB)")); } if (Directory.Exists(a + "/PSP/")) { storageDevices.Add(new PSPSaveDir(a + "/PSP/SAVEDATA/", $"[{a}] PSP Memory Stick")); } if (Directory.Exists(a + "/switch/ppsspp/config/ppsspp/PSP/")) { storageDevices.Add(new PSPSaveDir(a + "/switch/ppsspp/config/ppsspp/PSP/SAVEDATA/", $"[{a}] Switch")); } } foreach (MediaDevice a in MTPDevice.ScanMTPs()) { MTPDevice b = new MTPDevice(a); if (b.saveDirs.Count == 0) { b.Close(); } else { foreach (MTPSaveDir c in b.saveDirs) { storageDevices.Add(c); } } } }
public MTPSaveDir(MTPDevice pnt, string dr2, string nm2) { parent = pnt; dir = dr2; name = nm2; }