private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox1.SelectedIndex == -1) { return; } if (comboBox1.SelectedItem.GetType() == typeof(iPhoneBackup)) { if (currentBackup == null || currentBackup.index != comboBox1.SelectedIndex) { currentBackup = (iPhoneBackup)comboBox1.SelectedItem; loadCurrentBackup(); } return; } OpenFileDialog fd = new OpenFileDialog(); fd.Filter = "iPhone Backup|Info.plist|All files (*.*)|*.*"; fd.FilterIndex = 1; fd.RestoreDirectory = true; if (fd.ShowDialog() == DialogResult.OK) { beforeLoadManifest(); iPhoneBackup b = LoadManifest(Path.GetDirectoryName(fd.FileName)); if (b != null) { b.custom = true; comboBox1.Items.Insert(comboBox1.Items.Count - 1, b); b.index = comboBox1.Items.Count - 2; comboBox1.SelectedIndex = b.index; } } }
private void loadCurrentBackup() { if (currentBackup == null) { return; } files92 = null; try { iPhoneBackup backup = currentBackup; if (File.Exists(Path.Combine(backup.path, "Manifest.mbdb"))) { files92 = mbdbdump.mbdb.ReadMBDB(backup.path); BinaryPlistReader az = new BinaryPlistReader(); IDictionary er = az.ReadObject(Path.Combine(backup.path, "Manifest.plist")); parseAll92(er); } } catch (InvalidOperationException ex) { MessageBox.Show(ex.InnerException.ToString()); } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } }
private void beforeLoadManifest() { comboBox1.SelectedIndex = -1; currentBackup = null; label2.Text = "未选择"; label2.ForeColor = Color.Black; button2.Enabled = false; }
private void Form1_Load(object sender, EventArgs e) { Form1_Resize(null, null); if (comboBackups.Items.Count == 1) { // save selected dbFile for later use dbFileDir = comboBackups.SelectedValue as string; dbFileDate = comboBackups.GetItemText(comboBackups.SelectedItem); dbFile = Path.Combine(dbFileDir, "3d\\3d0d7e5fb2ce288813306e4d4636395e047a3d28"); _backup = new iPhoneBackup() { FileDate = dbFileDate, DatabaseFolder = Path.GetFileName(dbFileDir), BackupRoot = Path.GetDirectoryName(dbFileDir) }; GetChatGroups(); iPhoneBackup.MessageGroup.ToStringFilter = _iPhone.GroupNames; lbMessageGroup.Select(); } }
private void loadCurrentBackup() { if (currentBackup == null) { return; } files92 = null; try { iPhoneBackup backup = currentBackup; if (File.Exists(Path.Combine(backup.path, "Manifest.mbdb"))) { files92 = mbdbdump.mbdb.ReadMBDB(backup.path); } else if (File.Exists(Path.Combine(backup.path, "Manifest.db"))) { files92 = v10db.ReadMBDB(Path.Combine(backup.path, "Manifest.db")); } if (files92 != null && files92.Count > 0) { label2.Text = "正确"; label2.ForeColor = Color.Green; button2.Enabled = true; } else { currentBackup = null; label2.Text = "未找到"; label2.ForeColor = Color.Red; button2.Enabled = false; } } catch (InvalidOperationException ex) { MessageBox.Show(ex.InnerException.ToString()); } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } }
private iPhoneBackup LoadManifest(string path) { iPhoneBackup backup = null; string filename = Path.Combine(path, "Info.plist"); try { xdict dd = xdict.open(filename); if (dd != null) { backup = new iPhoneBackup(); backup.path = path; foreach (xdictpair p in dd) { if (p.item.GetType() == typeof(string)) { switch (p.key) { case "Device Name": backup.DeviceName = (string)p.item; break; case "Display Name": backup.DisplayName = (string)p.item; break; case "Last Backup Date": DateTime.TryParse((string)p.item, out backup.LastBackupDate); break; } } } backups.Add(backup); backups.Sort(iPhoneBackup.SortByDate); } } catch (InvalidOperationException ex) { MessageBox.Show(ex.InnerException.ToString()); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } return(backup); }
public WeChatInterface(iPhoneBackup currentBackup, List <mbdb.MBFileRecord> files92) { this.currentBackup = currentBackup; this.files92 = files92; }
public void GetContacts(iPhoneBackup backup) { _people = backup.GetiPhoneContacts(); _contacts = new Dictionary <string, string>(); _people.ForEach((p) => p.Contacts.ForEach((c) => _contacts[c.value] = p.FullName)); }