コード例 #1
0
        bool LoadConfigXml(string aXmlPath)
        {
            if (File.Exists(aXmlPath))
            {
                var dir   = new FileInfo(aXmlPath).DirectoryName;
                var items = ImageItem.Load(aXmlPath);

                if (items == null || items.Count == 0)
                {
                    Log.e("Selected '{0}' it will not be processed. Please choose a valid file ({1}).", aXmlPath, Helper.ConfigXmlFileName);
                    return(false);
                }
                _listItems = items;

                // configuration.xml을 appdata 영역으로 복사한다. (다중 사용자 접근, 읽기 전용 등 문제가 없도록)
                if (File.Exists(Helper.TempConfigFile(this)))
                {
                    File.Delete(Helper.TempConfigFile(this));
                }
                File.Copy(aXmlPath, Helper.TempConfigFile(this));

                // multi 모드용 각 타겟용 복사된 환경 설정 파일들 제거.
                if (Directory.Exists(Helper.MultiConfigDir))
                {
                    Directory.Delete(Helper.MultiConfigDir, true);
                }

                //  없는 파일 파티션은 지우지 않고 파일이 있는 부분만 지운다.
                Log.v("=== Configuration Settings ===");
                ImageItem.Dir = dir;

                foreach (var item in _listItems)
                {
                    item.IsExist = File.Exists(Path.Combine(ImageItem.Dir, item.FileName));
                    item.Use     = item.IsExist;
                    item.Erase   = item.Use;
                    if (item.Name == "FOTA_SELFTEST")
                    {
                        if (item.FileName.Contains("none_secure.img"))
                        {
                            if (aXmlPath.Contains("s.lge"))
                            {
                                this.GMSignedMulti = false;
                            }
                            else
                            {
                                this.GMSignedMulti = true;
                            }
                        }
                        else
                        {
                            this.GMSignedMulti = false;
                        }
                    }
                    Log.v("Partition ID={0} Name={1}, FileName={2}", item.Id, item.Name,
                          item.Use ? item.FileName : "(not exist!)");
                }
                this.LogLevel = Log.LogLevel;
                Log.v("Erase: {0}", ImageItem.AllErase ? "All" : "Partial");
                Log.i("Configuration is loaded.");

                InvokePropertyChanged("UsedItems");

                return(true);
            }

            Log.e("Configuration loading is failed.");
            return(false);
        }
コード例 #2
0
        private void ExecuteDump(object arg)
        {
            Log.i("------------------- Run Dump -------------------");
            string downDir = ImageItem.Dir;

            try
            {
                this.TotalProgress = 0;
                this.FileProgress  = 0;
                this.TotalStatus   = "";
                // 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.Emergency, 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;
            }
        }
コード例 #3
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);
            }
        }
コード例 #4
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;
            }
        }
コード例 #5
0
ファイル: DumpModel.cs プロジェクト: binh-chu/Download-Gen11
        private void ExecuteDownload(object arg)
        {
            Log.i("------------------- Run Download -------------------");
            try
            {
                this.TotalProgress = 0;
                this.FileProgress  = 0;
                this.TotalStatus   = "";
                // 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.Dump, 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);
            }
        }
コード例 #6
0
ファイル: DumpModel.cs プロジェクト: binh-chu/Download-Gen11
        bool SetConfigXml(string aXmlPath)
        {
            if (File.Exists(aXmlPath))
            {
                var dir = new FileInfo(aXmlPath).DirectoryName;
                _listItems = ImageItem.Load(aXmlPath);

                if (_listItems == null || _listItems.Count == 0)
                {
                    Log.e("Selected '{0}' it will not be processed. Please choose a valid file ({1}).", aXmlPath, Helper.ConfigXmlFileName);
                    return(false);
                }

                // configuration.xml을 appdata 영역으로 복사한다. (다중 사용자 접근, 읽기 전용 등 문제가 없도록)
                if (File.Exists(Helper.TempConfigFile(this)))
                {
                    File.Delete(Helper.TempConfigFile(this));
                }

                File.Copy(aXmlPath, Helper.TempConfigFile(this));

                //  없는 파일 파티션은 지우지 않고 파일이 있는 부분만 지운다.
                Log.v("=== Configuration Settings ===");
                ImageItem.Dir = dir;

                foreach (var item in _listItems)
                {
                    item.IsExist = File.Exists(Path.Combine(ImageItem.Dir, item.FileName));
                    item.Use     = item.IsExist;
                    item.Erase   = item.Use;
                    Log.v("Partition ID={0} Name={1}, FileName={2}", item.Id, item.Name,
                          item.Use ? item.FileName : "(not exist!)");
                    // jwoh_1130 backup partition dump [
                    if (item.Name == "TZ_2")
                    {
                        item.FileName = "tz2.mbn";
                    }
                    else if (item.Name == "RPM_2")
                    {
                        item.FileName = "rpm2.mbn";
                    }
                    else if (item.Name == "ABOOT_2")
                    {
                        item.FileName = "appsboot2.mbn";
                    }
                    else if (item.Name == "MDMBOOT_2")
                    {
                        item.FileName = "mdm9640-boot2.img";
                    }
                    else if (item.Name == "MODEM_2")
                    {
                        item.FileName = "NON-HLOS2.ubi";
                    }
                    else if (item.Name == "SYSTEM_2")
                    {
                        item.FileName = "mdm9640-sysfs2.ubi";
                    }
                    else if (item.Name == "PROMPT_PLAY_2")
                    {
                        item.FileName = "mdm9640-prompt_play2.ubi";
                    }
                    else if (item.Name == "USERDATA_SEC_2")
                    {
                        item.FileName = "mdm9640-userdata_sec2.ubi";
                    }
                    else if (item.Name == "MICOM2")
                    {
                        item.FileName = "mdm9640-micom2.ubi";
                    }
                    // jwoh_1130 backup partition dump ]
                }
                this.LogLevel = Log.LogLevel;
                Log.v("Erase: {0}", ImageItem.AllErase ? "All" : "Partial");
                Log.i("Configuration is loaded.");

                InvokePropertyChanged("UsedItems");

                return(true);
            }

            Log.e("Configuration loading is failed.");
            return(false);
        }