static void ftpClient_GetFileAsyncCompleted(object sender, GetFileAsyncCompletedEventArgs e) { sfoReader = new SFOReader(Application.StartupPath + "\\PARAM.SFO"); sfoParams = sfoReader.getKeyValueMap(); if (sfoParams.ContainsKey("CATEGORY") && ((ftpClient.CurrentDirectory.IndexOf("PS3_GAME") > -1 && sfoParams["CATEGORY"] == "DG") || (ftpClient.CurrentDirectory.IndexOf("PS3_GAME") == -1 && sfoParams["CATEGORY"] == "HG"))) { if (sfoParams.ContainsKey("TITLE_ID") && sfoParams.ContainsKey("TITLE") && sfoParams.ContainsKey("VERSION")) { TreeGridNode node = MainForm.treeGridView1.Nodes.Add(true, sfoParams["TITLE_ID"] + " - " + sfoParams["TITLE"], sfoParams.ContainsKey("PS3_SYSTEM_VER") ? sfoParams["PS3_SYSTEM_VER"] : "-------", sfoParams["VERSION"], "Unavailable", "Idle", ftpSFOList[sfoPosition]); node.ImageIndex = 0; UpdateFinder updateFinder = new UpdateFinder(MainForm); updateFinder.GetUpdates(sfoParams["TITLE_ID"]); } } if (ftpSFOList.Count - 1 > sfoPosition) { sfoPosition++; downloadFTPSFO(); } else { ftpStage = "FTP Import Done"; FTPMessage(new FTPData(2, "FTP Import Done")); ftpClient.Close(); } }
public static void GetSFOList(string path, bool reset) { string[] files = null; string[] directories = null; if (reset) { fat32Scanner.Reset(); } try { files = System.IO.Directory.GetFiles(path); directories = System.IO.Directory.GetDirectories(path); foreach (string file in files) { if (file.ToLower().IndexOf("param.sfo") > -1) { if (path.Substring(path.LastIndexOf("\\") + 1).ToLower() == "ps3_game") { try { sfoReader = new SFOReader(file); sfoParams = sfoReader.getKeyValueMap(); TreeGridNode node; if (sfoParams.ContainsKey("TITLE_ID") && sfoParams.ContainsKey("TITLE") && sfoParams.ContainsKey("VERSION")) { if (Config.Get("CheckFat32") == "1") { Console.WriteLine("Start Scanning"); node = MainForm.treeGridView1.Nodes.Add(true, sfoParams["TITLE_ID"] + " - " + sfoParams["TITLE"], sfoParams["PS3_SYSTEM_VER"], sfoParams["VERSION"], "Scanning...", "Idle", path.Substring(0, path.LastIndexOf("\\"))); fat32Scanner.AddToScan(path, sfoParams["TITLE_ID"]); } else { node = MainForm.treeGridView1.Nodes.Add(true, sfoParams["TITLE_ID"] + " - " + sfoParams["TITLE"], sfoParams["PS3_SYSTEM_VER"], sfoParams["VERSION"], "Disabled", "Idle", path.Substring(0, path.LastIndexOf("\\"))); } node.ImageIndex = 0; } } catch (Exception ex) { } } } } foreach (string directory in directories) { GetSFOList(directory, false); } } catch (UnauthorizedAccessException e) { Console.WriteLine(e.Message); } }