コード例 #1
0
        private void ExecuteDownload(object arg)
        {
            Log.i("------------------- Run Download -------------------");
            if (this.GMSignedEmer == true && ImageItem.SelFirehose == 0)
            {
                //Log.MsgBox("This is a GM signed image. Please check the firehose file.");
                //return;
            }
            if (this.GMSignedEmer == false && ImageItem.SelFirehose == 1)
            {
                //if (ImageItem.Dir.Contains("s.lge"))
                //    Log.MsgBox("This is a lge signed image. Please check the firehose file.");
                //else
                //    Log.MsgBox("This is a non signed image. Please check the firehose file.");
                //return;
            }
            try
            {
                this.TotalProgress = 0;
                this.FileProgress  = 0;
                this.TotalStatus   = "";

                string BaudrateInfo    = "\nEmergency Download나 Image Dump를 수행할 때에는\n다음과 같이 Baudrate을 설정해야 합니다.\n1. Gen11 TCP19 GA Release Version : 115,200 bps\n2. Others : 921,600 bps\n\nYou must set the baudrate as following\nif you are going to do \"Emergency Download\" or \"Image Dump\"\n1. Gen11 TCP19 GA Release Version : 115,200 bps\n2. Others : 921,600 bps\n";
                string BaudrateCaption = "Baudrate Info";
                MController.InfoPopup(BaudrateInfo, BaudrateCaption); // jwoh Baudrate Info popup

                // dispse target wrapper
                if (_targetIf != null)
                {
                    _targetIf.Dispose();
                    _targetIf = null;
                }

                // reset progress value
                int useCount = 0;
                _listItems.ForEach(x => {
                    x.Progress = 0;    if (x.Use)
                    {
                        useCount++;
                    }
                });

                if (useCount == 0)
                {
                    Log.MsgBox("No images will be downloading.");
                    return;
                }
                // save configuration xml for library
                // set fota erase option
                var fxitem = _listItems.SingleOrDefault(fx => fx.Name == "FOTA_SELFTEST");
                if (fxitem != null)
                {
                    fxitem.Erase = this.FotaErase;
                }
                if (!ImageItem.Save(Helper.TempConfigFile(this), _listItems))
                {
                    Log.MsgBox("Error: saving configuration.xml");
                    return;
                }
                // initialize target wrapper
                _targetIf              = new TargetWrapper();
                _targetIf.AppLogEvent += _targetIf_AppLogEvent;
                if (!_targetIf.Load(Helper.ProtocolDllPath))
                {
                    Log.MsgBox("Error: loading protocol library");
                    return;
                }
                _targetIf.AppProgressEvent += TargetIf_AppProgressEvent;
                // wait qdloader mode
                if (Pages.WaitPortBox.Wait(Models.TabType.Emergency, this) == false)
                {
                    return;
                }
                // start download
                FbMode = FBMode.Download;
                this.DownloadCommand.RaiseCanExecuteChanged();

                // Print Download option to log
                Log.i("------------------- Prepare : options list -------------------");
                Log.i("[Option-1] All Erase:{0}, Reboot:{1}, LogLevel:{2}", ImageItem.AllErase, ImageItem.Reset, Log.LogLevel);
                Log.i("[Option-2] Erase except EFS:{0}", ImageItem.SkipEraseEfs);

                System.Threading.Thread.Sleep(3 * 1000); // for micom usb stable control.
                _targetIf.RundDownload(this.CurrentPort.Name, Helper.TempConfigFile(this));
            }
            catch (Exception e)
            {
                Log.e("Command (Download) invoke Error, Exception: {1}", e);
            }
        }
コード例 #2
0
ファイル: DumpModel.cs プロジェクト: binh-chu/Download-Gen11
        private void ExecuteDump(object arg)
        {
            Log.i("------------------- Run Dump -------------------");
            string downDir = ImageItem.Dir;

            try
            {
                this.TotalProgress = 0;
                this.FileProgress  = 0;
                this.TotalStatus   = "";

                string BaudrateInfo    = "\nEmergency Download나 Image Dump를 수행할 때에는\n다음과 같이 Baudrate을 설정해야 합니다.\n1. Gen11 TCP19 GA Release Version : 115,200 bps\n2. Others : 921,600 bps\n\nYou must set the baudrate as following\nif you are going to do \"Emergency Download\" or \"Image Dump\"\n1. Gen11 TCP19 GA Release Version : 115,200 bps\n2. Others : 921,600 bps\n";
                string BaudrateCaption = "Baudrate Info";
                MController.InfoPopup(BaudrateInfo, BaudrateCaption); // jwoh Baudrate Info popup

                // dispse target wrapper
                if (_targetIf != null)
                {
                    _targetIf.Dispose();
                    _targetIf = null;
                }

                // reset progress value
                _listItems.ForEach(x => {
                    x.Progress = 0;
                    x.Dump     = true;
                });

                // input save dir
                var fdlg = new System.Windows.Forms.FolderBrowserDialog()
                {
                    SelectedPath        = Properties.Settings.Default.saveDir,
                    ShowNewFolderButton = true,
                };
                if (fdlg.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                {
                    return;
                }


                Properties.Settings.Default.saveDir = fdlg.SelectedPath;
                ImageItem.Dir = fdlg.SelectedPath;

                // save configuration xml for library
                if (!ImageItem.Save(Helper.TempConfigFile(this), _listItems))
                {
                    Log.MsgBox("Error: saving configuration.xml");
                    return;
                }

                // initialize target wrapper
                _targetIf              = new TargetWrapper();
                _targetIf.AppLogEvent += _targetIf_AppLogEvent;
                if (!_targetIf.Load(Helper.ProtocolDllPath))
                {
                    Log.MsgBox("Error: loading protocol library");
                    return;
                }
                _targetIf.AppProgressEvent += TargetIf_AppProgressEvent;
                // wait qdloader mode
                if (Pages.WaitPortBox.Wait(Models.TabType.Dump, this) == false)
                {
                    return;
                }
                // start download
                FbMode = FBMode.Dump;
                this.DumpCommand.RaiseCanExecuteChanged();

                _targetIf.RundReadback(this.CurrentPort.Name, Helper.TempConfigFile(this));
            }
            catch (Exception e)
            {
                Log.e("Command (Dump) invoke Error, Exception: {1}", e);
            }
            finally
            {
                ImageItem.Dir = downDir;
            }
        }