예제 #1
0
        private void pull()
        {
            PushPullFiles pushPull = new PushPullFiles();
            Utilities     util     = new Utilities();

            try
            {
                util.Check_devices();
                pushPull.Pull(true);
            }
            catch (Exception ex)
            {
                Console.Write(ex);
            }
        }
예제 #2
0
        private void pushCalib(string[] results)
        {
            Utilities util = new Utilities();
            Constants con  = new Constants();

            PushPullFiles pushPull = new PushPullFiles();


            try
            {
                util.Check_devices();

                pushPull.PushCalib(results, true);
            }
            catch (Exception ex)
            {
                throw new Exception("Cant push files");
            }
        }
예제 #3
0
        private void pullEditPush()
        {
            Utilities     util     = new Utilities();
            PushPullFiles pushPull = new PushPullFiles();

            try
            {
                util.Check_devices();
                string root = "adb root";
                util.proc(root, true);

                Thread.Sleep(1000);
                string remount = "adb remount";
                util.proc(remount, true);
                pushPull.pullEditPush(util);
            }
            catch (Exception ex)
            {
                Console.Write(ex);
            }
        }
예제 #4
0
        private void One_Shot_Install_Click(object sender, RoutedEventArgs e)
        {
            PushPullFiles pushPull  = new PushPullFiles();
            var           uiContext = SynchronizationContext.Current;

            List <string> apkFilePathsFiltered = new List <string>();
            List <string> imgFilePathsFiltered = new List <string>();
            List <string> calFilePathsFiltered = new List <string>();
            List <string> hexFilePathsFiltered = new List <string>();
            List <string> iniFilePathsFiltered = new List <string>();


            Install install = new Install();

            if (!install.One_shot_Install())
            {
                return;
            }


            var items = new installedItemsOneShot();

            if ((bool)items.ShowDialog() == false)
            {
                return;
            }


            l_calib_files_val.Content  = "None";
            l_config_files_val.Content = "None";
            l_engine_val.Content       = "None";
            l_hexagon_val.Content      = "None";
            l_release_val.Content      = "None";
            l_config_files_val.Content = "None";
            Utilities.Hexagon          = "";

            if (!File.Exists(con.Get_ToInstall()))
            {
                return;
            }

            var files = File.ReadAllLines(con.Get_ToInstall());

            foreach (var item in files)
            {
                Console.WriteLine(System.IO.Path.GetExtension(item));
                if (System.IO.Path.GetExtension(item).Equals(".img"))
                {
                    imgFilePathsFiltered.Add(item);
                }

                if (System.IO.Path.GetExtension(item).Equals(".apk"))
                {
                    apkFilePathsFiltered.Add(item);
                }
                if (System.IO.Path.GetExtension(item).Equals(".cal"))
                {
                    calFilePathsFiltered.Add(item);
                }
                if (System.IO.Path.GetExtension(item).Equals(".so") && item.Contains("testsig-0x"))
                {
                    hexFilePathsFiltered.Add(item);
                }
                if (System.IO.Path.GetExtension(item).Equals(".ini"))
                {
                    iniFilePathsFiltered.Add(item);
                }
            }

            //install images
            Utilities.Progress = 20;
            //if (imgFilePathsFiltered.Count > 0)
            //{
            //    var t2 = new Task(() => install.Install_APKs(imgFilePathsFiltered.ToArray()));
            //    var t1 = Task.Run(() => install.Enter_Boot_Loader(imgFilePathsFiltered.ToArray()));
            //    Utilities.Progress += 10 ;
            //    await t1.ContinueWith(task => uiContext.Send(x => logItems.Add(Utilities.TextToLog), null));
            //    //await t1.ContinueWith(t2.Start());

            //}
            this.Dispatcher.Invoke((Action) delegate
            {
                Item i = new Item()
                {
                    Text = "Waiting 60 seconds after reboot before continue"
                };
                Item j = new Item()
                {
                    Text = "Installing APKs"
                };
                string pushHex = "";
                if (hexFilePathsFiltered.Count > 0)
                {
                    pushHex = string.Format("adb push {0} /system/lib/rfsa/adsp", hexFilePathsFiltered[0]);
                }
                //install images
                Utilities.Progress      = 25;
                var backgroundScheduler = TaskScheduler.Default;
                var uiScheduler         = TaskScheduler.FromCurrentSynchronizationContext();
                //install img

                //pause check device connectivity
                Utilities.Pause = true;
                Task.Factory.StartNew(delegate { install.Enter_Boot_Loader(imgFilePathsFiltered.ToArray()); },
                                      backgroundScheduler).
                ContinueWith(delegate { uiContext.Send(x => logItems.Add(Utilities.TextToLog), null); }, uiScheduler).

                ContinueWith(delegate { uiContext.Send(x => logItems.Add(i), null); }, uiScheduler).

                ContinueWith(delegate { Utilities.Pause = false; }, uiScheduler).

                ContinueWith(delegate { install.Fastboot_Reboot(); },
                             backgroundScheduler).

                ContinueWith(delegate { uiContext.Send(x => logItems.Add(Utilities.TextToLog), null); }, uiScheduler).



                //install apk
                ContinueWith(delegate { uiContext.Send(x => logItems.Add(j), null); }, uiScheduler).

                ContinueWith(delegate { install.Install_APKs(apkFilePathsFiltered.ToArray()); },
                             backgroundScheduler).

                ContinueWith(delegate { uiContext.Send(x => logItems.Add(Utilities.TextToLog), null); }, uiScheduler).



                //copy Calibrations files
                ContinueWith(delegate { pushPull.PushCalib(calFilePathsFiltered.ToArray(), true); },
                             backgroundScheduler).
                ContinueWith(delegate { uiContext.Send(x => logItems.Add(Utilities.TextToLog), null); }, uiScheduler).

                ContinueWith(delegate { util.proc("adb root", true); },
                             backgroundScheduler).
                ContinueWith(delegate { uiContext.Send(x => logItems.Add(Utilities.TextToLog), null); }, uiScheduler).

                ContinueWith(delegate { util.proc("adb remount", true); },
                             backgroundScheduler).
                ContinueWith(delegate { uiContext.Send(x => logItems.Add(Utilities.TextToLog), null); }, uiScheduler).

                //wait after remount
                ContinueWith(delegate { Thread.Sleep(5000); },
                             backgroundScheduler).
                ContinueWith(delegate { uiContext.Send(x => logItems.Add(Utilities.TextToLog), null); }, uiScheduler).

                //copy hexagon
                ContinueWith(delegate { util.proc(pushHex, true); },
                             backgroundScheduler).
                ContinueWith(delegate { uiContext.Send(x => logItems.Add(Utilities.TextToLog), null); }, uiScheduler).

                ContinueWith(delegate { util.proc("adb reboot", true); },
                             backgroundScheduler);



                Utilities.Progress = 0;

                //pause check device connectivity
                Utilities.Pause = true;
            });



            //install apk
        }
