Exemplo n.º 1
0
        private void listView1_DoubleClick(object sender, EventArgs e)
        {
            iPhoneApp app = (iPhoneApp)listView1.FocusedItem.Tag;

            if (app == null)
            {
                return;
            }
            if (appsCatalog == null)
            {
                return;
            }

            if (appsCatalog == null)
            {
                return;
            }

            iPhoneIPA ipa;

            if (!appsCatalog.TryGetValue(app.Identifier, out ipa))
            {
                return;
            }

            string argument = @"/select, """ + Path.Combine(appsCatalog.appsDirectory, ipa.fileName) + @"""";

            System.Diagnostics.Process.Start("explorer.exe", argument);
        }
Exemplo n.º 2
0
        private void addApp(iPhoneApp app)
        {
            iPhoneIPA ipa = null;


            if (appsCatalog != null)
            {
                appsCatalog.TryGetValue(app.Identifier, out ipa);
            }

            ListViewItem lvi = new ListViewItem();

            lvi.Tag  = app;
            lvi.Text = app.Key;
            lvi.SubItems.Add(ipa != null ? ipa.itemName : app.Key);
            lvi.SubItems.Add(app.Files != null ? app.Files.Count.ToString("N0") : "N/A");
            lvi.SubItems.Add(app.FilesLength.ToString("N0"));
            lvi.SubItems.Add(ipa != null ? ipa.totalSize.ToString("N0") : "");

            lvi.SubItems[2].Tag = (long)(app.Files != null ? app.Files.Count : 0);
            lvi.SubItems[3].Tag = (long)app.FilesLength;
            lvi.SubItems[4].Tag = (long)(ipa != null ? ipa.totalSize : 0);

            listView1.Items.Add(lvi);
        }
Exemplo n.º 3
0
        // export the file list to a CSV file
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            if (listView1.FocusedItem == null)
            {
                return;
            }
            if (listView1.FocusedItem.Tag == null)
            {
                return;
            }
            iPhoneApp app = (iPhoneApp)listView1.FocusedItem.Tag;

            SaveFileDialog fd = new SaveFileDialog();

            fd.Filter           = "CSV file (*.csv)|*.csv|All files (*.*)|*.*";
            fd.FilterIndex      = 1;
            fd.RestoreDirectory = true;
            fd.Title            = "Export the file list of '" + app.Key + "' application";

            if (fd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            try
            {
                using (StreamWriter fs = new StreamWriter(fd.FileName))
                {
                    fs.WriteLine("Path;FileLength;ModificationTime;Domain;Key");

                    foreach (string f in app.Files)
                    {
                        mbdb.MBFileRecord x = files92[Int32.Parse(f)];

                        fs.Write(x.Path);
                        fs.Write(';');
                        fs.Write(x.FileLength);
                        fs.Write(';');
                        fs.Write(x.aTime.ToString());
                        fs.Write(';');
                        fs.Write(x.Domain);
                        fs.Write(';');
                        fs.Write(x.key);
                        fs.WriteLine();
                    }
                }
            }
            finally
            {
            }
        }
Exemplo n.º 4
0
        private void addApp(iPhoneApp app)
        {
            iPhoneIPA ipa = null;

            if (appsCatalog != null)
            {
                appsCatalog.TryGetValue(app.Identifier, out ipa);
            }

            ListViewItem lvi = new ListViewItem();
            lvi.Tag = app;
            lvi.Text = app.Key;
            lvi.SubItems.Add(ipa != null ? ipa.itemName : app.Key);
            lvi.SubItems.Add(app.Files != null ? app.Files.Count.ToString("N0") : "N/A");
            lvi.SubItems.Add(app.FilesLength.ToString("N0"));
            lvi.SubItems.Add(ipa != null ? ipa.totalSize.ToString("N0") : "");

            lvi.SubItems[2].Tag = (long)(app.Files != null ? app.Files.Count : 0);
            lvi.SubItems[3].Tag = (long)app.FilesLength;
            lvi.SubItems[4].Tag = (long)(ipa != null ? ipa.totalSize : 0);

            listView1.Items.Add(lvi);
        }
Exemplo n.º 5
0
        private void toolStripButton4_Click(object sender, EventArgs e)
        {
            string filename;
            string dest_root;
            string dest;

            string ext = (files92 == null) ? ".mddata" : "";

            iPhoneBackup backup = currentBackup;
            iPhoneApp    app    = listView1.FocusedItem.Tag as iPhoneApp;

            if (backup == null || app == null)
            {
                return;
            }

            dest_root = dest = Path.Combine(@"C:\temp", backup.DeviceName, app.Key);

            foreach (ListViewItem i in listView2.SelectedItems)
            {
                iPhoneFile f = i.Tag as iPhoneFile;
                if (f != null)
                {
                    filename = Path.Combine(backup.path, f.Key + ext);

                    dest = Path.Combine(dest_root, f.Path);

                    dest = dest.Normalize(NormalizationForm.FormC);

                    StringBuilder sb = new StringBuilder(dest.Length);
                    char[]        ss = Path.GetInvalidPathChars();

                    Array.Sort(ss);

                    foreach (char c in dest)
                    {
                        //System.IO.Path.GetInvalidFileNameChars()
                        if (c == Path.DirectorySeparatorChar || c == Path.AltDirectorySeparatorChar)
                        {
                            sb.Append(Path.DirectorySeparatorChar);
                        }
                        else if (c == Path.VolumeSeparatorChar)
                        {
                            sb.Append(c);
                        }
                        else if (Array.BinarySearch(ss, c) >= 0)
                        {
                            sb.Append('_');
                        }
                        else
                        {
                            sb.Append(c);
                        }
                    }

                    dest = sb.ToString();
                    dest = dest.Replace(':', '_');
                    dest = dest.Replace(@"C_\temp", @"C:\temp");
                    Directory.CreateDirectory(Path.GetDirectoryName(dest));
                    File.Copy(filename, dest, true);
                }
            }
        }
Exemplo n.º 6
0
        private void listView1_Click(object sender, EventArgs e)
        {
            listView2.Items.Clear();
            buttonCSVExport.Enabled = true;

            listView2.BeginUpdate();
            Cursor.Current = Cursors.WaitCursor;

            try
            {
                foreach (ListViewItem item in listView1.SelectedItems)
                {
                    iPhoneApp app = (iPhoneApp)item.Tag;

                    if (app.Files == null)
                    {
                        break;
                    }

                    ListViewItem[] lvic = new ListViewItem[app.Files.Count];
                    int            idx  = 0;

                    foreach (string f in app.Files)
                    {
                        iPhoneFile ff;

                        ff = new iPhoneFile();

                        mbdb.MBFileRecord x = files92[Int32.Parse(f)];

                        ff.Key              = x.key;
                        ff.Domain           = x.Domain;
                        ff.Path             = x.Path;
                        ff.ModificationTime = x.aTime;
                        ff.FileLength       = x.FileLength;



                        ListViewItem lvi = new ListViewItem();
                        lvi.Tag  = ff;
                        lvi.Text = ff.Path;
                        lvi.SubItems.Add(ff.FileLength.ToString("N0"));
                        lvi.SubItems.Add(ff.ModificationTime.ToString());
                        lvi.SubItems.Add(ff.Domain);
                        lvi.SubItems.Add(ff.Key);

                        lvi.SubItems[1].Tag = (long)ff.FileLength;
                        lvi.SubItems[2].Tag = (long)ff.ModificationTime.ToBinary();

                        lvic[idx++] = lvi;
                    }

                    listView2.Items.AddRange(lvic);
                }
            }
            finally
            {
                listView2.EndUpdate();
                Cursor.Current = Cursors.Default;
            }

            toolStripButton4.Enabled = (listView2.Items.Count > 0);
        }
Exemplo n.º 7
0
        private void parseAll92(IDictionary mbdb)
        {
            var sd = mbdb["Applications"] as Dictionary <object, object>;

            if (sd == null)
            {
                return;
            }

            var filesByDomain = new Dictionary <string, appFiles>();

            for (int i = 0; i < files92.Count; ++i)
            {
                if ((files92[i].Mode & 0xF000) == 0x8000)
                {
                    string d = files92[i].Domain;
                    if (!filesByDomain.ContainsKey(d))
                    {
                        filesByDomain.Add(d, new appFiles());
                    }

                    filesByDomain[d].add(i, files92[i].FileLength);
                }
            }


            foreach (var p in sd)
            {
                iPhoneApp app = new iPhoneApp();

                app.Key = p.Key as string;

                var zz = p.Value as IDictionary;

                //app.DisplayName = zz["CFBundleDisplayName"] as string;
                //app.Name = zz["CFBundleName"] as string;
                app.Identifier = zz["CFBundleIdentifier"] as string;
                app.Container  = zz["Path"] as string;

                // il y a des applis mal paramétrées...
                //if (app.Name == null) app.Name = app.Key;
                //if (app.DisplayName == null) app.DisplayName = app.Name;

                if (filesByDomain.ContainsKey("AppDomain-" + app.Key))
                {
                    app.Files = new List <String>();

                    foreach (int i in filesByDomain["AppDomain-" + app.Key].indexes)
                    {
                        app.Files.Add(i.ToString());
                    }
                    app.FilesLength = filesByDomain["AppDomain-" + app.Key].FilesLength;

                    filesByDomain.Remove("AppDomain-" + app.Key);
                }

                addApp(app);
            }


            {
                iPhoneApp system = new iPhoneApp();

                system.Key = "---";
                //system.Name = "System";
                //system.DisplayName = "---";
                system.Identifier = "---";
                system.Container  = "---";
                system.Files      = new List <String>();

                foreach (appFiles i in filesByDomain.Values)
                {
                    foreach (int j in i.indexes)
                    {
                        system.Files.Add(j.ToString());
                    }
                    system.FilesLength = i.FilesLength;
                }


                addApp(system);

                /*
                 * ListViewItem lvi = new ListViewItem();
                 * lvi.Tag = system;
                 * lvi.Text = system.DisplayName;
                 * lvi.SubItems.Add(system.Name);
                 * lvi.SubItems.Add(system.Files != null ? system.Files.Count.ToString("N0") : "N/A");
                 * lvi.SubItems.Add(system.FilesLength.ToString("N0"));
                 * lvi.SubItems.Add("---");
                 *
                 * lvi.SubItems[2].Tag = (long)(system.Files != null ? system.Files.Count : 0);
                 * lvi.SubItems[3].Tag = (long)system.FilesLength;
                 * lvi.SubItems[4].Tag = (long)0;
                 *
                 * listView1.Items.Add(lvi);
                 */
            }
        }
Exemplo n.º 8
0
        private void parseAll92(IDictionary mbdb)
        {
            var sd = mbdb["Applications"] as Dictionary<object, object>;
            if (sd == null)
                return;

            var filesByDomain = new Dictionary<string, appFiles>();
            
            for (int i = 0; i < files92.Count; ++i)
            {
                if ((files92[i].Mode & 0xF000) == 0x8000)
                {
                    string d = files92[i].Domain;
                    if (!filesByDomain.ContainsKey(d))                    
                        filesByDomain.Add(d, new appFiles());
                    
                    filesByDomain[d].add(i, files92[i].FileLength);                    
                }
            }


            foreach (var p in sd)
            {
                iPhoneApp app = new iPhoneApp();

                app.Key = p.Key as string;

                var zz = p.Value as IDictionary;

                //app.DisplayName = zz["CFBundleDisplayName"] as string;
                //app.Name = zz["CFBundleName"] as string;
                app.Identifier = zz["CFBundleIdentifier"] as string;
                app.Container = zz["Path"] as string;
                
                // il y a des applis mal paramétrées...
                //if (app.Name == null) app.Name = app.Key;
                //if (app.DisplayName == null) app.DisplayName = app.Name;

                if (filesByDomain.ContainsKey("AppDomain-" + app.Key))
                {
                    app.Files = new List<String>();

                    foreach (int i in filesByDomain["AppDomain-" + app.Key].indexes)
                    {
                        app.Files.Add(i.ToString());
                    }
                    app.FilesLength = filesByDomain["AppDomain-" + app.Key].FilesLength;

                    filesByDomain.Remove("AppDomain-" + app.Key);
                }

                addApp(app);
            }


            {
                iPhoneApp system = new iPhoneApp();

                system.Key = "---";
                //system.Name = "System";
                //system.DisplayName = "---";
                system.Identifier = "---";
                system.Container = "---";
                system.Files = new List<String>();

                foreach (appFiles i in filesByDomain.Values)
                {
                    foreach (int j in i.indexes)
                    {
                        system.Files.Add(j.ToString());
                    }
                    system.FilesLength = i.FilesLength;
                }


                addApp(system);

                /*
                ListViewItem lvi = new ListViewItem();
                lvi.Tag = system;
                lvi.Text = system.DisplayName;
                lvi.SubItems.Add(system.Name);
                lvi.SubItems.Add(system.Files != null ? system.Files.Count.ToString("N0") : "N/A");
                lvi.SubItems.Add(system.FilesLength.ToString("N0"));
                lvi.SubItems.Add("---");

                lvi.SubItems[2].Tag = (long)(system.Files != null ? system.Files.Count : 0);
                lvi.SubItems[3].Tag = (long)system.FilesLength;
                lvi.SubItems[4].Tag = (long)0;

                listView1.Items.Add(lvi);
                */
            }
        }