void hardwareBtn_Click(object sender, RoutedEventArgs e)
 {
     if (ConnectionChecker.IsConnectedToInternet)
     {
         Process.Start(string.Format("http://www.google.com/#q={0}", StringLinesRemover.ForgetLastLine(_deviceInfo.DeviceName)));
     }
 }
Exemplo n.º 2
0
 public async Task ListApps(TextBox context2, bool createNoWindow, string target = null)
 {
     await Context.Dispatcher.InvokeAsync(async() =>
     {
         if (!string.IsNullOrEmpty(target))
         {
             await Task.Run(async() =>
             {
                 string logcat =
                     StringLinesRemover.ForgetLastLine(
                         StringLinesRemover.RemoveLine(
                             await
                             _executor.Execute(
                                 new Command(string.Format("adb -s {0} shell pm list packages", target)),
                                 createNoWindow), 4));
                 await context2.Dispatcher.InvokeAsync(() => context2.Text = logcat);
             });
         }
         else
         {
             await Task.Run(async() =>
             {
                 string logcat =
                     StringLinesRemover.ForgetLastLine(
                         StringLinesRemover.RemoveLine(
                             await
                             _executor.Execute(new Command(string.Format("adb shell pm list packages")),
                                               createNoWindow), 4));
                 await context2.Dispatcher.InvokeAsync(() => context2.Text = logcat);
             });
         }
     });
 }
 void _bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     _adbDevicesBox = new TextBox()
     {
         Foreground = Brushes.Gray,
         FontSize   = 18
     };
     _adbDevicesBox.Text            = StringLinesRemover.ForgetLastLine(_adbDevices);
     AdbDevicesControl.Content      = _adbDevicesBox;
     FastbootDevicesControl.Content = new TextBox().Text = StringLinesRemover.ForgetLastLine(_fastbootDevices);
 }
        protected void SetInfo()
        {
            DeviceName.Text = _deviceInfo.DeviceName;
            Style      textblockStyle = Resources["TileTitle"] as Style;
            Style      labelStyle     = Resources["TileTitleLabel"] as Style;
            StackPanel panel          = new StackPanel();

            panel.CanVerticallyScroll   = true;
            panel.CanHorizontallyScroll = true;
            TextBlock infoBlock = new TextBlock()
            {
                Style        = textblockStyle,
                TextWrapping = TextWrapping.Wrap
            };

            infoBlock.Text = StringLinesRemover.ForgetLastLine(_deviceInfo.OsVersion);
            infoBlock.Text = Regex.Replace(infoBlock.Text, @"^\s*$\n", string.Empty, RegexOptions.Multiline).TrimEnd();
            infoBlock.Text = infoBlock.Text + "\n" + _deviceInfo.OsVersionShort;
            infoBlock.Text = Regex.Replace(infoBlock.Text, @"^\s*$\n", string.Empty, RegexOptions.Multiline).TrimEnd();
            panel.Children.Add(infoBlock);
            DeviceOsContentControl.Content = panel;

            StackPanel panel2 = new StackPanel();

            panel2.CanVerticallyScroll   = true;
            panel2.CanHorizontallyScroll = true;
            panel2.Children.Add(new Label()
            {
                Style = labelStyle, Content = "MANUFACTURER"
            });
            TextBlock infoBlock2 = new TextBlock()
            {
                Style        = textblockStyle,
                TextWrapping = TextWrapping.Wrap
            };

            infoBlock2.Text = StringLinesRemover.ForgetLastLine(_deviceInfo.DeviceManufacturer);
            infoBlock2.Text = Regex.Replace(infoBlock2.Text, @"^\s*$\n", string.Empty, RegexOptions.Multiline).TrimEnd();
            panel2.Children.Add(infoBlock2);
            panel2.Children.Add(new Label()
            {
                Style = labelStyle, Content = "CODENAME"
            });
            TextBlock infoBlock3 = new TextBlock()
            {
                Style        = textblockStyle,
                TextWrapping = TextWrapping.Wrap
            };

            infoBlock3.Text = StringLinesRemover.ForgetLastLine(_deviceInfo.DeviceCodename);
            panel2.Children.Add(infoBlock3);
            DeviceInfoContentControl.Content = panel2;

            Button hardwareBtn = new Button()
            {
                Width  = 150,
                Height = 50,
                HorizontalAlignment = HorizontalAlignment.Center,
                Foreground          = Brushes.Gray,
                Content             = "VIEW HARDWARE"
            };

            hardwareBtn.Click += hardwareBtn_Click;
            DeviceHardwareContentControl.Content = hardwareBtn;
            if (!string.IsNullOrEmpty(_adbDevicesBox.Text))
            {
                if (_deviceInfo.IsRooted)
                {
                    DeviceRoot.Visibility   = Visibility.Visible;
                    DeviceNoRoot.Visibility = Visibility.Collapsed;
                }
                else
                {
                    DeviceRoot.Visibility   = Visibility.Collapsed;
                    DeviceNoRoot.Visibility = Visibility.Visible;
                }
            }
        }
