public iPhoneList() { /// TODO: Add ability to Edit and Delete Links InitializeComponent(); SetObjectSizes(); SetStatus(); toolsMain.Location = new Point(0, 0); toolsFileView.Location = new Point(203, 0); //ToolStripManager.Renderer = new Office2007Renderer(); //myPhone.Connect += new ConnectEventHandler(Connecting); //myPhone.Disconnect += new ConnectEventHandler(Connecting); prefs = new UserPrefs(); links = new LinkNodes(); ipItems = new ItemProperties(); ipItems.Phone = myPhone; try { LoadUserPreferences(); LoadConfig(); } catch (Exception err) { Console.WriteLine(err.Message); } ipItems.Phone = myPhone; splitFilesViewer.Panel2Collapsed = true; if (prefs.Preview.TabSpaces == 0) { prefs.Preview.TabSpaces = 4; } previewTextBox.Tag = "empty"; timerMain.Enabled = true; }
public ItemProperties LoadConfig() { ItemProperties ipItems = new ItemProperties(); Boolean prefsLoaded = false; String fullPath = AppDomain.CurrentDomain.BaseDirectory + "iPhoneList.config"; if ( File.Exists(fullPath) ) { try { XmlSerializer xmlConfig = new XmlSerializer(typeof(ItemProperties)); using ( TextReader prefsFile = new StreamReader(fullPath) ) { ipItems = (ItemProperties)xmlConfig.Deserialize(prefsFile); } prefsLoaded = true; } catch ( Exception err ) { Console.WriteLine(err.Message); } } if (!prefsLoaded || (ipItems.Items.Length == 0)){ // Files ipItems.AddFile("Program", TypeIdentifier.HeaderBytes, "CEFAEDFE0C00", 0, "Program", "Program"); ipItems.AddFile("Application", TypeIdentifier.Extension, ".app", "App", "Application"); ipItems.AddFile("BinPList", TypeIdentifier.ExtHeadBytes, ".plist", "62706C6973743030", 0, "Settings", "Settings"); ipItems.AddFile("PList", TypeIdentifier.Extension, ".plist", "Settings", "Settings"); ipItems.AddFile("BinStrings", TypeIdentifier.ExtHeadBytes, ".strings", "62706C6973743030", 0, "Settings", "Settings"); ipItems.AddFile("Strings", TypeIdentifier.Extension, ".strings", "Settings", "Settings"); ipItems.AddFile("Thumnail", TypeIdentifier.Extension, ".thm", "Image", "Image"); ipItems.AddFile("Thumb", TypeIdentifier.Extension, ".ithmb", "Image", "Image"); ipItems.AddFile("PNG", TypeIdentifier.Extension, ".png", "Image", "Image"); ipItems.AddFile("JPG", TypeIdentifier.Extension, ".jpg", "Image", "Image"); ipItems.AddFile("GIF", TypeIdentifier.Extension, ".gif", "Image", "Image"); ipItems.AddFile("BMP", TypeIdentifier.Extension, ".bmp", "Image", "Image"); ipItems.AddFile("AAC", TypeIdentifier.Extension, ".aac", "Audio", "Audio"); ipItems.AddFile("MP3", TypeIdentifier.Extension, ".mp3", "Audio", "Audio"); ipItems.AddFile("M4A", TypeIdentifier.Extension, ".m4a", "Audio", "Audio"); ipItems.AddFile("Photo DataBase", TypeIdentifier.FileName, "", "Database", "Database"); ipItems.AddFile("ArtworkDB", TypeIdentifier.FileName, "", "Database", "Database"); ipItems.AddFile("Text", TypeIdentifier.Extension, ".txt", "Document", "Document"); ipItems.AddFile("Script", TypeIdentifier.Extension, ".script", "Script", "Script"); ipItems.AddFile("ShellScript", TypeIdentifier.Extension, ".sh", "Script", "Script"); ipItems.AddFile("File", TypeIdentifier.FileType, "", "Other", "Unknown"); // Folder types ipItems.AddFolder("App Folder", TypeIdentifier.Extension, ".app", "Folder-App", "App Folder"); ipItems.AddFolder("Photos", TypeIdentifier.FileName, "photos", "Folder-Image", "Image Folder"); ipItems.AddFolder("DCIM", TypeIdentifier.FileName, "dcim", "Folder-Image", "Image Folder"); ipItems.AddFolder("100APPLE", TypeIdentifier.FileName, "100apple", "Folder-Image", "Image Folder"); ipItems.AddFolder("Artwork", TypeIdentifier.FileName, "artwork", "Folder-Image", "Image Folder"); ipItems.AddFolder("Thumbs", TypeIdentifier.FileName, "thumbs", "Folder-Image", "Image Folder"); ipItems.AddFolder("Music", TypeIdentifier.FileName, "music", "Folder-Audio", "Audio Folder"); ipItems.AddFolder("Folder", TypeIdentifier.FileType, "", "Folder", "Folder"); // Other types ipItems.AddDevice("CharDevice", iPhone.FileTypes.CharDevice, "Device", "Character Device"); ipItems.AddDevice("BlockDevice", iPhone.FileTypes.BlockDevice, "Device", "Block Device"); ipItems.AddDevice("FIFO", iPhone.FileTypes.FIFO, "Device", "FIFO"); } return ipItems; }
private void LoadConfig() { try { ipItems = ipItems.LoadConfig(); } catch ( Exception err ) { Console.WriteLine(err.Message); } try { links = links.LoadConfig(); for ( Int32 i = 0; i < links.Nodes.Length; i++) { LinkNode link = (LinkNode)links.Nodes[i]; ToolStripMenuItem menuItem = new ToolStripMenuItem(); menuItem.Name = "link" + link.Name; menuItem.Text = link.Name; menuItem.ToolTipText = link.Description; menuItem.Tag = link.Location; menuItem.Click += new System.EventHandler(this.toolsLinksSelect); this.toolsFileFavorites.DropDownItems.Add(menuItem); } } catch ( Exception err ) { Console.WriteLine(err.Message); } }