Example #1
0
        /// <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"];
            }
            ShellConsole console = new ShellConsole(pluginHost);

            console.Top  = Screen.PrimaryScreen.WorkingArea.Top;
            console.Left = Screen.PrimaryScreen.WorkingArea.Left;

            if (!string.IsNullOrEmpty(file))
            {
                console.Run(file);
            }
            if (pluginHost != null && pluginHost.GetHostWindow() != null)
            {
                console.Show();
            }
            else
            {
                console.ShowInTaskbar = true;
                console.ShowDialog();
            }
        }
Example #2
0
        /// <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;
                }
            }
        }
Example #3
0
 /// <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( );
     };
 }
Example #4
0
        /// <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( );
            }
        }
Example #5
0
 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( ));
     }
 }
Example #6
0
 /// <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( );
     }
 }
Example #7
0
        /// <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( );
            }
        }
Example #8
0
        /// <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);
                }
            }
        }
Example #9
0
        /// <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;
                    }
                }
            }
        }
Example #10
0
        /// <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);
            }
        }
 public override void Execute(IPluginHost pluginHost, DroidExplorer.Core.IO.LinuxDirectoryInfo currentDirectory, string[] args)
 {
 }