예제 #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"];
            }

            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;
                    }
                }
            }
        }
예제 #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[ ] { } );
              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;
              }
            }
              }
        }