예제 #5
0
        private void b_refresh_Click(object sender, RoutedEventArgs e)
        {
            if (!l_connected.Content.Equals("Connected"))
            {
                return;
            }

            Utilities     util  = new Utilities();
            Utilities     util1 = new Utilities();
            Utilities     util2 = new Utilities();
            Utilities     util3 = new Utilities();
            Utilities     util4 = new Utilities();
            PushPullFiles pp    = new PushPullFiles();

            var uiContext = SynchronizationContext.Current;

            this.Dispatcher.Invoke((Action) delegate
            {
                var backgroundScheduler = TaskScheduler.Default;
                var uiScheduler         = TaskScheduler.FromCurrentSynchronizationContext();

                //Vendor
                Task.Factory.StartNew(delegate { pp.Pull_Config_File(); },
                                      backgroundScheduler).
                ContinueWith(delegate { uiContext.Send(x => logItems.Add(Utilities.TextToLog), null); }, uiScheduler).

                ContinueWith(delegate { l_vedor_val.Content = Utilities.Vendor; }, uiScheduler);

                //Serial number
                Task.Factory.StartNew(delegate { util1.Check_devices(); },
                                      backgroundScheduler).
                ContinueWith(delegate { uiContext.Send(x => logItems.Add(Utilities.TextToLog), null); }, uiScheduler).

                ContinueWith(delegate { l_serial_val.Content = Utilities.SerialNum; }, uiScheduler);

                //Calibrations files
                Task.Factory.StartNew(delegate { util2.Check_Calib_Files(); },
                                      backgroundScheduler).
                ContinueWith(delegate { uiContext.Send(x => logItems.Add(Utilities.TextToLog), null); }, uiScheduler).

                ContinueWith(delegate { l_calib_files_val.Content = String.Join(", ", Utilities.CalibrationFiles.ToArray()); }, uiScheduler);

                //Calib
                Task.Factory.StartNew(delegate { util3.Check_Config_Files_Etc(); },
                                      backgroundScheduler).

                ContinueWith(delegate { uiContext.Send(x => logItems.Add(Utilities.TextToLog), null); }, uiScheduler).

                ContinueWith(delegate { l_config_files_val.Content = string.Join(", ", Utilities.ConfigFiles.ToArray()); }, uiScheduler);

                //release and engine

                Task.Factory.StartNew(delegate { util.Get_Release_and_Engine_Version(); },
                                      backgroundScheduler).

                ContinueWith(delegate { uiContext.Send(x => logItems.Add(Utilities.TextToLog), null); }, uiScheduler).

                ContinueWith(delegate { l_release_val.Content = Utilities.Release; }, uiScheduler).
                ContinueWith(delegate { l_engine_val.Content = Utilities.Engine; }, uiScheduler);

                //Hexagon

                Task.Factory.StartNew(delegate { util4.Check_Hexagon_File(); },
                                      backgroundScheduler).

                ContinueWith(delegate { uiContext.Send(x => logItems.Add(Utilities.TextToLog), null); }, uiScheduler).

                ContinueWith(delegate { l_hexagon_val.Content = Utilities.Hexagon; }, uiScheduler).

                ContinueWith(delegate { Refresh_Device_Prop(); }, uiScheduler);
            });
        }