Exemplo n.º 5
0
 void _osWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     e.Result   = _adb.DeviceOsVersion(createWindow, _target);
     _osVersion = StringLinesRemover.ForgetLastLine(StringLinesRemover.RemoveLine(e.Result.ToString(), 4));
 }
Exemplo n.º 6
0
 void _deviceNameWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     e.Result    = _adb.DeviceName(createWindow, _target);
     _deviceName = StringLinesRemover.ForgetLastLine(StringLinesRemover.RemoveLine(e.Result.ToString(), 4));
 }
Exemplo n.º 7
0
 void appsList_DoWork(object sender, DoWorkEventArgs e)
 {
     e.Result   = _adb.ListApps(createWindow, _target);
     _appOutput = StringLinesRemover.ForgetLastLine(StringLinesRemover.RemoveLine(e.Result.ToString(), 4));
 }
 public async Task <string> GetCid(bool createNoWindow = true)
 {
     return(StringLinesRemover.FitString(StringLinesRemover.ForgetLastLine(StringLinesRemover.RemoveLine(await Task.Run(async() => await _executor.Execute(new Command("fastboot oem getvar cid"))), 5))));
 }
Exemplo n.º 9
0
 void _logcatWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     e.Result = _advanced.Logcat(string.Format(@"""{0}\logcat.txt""", _logcatLocation), _createWindow);
     _logcat  = StringLinesRemover.ForgetLastLine(StringLinesRemover.RemoveLine(e.Result.ToString(), 4));
 }
Exemplo n.º 10
0
 void _bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     AdbDevices.Content      = new TextBox().Text = StringLinesRemover.ForgetLastLine(_adbDevices);
     FastbootDevices.Content = new TextBox().Text = StringLinesRemover.ForgetLastLine(_fastbootDevices);
 }
Exemplo n.º 11
0
 public async Task <string> ListDevices(bool createNoWindow)
 {
     return(StringLinesRemover.ForgetLastLine(StringLinesRemover.RemoveLine(await _executor.Execute(new Command("fastboot devices")), 5)));
 }
Exemplo n.º 12
0
 public async Task ListDevices(TextBox context, bool createNoWindow)
 {
     await context.Dispatcher.InvokeAsync(async() =>
                                          context.Text = StringLinesRemover.ForgetLastLine(StringLinesRemover.RemoveLine(await _executor.Execute(new Command("fastboot devices")), 5)));
 }
Exemplo n.º 13
0
        public async Task <DeviceInfo> DeviceInfo(bool createWindow, string target = null)
        {
            Timer timer = new Timer(6000);

            timer.Elapsed += (sender, e) =>
            {
                KillAdb();
                timer.Dispose();
            };

            timer.Enabled = true;
            string name =
                StringLinesRemover.ForgetLastLine(StringLinesRemover.RemoveLine(
                                                      await DeviceName(createWindow, target), 4));

            string codename =
                StringLinesRemover.ForgetLastLine(StringLinesRemover.RemoveLine(
                                                      await DeviceCodename(createWindow, target), 4));

            string manufacturer =
                StringLinesRemover.ForgetLastLine(StringLinesRemover.RemoveLine(
                                                      await DeviceManufacturer(createWindow, target), 4));

            string os        = StringLinesRemover.ForgetLastLine(StringLinesRemover.RemoveLine(await DeviceOsVersion(createWindow, target), 4));
            string osDetails = string.Empty;
            string root      = string.Empty;

            Parallel.Invoke(async() =>
            {
                try
                {
                    root = await _executor.Execute(new Command("adb shell su"), createWindow); root = StringLinesRemover.RemoveLine(root, 4); root = StringLinesRemover.ForgetLastLine(root);
                }
                catch
                {
                    root = string.Empty;
                }
            }, () => { Thread.Sleep(200); KillAdb(); });
            string buildprop = StringLinesRemover.ForgetLastLine(StringLinesRemover.RemoveLine(await BuildProp(createWindow, target), 5));
            bool   isRoot    = false;

            if (os.Contains("1.5"))
            {
                osDetails = "CUPCAKE";
            }
            if (os.Contains("1.6"))
            {
                osDetails = "DONUT";
            }
            if (os.Contains("2"))
            {
                osDetails = "ECLAIR";
            }
            if (os.Contains("2.2") || os.Contains("2.2.3"))
            {
                osDetails = "FROYO";
            }
            if (os.Contains("2.3"))
            {
                osDetails = "GINGERBREAD";
            }
            if (os.Contains("3.0") || os.Contains("3.1") || os.Contains("3.2"))
            {
                osDetails = "HONEYCOMB";
            }
            if (os.Contains("4.0"))
            {
                osDetails = "ICE CREAM SANDWICH";
            }
            if (os.Contains("4.1") || os.Contains("4.2") || os.Contains("4.3"))
            {
                osDetails = "JELLY BEAN";
            }
            if (os.Contains("4.4"))
            {
                osDetails = "KIT KAT";
            }
            if (root.Contains('#'))
            {
                isRoot = true;
            }
            return(new DeviceInfo()
            {
                Name = name, AndroidVersionCode = os, AndroidVersionName = osDetails, BuildProp = buildprop, Codename = codename, Manufacturer = manufacturer, IsRooted = isRoot
            });
        }