public FileSystemInfoListViewItem( DroidExplorer.Core.IO.FileSystemInfo fsi ) : base(fsi.Name) { FileSystemInfo = fsi; string type = "Directory"; this.ImageIndex = (int)Icons.Directory; if ( fsi.IsLink ) { this.ImageIndex = fsi.IsDirectory ? (int)Icons.DirectoryLink : fsi.IsExecutable ? (int)Icons.ExecutableLink : (int)Icons.FileLink; type = "Link"; } if ( fsi is DroidExplorer.Core.IO.FileInfo ) { if ( fsi.IsExecutable ) { this.ImageIndex = (int)Icons.Executable; type = "Executable"; } else { this.ImageIndex = (int)Icons.File; type = "File"; } } this.SubItems.Add ( type ); this.SubItems.Add ( fsi.LastModificationDateTime.ToString ( ) ); this.SubItems.Add ( String.Format ( new FileSizeFormatProvider ( ), "{0:fs}", fsi.Size ) ); }
public DirectoryTreeNode( DroidExplorer.Core.IO.FileSystemInfo fsi ) : base(fsi.Name) { this.DirectoryInfo = fsi; if ( this.DirectoryInfo.IsLink && this.DirectoryInfo.IsDirectory ) { this.SelectedImageIndex = this.ImageIndex = 2; } else { this.SelectedImageIndex = this.ImageIndex = 0; } this.Nodes.Add ( new DummyTreeNode ( ) ); }
public ApkFileSystemInfoListViewItem( DroidExplorer.Core.IO.FileSystemInfo fsi, AaptBrandingCommandResult apkInfo ) : base(fsi) { this.ApkInfo = apkInfo; if ( !string.IsNullOrEmpty ( this.ApkInfo.Label ) ) { this.Text = ApkInfo.Label; } else { this.Text = fsi.Name; } this.FileName = fsi.Name; }
public override void Execute( IPluginHost pluginHost, DroidExplorer.Core.IO.LinuxDirectoryInfo currentDirectory, string[] args ) { string backupPath = System.IO.Path.Combine ( FolderManagement.TempFolder, "Backup" ); System.IO.DirectoryInfo appdir = pluginHost.CommandRunner.PullDirectory ( CommandRunner.APP_PUBLIC_PATH, backupPath ); System.IO.DirectoryInfo appdir2 = pluginHost.CommandRunner.PullDirectory ( CommandRunner.APP_SD_PUBLIC_PATH, backupPath ); System.IO.DirectoryInfo pappdir = pluginHost.CommandRunner.PullDirectory ( CommandRunner.APP_PRIVATE_PATH, backupPath ); System.IO.DirectoryInfo pappdir2 = pluginHost.CommandRunner.PullDirectory ( CommandRunner.APP_SD_PRIVATE_PATH, backupPath ); FastZip zip = new FastZip ( ); string path = Path.Combine ( System.IO.Path.GetDirectoryName ( this.GetType ( ).Assembly.Location ), "AppBackups" ); if ( !System.IO.Directory.Exists ( path ) ) { System.IO.Directory.CreateDirectory ( path ); } zip.CreateZip ( System.IO.Path.Combine ( path, string.Format ( CultureInfo.InvariantCulture, "AB{0}.zip", DateTime.Now.ToString ( "yyyyMMdd", CultureInfo.InvariantCulture ) ) ), backupPath, true, string.Empty ); }
public void Navigate( DroidExplorer.Core.IO.LinuxDirectoryInfo path ) { if ( NavigateThread != null && NavigateThread.IsAlive ) { try { NavigateThread.Abort ( ); } catch ( ThreadAbortException taex ) { } } NavigateThread = new Thread ( new ParameterizedThreadStart ( delegate ( object state ) { if ( state is DroidExplorer.Core.IO.LinuxDirectoryInfo ) { DroidExplorer.Core.IO.LinuxDirectoryInfo dir = state as DroidExplorer.Core.IO.LinuxDirectoryInfo; PrivateNavigate ( dir ); } } ) ); NavigateThread.Start ( path ); }
/// <summary> /// Executes the specified plugin host. /// </summary> /// <param name="pluginHost">The plugin host.</param> /// <param name="currentDirectory">The current directory.</param> /// <param name="args">The args.</param> public override void Execute( IPluginHost pluginHost, DroidExplorer.Core.IO.LinuxDirectoryInfo currentDirectory, string[] args ) { ConsoleWindow.StartPosition = FormStartPosition.Manual; if ( pluginHost != null && pluginHost.GetHostWindow() != null ) { int h = Screen.FromControl ( this.PluginHost.GetHostControl ( ) ).Bounds.Bottom - this.PluginHost.Bottom; if ( h > 100 ) { ConsoleWindow.Top = this.PluginHost.Bottom; ConsoleWindow.Left = this.PluginHost.Left; ConsoleWindow.Width = this.PluginHost.Width; ConsoleWindow.Height = Screen.FromControl ( this.PluginHost.GetHostControl ( ) ).WorkingArea.Bottom - this.PluginHost.Bottom; } else { ConsoleWindow.Top = Screen.PrimaryScreen.WorkingArea.Top; } if ( !this.ConsoleWindow.Visible ) { ConsoleWindow.Show ( pluginHost.GetHostWindow ( ) ); } } else { ConsoleWindow.ShowDialog ( ); }; }
/// <summary> /// Executes the specified plugin host. /// </summary> /// <param name="pluginHost">The plugin host.</param> /// <param name="currentDirectory">The current directory.</param> /// <param name="args">The args.</param> public override void Execute( IPluginHost pluginHost, DroidExplorer.Core.IO.LinuxDirectoryInfo currentDirectory, string[] args ) { if ( pluginHost != null && pluginHost.GetHostWindow() != null ) { Dialog.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; Dialog.Show ( pluginHost.GetHostWindow ( ) ); } else { Dialog.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; Dialog.ShowDialog ( ); } }
public FileSystemInfoListViewItem( DroidExplorer.Core.IO.FileSystemInfo fsi, int imageIndex ) : this(fsi) { this.ImageIndex = imageIndex; }
public void Navigate( DroidExplorer.Core.IO.LinuxDirectoryInfo path ) { }
/// <summary> /// Executes the specified plugin host. /// </summary> /// <param name="pluginHost">The plugin host.</param> /// <param name="currentDirectory">The current directory.</param> /// <param name="args">The args.</param> public override void Execute( IPluginHost pluginHost, DroidExplorer.Core.IO.LinuxDirectoryInfo currentDirectory, string[] args ) { if(PortManagerWindow == null ) { PortManagerWindow = new PortManagerForm ( pluginHost ); } if ( pluginHost != null && pluginHost.GetHostWindow ( ) != null ) { if ( !this.PortManagerWindow.Visible ) { PortManagerWindow.Show ( pluginHost.GetHostWindow ( ) ); } } else { PortManagerWindow.ShowDialog ( ); }; }
private void UpdateOrAddCpuProcessInfo( DroidExplorer.Core.IO.ProcessInfo processInfo ) { bool found = false; try { ListView.ListViewItemCollection items = null; if ( this.InvokeRequired ) { items = ( ListView.ListViewItemCollection )this.Invoke ( new GetListViewItemsDelegate ( this.GetListViewItems ), this.cpuInfo ); } else { items = GetListViewItems ( this.cpuInfo ); } for ( int i = 0; i < items.Count; i++ ) { CpuProcessInfoListViewItem lvi = null; if ( this.InvokeRequired ) { lvi = ( CpuProcessInfoListViewItem )this.Invoke ( new GetListViewItemDelegate ( this.GetListViewItem ), this.cpuInfo, i ); } else { lvi = GetListViewItem ( this.cpuInfo, i ) as CpuProcessInfoListViewItem; } DroidExplorer.Core.IO.ProcessInfo pi = lvi.ProcessInfo as DroidExplorer.Core.IO.ProcessInfo; if ( processInfo.PID == pi.PID ) { found = true; //cpu, name,thread,vss,user if ( this.InvokeRequired ) { this.Invoke ( new GenericDelegate ( lvi.SubItems.Clear ) ); this.Invoke ( new SetListViewItemTextDelegate ( this.SetListViewItemText ), lvi, processInfo.PID.ToString ( ) ); this.Invoke ( new AddListViewSubItemDelegate ( this.AddListViewSubItem ), lvi, string.Format ( CultureInfo.InvariantCulture, "{0}%", processInfo.Cpu ) ); this.Invoke ( new AddListViewSubItemDelegate ( this.AddListViewSubItem ), lvi, processInfo.Name ); this.Invoke ( new AddListViewSubItemDelegate ( this.AddListViewSubItem ), lvi, processInfo.Thread.ToString ( ) ); this.Invoke ( new AddListViewSubItemDelegate ( this.AddListViewSubItem ), lvi, string.Format ( CultureInfo.InvariantCulture, "{0}K", processInfo.Vss ) ); this.Invoke ( new AddListViewSubItemDelegate ( this.AddListViewSubItem ), lvi, string.Format ( CultureInfo.InvariantCulture, "{0}K", processInfo.Rss ) ); this.Invoke ( new AddListViewSubItemDelegate ( this.AddListViewSubItem ), lvi, processInfo.User ); } else { lvi.SubItems.Clear ( ); SetListViewItemText ( lvi, processInfo.PID.ToString ( ) ); AddListViewSubItem ( lvi, string.Format ( CultureInfo.InvariantCulture, "{0}%", processInfo.Cpu ) ); AddListViewSubItem ( lvi, processInfo.Name ); AddListViewSubItem ( lvi, processInfo.Thread.ToString ( ) ); AddListViewSubItem ( lvi, string.Format ( CultureInfo.InvariantCulture, "{0}K", processInfo.Vss ) ); AddListViewSubItem ( lvi, string.Format ( CultureInfo.InvariantCulture, "{0}K", processInfo.Rss ) ); AddListViewSubItem ( lvi, processInfo.User ); } } } if ( !found ) { CpuProcessInfoListViewItem lvi = new CpuProcessInfoListViewItem ( processInfo ); if ( InvokeRequired ) { this.Invoke ( new AddListViewItemDelegate ( AddListViewItem ), this.cpuInfo, lvi ); } else { AddListViewItem ( this.cpuInfo, lvi ); } } } catch ( ObjectDisposedException ode ) { } catch ( Exception ex ) { } }
public InstallUninstallException( DroidExplorer.Core.UI.InstallDialog.InstallMode mode, string message, string content ) : base(message) { this.Mode = mode; this.Content = content; }
public void Pull( DroidExplorer.Core.IO.FileInfo remoteFile, System.IO.FileInfo destFile ) { PrivatePull ( remoteFile, destFile ); this.Show ( ); }
/// <summary> /// Executes the specified plugin host. /// </summary> /// <param name="pluginHost">The plugin host.</param> /// <param name="currentDirectory">The current directory.</param> /// <param name="args">The args.</param> public override void Execute( IPluginHost pluginHost, DroidExplorer.Core.IO.LinuxDirectoryInfo currentDirectory, string[] args ) { Arguments arguments = new Arguments ( args ?? new string[ ] { } ); string file = string.Empty; if ( arguments.Contains ( "file" ) ) { file = arguments[ "file" ]; } if ( string.IsNullOrEmpty ( file ) ) { DroidExplorer.Core.UI.OpenFileDialog ofd = new DroidExplorer.Core.UI.OpenFileDialog ( ); ofd.Title = "Select Recovery Image"; ofd.Filter = "Recovery Image|*.img|All Files (*.*)|*.*"; ofd.FilterIndex = 0; if ( ofd.ShowDialog ( ) == DialogResult.OK ) { file = ofd.FileName; } } if ( string.IsNullOrEmpty ( file ) ) { return; } else { CommandRunner.Instance.FlashImage ( file ); if ( PluginHost != null ) { int result = PluginHost.ShowCommandBox ( "Reboot Now?", "Recovery image has been flashed to the device.", string.Empty, string.Empty, string.Empty, string.Empty, "Reboot Device|Reboot Device in Recovery mode|Do not reboot device", false, MessageBoxIcon.Question, MessageBoxIcon.None ); switch ( result ) { case 0: // Reboot CommandRunner.Instance.Reboot ( ); break; case 1: // reboot recovery CommandRunner.Instance.RebootRecovery ( ); break; } } } }
public ApkFileSystemInfoListViewItem( DroidExplorer.Core.IO.FileSystemInfo fsi, int imageIndex, AaptBrandingCommandResult apkInfo ) : this(fsi, apkInfo) { this.ImageIndex = imageIndex; }
/// <summary> /// Executes the specified plugin host. /// </summary> /// <param name="pluginHost">The plugin host.</param> /// <param name="currentDirectory">The current directory.</param> public override void Execute( IPluginHost pluginHost, DroidExplorer.Core.IO.LinuxDirectoryInfo currentDirectory, string[] args ) { if ( screenShotForm == null || screenShotForm.IsDisposed ) { screenShotForm = new ScreenShotForm ( pluginHost ); } if ( pluginHost != null && pluginHost.GetHostWindow ( ) != null ) { Screen screen = Screen.FromControl ( pluginHost.GetHostControl ( ) ); int r = screen.Bounds.Right - ( pluginHost.Left + pluginHost.Width ); screenShotForm.StartPosition = FormStartPosition.Manual; if ( r > 100 ) { screenShotForm.Location = new Point ( pluginHost.Left + pluginHost.Width, pluginHost.Top ); } else { screenShotForm.Top = Screen.PrimaryScreen.WorkingArea.Top; screenShotForm.Left = Screen.PrimaryScreen.WorkingArea.Left; } if ( !screenShotForm.Visible ) { screenShotForm.Show ( pluginHost.GetHostWindow ( ) ); } } else { screenShotForm.Top = Screen.PrimaryScreen.WorkingArea.Top; screenShotForm.Left = Screen.PrimaryScreen.WorkingArea.Left; screenShotForm.ShowDialog ( ); } }
public override void Execute( IPluginHost pluginHost, DroidExplorer.Core.IO.LinuxDirectoryInfo currentDirectory, string[] args ) { ProcessViewer.StartPosition = FormStartPosition.Manual; ProcessViewer.Left = this.PluginHost.Right; ProcessViewer.Top = this.PluginHost.Top; if ( !ProcessViewer.Visible ) { ProcessViewer.Show ( this.PluginHost.GetHostWindow ( ) ); } }
/// <summary> /// Executes the specified plugin host. /// </summary> /// <param name="pluginHost">The plugin host.</param> /// <param name="currentDirectory">The current directory.</param> /// <param name="args">The args.</param> public override void Execute( IPluginHost pluginHost, DroidExplorer.Core.IO.LinuxDirectoryInfo currentDirectory, string[] args ) { if ( RunningThread != null && RunningThread.IsAlive ) { return; } OpenFileDialog ofd = new OpenFileDialog ( ); ofd.Title = "Select zip file to sign"; ofd.Filter = "Zip files|*.zip|All Files (*.*)|*.*"; ofd.FilterIndex = 0; ofd.CheckFileExists = true; if ( ofd.ShowDialog ( ) == DialogResult.OK ) { RunningThread = new Thread ( new ParameterizedThreadStart ( delegate ( object obj ) { if ( obj is string ) { SignZip ( ( string )obj ); } } ) ); RunningThread.Start ( ofd.FileName ); } }
/// <summary> /// Executes the specified plugin host. /// </summary> /// <param name="pluginHost">The plugin host.</param> /// <param name="currentDirectory">The current directory.</param> /// <param name="args">The args.</param> public override void Execute( IPluginHost pluginHost, DroidExplorer.Core.IO.LinuxDirectoryInfo currentDirectory, string[] args ) { LogCatConsole console = new LogCatConsole ( pluginHost ); console.Top = Screen.PrimaryScreen.WorkingArea.Top; console.Left = Screen.PrimaryScreen.WorkingArea.Left; if ( pluginHost.GetHostWindow ( ) == null ) { Application.Run ( console ); } else { console.Show ( ); } }
/// <summary> /// Executes the specified plugin host. /// </summary> /// <param name="pluginHost">The plugin host.</param> /// <param name="currentDirectory">The current directory.</param> /// <param name="args">The args.</param> public override void Execute( IPluginHost pluginHost, DroidExplorer.Core.IO.LinuxDirectoryInfo currentDirectory, string[] args ) { Arguments arguments = new Arguments ( args ?? new string[] { "/install" } ); string[] apkFiles = new string[] { }; if ( arguments.Contains ( "apk" ) ) { apkFiles = arguments["apk"].Split ( new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries ); } else { System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog ( ); ofd.Title = "Select Android Applications"; ofd.Filter = "Android Applications|*.apk"; ofd.Multiselect = true; if ( ofd.ShowDialog ( ) == System.Windows.Forms.DialogResult.OK ) { apkFiles = ofd.FileNames; new BatchInstallerDialog ( DroidExplorer.Core.UI.InstallDialog.InstallMode.Install, new List<string> ( apkFiles ) ).ShowDialog ( ); } else { return; } } }
private bool IsFilterMatch( DroidExplorer.Core.IO.FileSystemInfo fsi, string filter ) { string[] split = filter.Split ( ";".ToCharArray ( ), StringSplitOptions.RemoveEmptyEntries ); foreach ( var item in split ) { if ( string.Compare ( item, "*", true ) == 0 || string.Compare ( item, "*.*", true ) == 0 ) { return true; } Regex regex = new Regex ( item.Replace ( ".", "\\." ).Replace ( "*", ".*" ).Replace ( "?", ".{1}" ), RegexOptions.Singleline | RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace ); if ( regex.IsMatch ( fsi.Name ) ) { return true; } } return false; }
private void PrivateNavigate( DroidExplorer.Core.IO.LinuxDirectoryInfo path ) { this.CurrentPath = path; string pathName = DroidExplorer.Core.IO.Path.GetDirectoryName ( path.FullName ); if ( string.IsNullOrEmpty ( pathName ) ) { pathName = CommandRunner.Instance.GetSerialNumber ( ); } if ( this.InvokeRequired ) { this.Invoke ( new GenericDelegate ( this.files.Items.Clear ) ); this.Invoke ( new SetComboBoxExDisplayValueDelegate ( this.SetComboBoxExDisplayValue ), this.selectedPath, pathName ); } else { this.files.Items.Clear ( ); SetComboBoxExDisplayValue ( this.selectedPath, pathName ); } List<DroidExplorer.Core.IO.FileSystemInfo> fsis = CommandRunner.Instance.GetDirectoryContents ( path.FullName ); foreach ( var item in fsis ) { FileSystemInfoListViewItem lvi = new FileSystemInfoListViewItem ( item ); if ( ( item.IsDirectory && !item.IsPipe && !item.IsSocket ) || ( IsFilterMatch ( item, SelectedFilter ) && !item.IsPipe && !item.IsSocket ) ) { if ( !item.IsDirectory && !item.IsExecutable ) { string ext = System.IO.Path.GetExtension ( lvi.FileSystemInfo.Name ); string keyName = ext.ToLower ( ); if ( keyName.StartsWith ( "/" ) ) { keyName = keyName.Substring ( 1 ); } keyName = keyName.Replace ( "/", "." ); if ( !string.IsNullOrEmpty ( ext ) ) { if ( string.Compare ( ext, ".apk", true ) == 0 ) { AaptBrandingCommandResult result = CommandRunner.Instance.GetApkInformation ( item.FullPath ); lvi = new ApkFileSystemInfoListViewItem ( item, result ); keyName = lvi.FileSystemInfo.FullPath; if ( keyName.StartsWith ( "/" ) ) { keyName = keyName.Substring ( 1 ); } keyName = keyName.Replace ( "/", "." ); if ( !SystemImageListHost.Instance.SystemIcons.ContainsKey ( keyName ) ) { // get apk and extract the app icon Image img = CommandRunner.Instance.GetLocalApkIconImage ( result.LocalApk ); if ( img == null ) { img = DroidExplorer.Resources.Images.package32; } else { using ( System.IO.MemoryStream stream = new System.IO.MemoryStream ( ) ) { string lpath = System.IO.Path.GetDirectoryName ( this.GetType ( ).Assembly.Location ); string fileName = System.IO.Path.Combine ( System.IO.Path.Combine ( CommandRunner.Settings.UserDataDirectory, Cache.APK_IMAGE_CACHE ), string.Format ( "{0}.png", keyName ) ); img.Save ( stream, ImageFormat.Png ); stream.Position = 0; using ( System.IO.FileStream fs = new System.IO.FileStream ( fileName, System.IO.FileMode.Create, System.IO.FileAccess.Write ) ) { byte[] buffer = new byte[2048]; int readBytes = 0; while ( ( readBytes = stream.Read ( buffer, 0, buffer.Length ) ) != 0 ) { fs.Write ( buffer, 0, readBytes ); } } } } SystemImageListHost.Instance.AddFileTypeImage ( keyName, img, img ); } if ( this.InvokeRequired ) { this.Invoke ( new SetListViewItemImageIndexDelegate ( SetListViewItemImageIndex ), lvi, SystemImageListHost.Instance.SystemIcons[keyName] ); } else { SetListViewItemImageIndex ( lvi, SystemImageListHost.Instance.SystemIcons[keyName] ); } } else { if ( !SystemImageListHost.Instance.SystemIcons.ContainsKey ( ext.ToLower ( ) ) ) { // add index and icon Image sico; Image lico; if ( this.InvokeRequired ) { int iconIndex = (int)this.Invoke ( new GetSystemIconIndexDelegate ( GetSystemIconIndex ), new object[] { SystemImageListHost.Instance.SmallSystemImageList, item.Name } ); sico = (Image)this.Invoke ( new GetSystemBitmapDelegate ( GetSystemBitmap ), new object[] { SystemImageListHost.Instance.SmallSystemImageList, iconIndex } ); lico = (Image)this.Invoke ( new GetSystemBitmapDelegate ( GetSystemBitmap ), new object[] { SystemImageListHost.Instance.LargeSystemImageList, iconIndex } ); } else { int iconIndex = SystemImageListHost.Instance.SmallSystemImageList.IconIndex ( item.Name, false ); sico = GetSystemBitmap ( SystemImageListHost.Instance.SmallSystemImageList, iconIndex ); lico = GetSystemBitmap ( SystemImageListHost.Instance.LargeSystemImageList, iconIndex ); } SystemImageListHost.Instance.AddFileTypeImage ( ext.ToLower ( ), sico, lico ); } } if ( this.InvokeRequired ) { this.Invoke ( new SetListViewItemImageIndexDelegate ( this.SetListViewItemImageIndex ), new object[] { lvi, SystemImageListHost.Instance.SystemIcons[keyName] } ); } else { SetListViewItemImageIndex ( lvi, SystemImageListHost.Instance.SystemIcons[keyName] ); } } } if ( this.InvokeRequired ) { this.Invoke ( new AddListViewItemDelegate ( AddListViewItem ), this.files, lvi ); } else { AddListViewItem ( this.files, lvi ); } } } if ( this.InvokeRequired ) { this.Invoke ( new AutoResizeColumnsDelegate ( AutoResizeColumns ), this.files, ColumnHeaderAutoResizeStyle.ColumnContent ); } else { AutoResizeColumns ( this.files, ColumnHeaderAutoResizeStyle.ColumnContent ); } }
private void PrivatePull( DroidExplorer.Core.IO.FileInfo remoteFile, System.IO.FileInfo destFile ) { this.TotalItems = 1; this.TotalSize = remoteFile.Size; SetFromStatus ( CommandRunner.Instance.DefaultDevice, remoteFile.FullPath, Environment.MachineName, destFile.Directory.Name ); SpeedTest ( ); SetItemsRemainingStatus ( this.TotalItems.ToString ( ) ); SetCopyInfoLabel ( ); SetTitle ( ); new Thread ( delegate ( ) { try { System.IO.FileInfo result = CommandRunner.Instance.PullFile ( remoteFile.FullPath ); if ( !destFile.Directory.Exists ) { destFile.Directory.Create ( ); } if ( string.Compare ( destFile.FullName, result.FullName, true ) != 0 ) { result.CopyTo ( destFile.FullName, true ); } this.DialogResult = DialogResult.OK; this.OnTransferComplete ( EventArgs.Empty ); } catch ( Exception ex ) { TransferException = ex; this.DialogResult = DialogResult.Abort; this.OnTransferError ( EventArgs.Empty ); } finally { try { if ( !this.IsDisposed ) { if ( this.InvokeRequired ) { this.Invoke ( new GenericDelegate ( this.Close ) ); } else { this.Close ( ); } } } catch (Exception) { } } } ).Start ( ); }
private DirectoryTreeNode FindNodeFromPath( DroidExplorer.Core.IO.LinuxDirectoryInfo path ) { directoryTree.ExpandToPath ( path.FullName ); DirectoryTreeNode dtn = directoryTree.FindNodeFromPath ( path.FullName ); return dtn; }
public DialogResult PullDialog( DroidExplorer.Core.IO.FileInfo remoteFile, System.IO.FileInfo destFile ) { PrivatePull ( remoteFile, destFile ); return this.ShowDialog ( ); }
private void NavigateToPath( DroidExplorer.Core.IO.LinuxDirectoryInfo path ) { NavigateToPath ( path, true ); }
/// <summary> /// Executes the specified plugin host. /// </summary> /// <param name="pluginHost">The plugin host.</param> /// <param name="currentDirectory">The current directory.</param> /// <param name="args">The args.</param> public override void Execute( IPluginHost pluginHost, DroidExplorer.Core.IO.LinuxDirectoryInfo currentDirectory, string[] args ) { Arguments arguments = new Arguments ( args ?? new string[] { "/install" } ); string apkFile = string.Empty; var apkArg = arguments.Contains ( "apk" ) ? arguments["apk"] : string.Empty; // check that we have a file, and that it exists. if ( !string.IsNullOrWhiteSpace(apkArg) && System.IO.File.Exists(apkArg) ) { apkFile = apkArg; } else { System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog ( ); ofd.Title = "Select Android Application"; ofd.Filter = "Android Applications|*.apk"; ofd.CheckFileExists = true; ofd.Multiselect = false; if ( ofd.ShowDialog ( ) == DialogResult.OK ) { apkFile = ofd.FileName; } else { return; } } if ( File.Exists ( apkFile ) ) { try { var apkInfo = this.PluginHost.CommandRunner.GetLocalApkInformation ( apkFile ); var id = new InstallDialog ( this.PluginHost, arguments.Contains( "uninstall" ) ? InstallDialog.InstallMode.Uninstall : InstallDialog.InstallMode.Install, apkInfo ); if ( pluginHost != null && pluginHost.GetHostWindow() != null ) { id.Show ( ); } else { id.ShowInTaskbar = true; id.ShowDialog ( ); } } catch ( Exception ex ) { MessageBox.Show ( ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1 ); this.LogError ( ex.Message, ex ); } } }
private void NavigateToPath( DroidExplorer.Core.IO.LinuxDirectoryInfo path, bool addHistory ) { if ( !navigating ) { if ( path.FullName.StartsWith ( "./" ) ) { path = new DroidExplorer.Core.IO.LinuxDirectoryInfo ( path.FullName.Substring ( 1 ) ); } //directoryTree.ExpandToPath ( path.FullName ); DirectoryTreeNode dtn = FindNodeFromPath ( path ); if ( dtn != null ) { navigating = true; PluginLoader.CurrentPath = path; if ( InvokeRequired ) { Invoke ( ( (Action)( ( ) => { directoryTree.SelectedNode = dtn; } ) ) ); } else { directoryTree.SelectedNode = dtn; } this.breadcrumbBar.ViewMode = BreadcrumbBar.ViewModes.Nodes; this.breadcrumbBar.Nodes.Clear ( ); string name = DroidExplorer.Core.IO.Path.GetDirectoryName ( path.FullName ); string device = KnownDeviceManager.Instance.GetDeviceFriendlyName ( string.IsNullOrEmpty ( CommandRunner.Instance.DefaultDevice ) ? CommandRunner.Instance.GetSerialNumber ( ) : CommandRunner.Instance.DefaultDevice ); Image itemImage = null; if ( string.IsNullOrEmpty ( name ) ) { itemImage = DroidExplorer.Resources.Images.device_16x16; name = device; } this.breadcrumbBar.Nodes.Add ( new BreadcrumbBarNode ( device, string.Empty, delegate ( object sender, EventArgs e ) { BreadcrumbBarNode item = sender as BreadcrumbBarNode; }, this.breadcrumbBar.PathSeparator ) ); StringBuilder tpath = new StringBuilder ( ); foreach ( string s in path.FullName.Split ( new string[] { this.breadcrumbBar.PathSeparator }, StringSplitOptions.RemoveEmptyEntries ) ) { tpath.AppendFormat ( "{0}{1}", s, this.breadcrumbBar.PathSeparator ); this.breadcrumbBar.Nodes.Add ( new BreadcrumbBarNode ( s, s, delegate ( object sender, EventArgs e ) { BreadcrumbBarNode item = sender as BreadcrumbBarNode; }, tpath ) ); } if ( addHistory ) { if ( !explorerNavigation.History.ContainsKey ( path.FullName ) ) { this.explorerNavigation.AddHistory ( new ExplorerNavigationHistoryItem ( name, path.FullName, itemImage, delegate ( object sender, EventArgs e ) { ExplorerNavigationHistoryItem item = ( sender as ExplorerNavigationHistoryItem ); if ( item.Tag is DroidExplorer.Core.IO.LinuxDirectoryInfo ) { NavigateToPath ( item.Tag as DroidExplorer.Core.IO.LinuxDirectoryInfo, false ); } }, path ), true ); } else { this.explorerNavigation.HistoryGo ( this.explorerNavigation.History.IndexOf ( path.FullName ) ); } } //this.breadcrumbBar.FullPath = string.Format ( "({0}){1}", device, path.FullName ); this.breadcrumbBar.Root.Image = DroidExplorer.Resources.Images.device_16x16; //dtn.EnsureVisible ( ); List<DroidExplorer.Core.IO.FileSystemInfo> fsiList = dtn.OnAfterSelect ( CommandRunner.Instance ); folderUpToolStripButton.Enabled = path.Parent != null; CurrentDirectory = new DroidExplorer.Core.IO.LinuxDirectoryInfo ( dtn.LinuxPath ); if ( filesThread != null && ( filesThread.IsAlive || filesThread.ThreadState == ThreadState.Running ) ) { filesThread.Abort ( ); } filesThread = new Thread ( new ParameterizedThreadStart ( ThreadedBuildListViewItems ) ); filesThread.Start ( fsiList ); if ( !dtn.IsExpanded ) { dtn.Expand ( ); } } else { TaskDialog.MessageBox ( "Address Bar", string.Format ( CultureInfo.InvariantCulture, Resources.Strings.AddressBarPathNotFoundMessage, path.FullName ), string.Empty, TaskDialogButtons.OK, SysIcons.Error ); this.breadcrumbBar.ViewMode = BreadcrumbBar.ViewModes.Text; } navigating = false; } }
/// <summary> /// Opens the specified file. /// </summary> /// <param name="file">The file.</param> public void Open(DroidExplorer.Core.IO.FileInfo file) { Open ( file.FullPath ); }
public override void Execute( IPluginHost pluginHost, DroidExplorer.Core.IO.LinuxDirectoryInfo currentDirectory, string[ ] args ) { }