void rootButton_Click(object sender, EventArgs e) { string status = ((Button)sender).Text; if (status == "Refresh") { if (PluginServices.isDeviceConnected(plugin)) { if (PluginServices.isDeviceRoot(plugin)) { OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusButton"].Visible = false; OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusLabel"].Text = "Root"; } else { OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusButton"].Visible = true; OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusButton"].Text = "Root"; OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusLabel"].Text = "not Root"; } } } else { if (PluginServices.isDeviceConnected(plugin)) { if (PluginServices.isDeviceRoot(plugin)) { OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusButton"].Visible = false; OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusButton"].Text = "Refresh"; OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusLabel"].Text = "Root"; } else { RootPanel rootPanel = new RootPanel(plugin); rootPanel.Show(); /*if (PluginServices.rootDevice(plugin)) * { * OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusButton"].Visible = false; * OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusLabel"].Text = "Root"; * } * else * { * OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusButton"].Visible = true; * OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusButton"].Text = "Root"; * OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusLabel"].Text = "not Root"; * PluginServices.refreshDeviceList(plugin); * }*/ } } else { OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusButton"].Visible = false; OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusButton"].Text = "Refresh"; OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusLabel"].Text = "Offline"; PluginServices.refreshDeviceList(plugin); } } }
private void recoverButtonPlugin_Click(object sender, EventArgs e, Dictionary <string, string> apps) { ArrayList checkedApps = getAppChecked(); error.Clear(); if (checkedApps.Count > 0 && PluginServices.isDeviceConnected(plugin) && PluginServices.isDeviceRoot(plugin)) { Dictionary <string, string> temp = new Dictionary <string, string>(); Dictionary <string, ArrayList> appsInfo = new Dictionary <string, ArrayList>(); foreach (string name in checkedApps) { string n = name.Split(new char[] { '_' })[0]; temp.Add(n, apps[n]); if (apps[n].Contains(@"\")) { apps[n] = apps[n].Replace(@"\", "/"); } string path = storedDBsPath + n + @"\" + apps[n].Substring(apps[n].LastIndexOf("/")).Replace("/", ""); string journalPath = path + "-journal"; ArrayList pathes = new ArrayList(); pathes.Add(path); pathes.Add(journalPath); //pathes.Add(path + "-shm"); //pathes.Add(path + "-wal"); appsInfo.Add(n, pathes); } CopyFilesProgress copy = new CopyFilesProgress(this, temp, plugin, storedDBsPath, appsInfo); copy.Show(); this.Hide(); } else { if (checkedApps.Count == 0) { error.SetError(OSTabsControl.SelectedTab.Controls["appsGroupBox"].Controls["appsPannel"].Controls[0], "Please select at least one app!!"); } if (!PluginServices.isDeviceConnected(plugin)) { MessageBox.Show("Please connect your device!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusButton"].Visible = false; OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusButton"].Text = "Refresh"; OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusLabel"].Text = "Offline"; PluginServices.refreshDeviceList(plugin); } else if (!PluginServices.isDeviceRoot(plugin)) { MessageBox.Show("Connected device has not root access. please root your device!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusButton"].Visible = true; OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusButton"].Text = "Root"; OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusLabel"].Text = "not Root"; } } }
void assemblyWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) { string status = ""; if (PluginServices.isDeviceConnected(plugin)) { if (PluginServices.isDeviceRoot(plugin)) { status = "Root"; } else { status = "not Root"; } } else { status = "Offline"; } Button statusButton = (Button)OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusButton"]; OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusLabel"].Text = status; if (status == "Offline") { statusButton.Text = "Refresh"; statusButton.Visible = false; } else if (status == "not Root") { statusButton.Text = "Root"; statusButton.Visible = true; } else { statusButton.Visible = false; } ((Button)OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["refreshButton"]).Visible = true; }
void refreshButton_Click(object sender, EventArgs e) { if (PluginServices.isDeviceConnected(plugin)) { if (PluginServices.isDeviceRoot(plugin)) { OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusButton"].Visible = false; OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusLabel"].Text = "Root"; } else { OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusButton"].Visible = true; OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusButton"].Text = "Root"; OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusLabel"].Text = "not Root"; } } else { OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusButton"].Visible = false; OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusButton"].Text = "Refresh"; OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusLabel"].Text = "Offline"; } }
void OSTabsControl_SelectedIndexChanged(object sender, EventArgs e) { TabPage current = ((TabControl)sender).SelectedTab; if (current.Name == "directTabPage") { editButton.Enabled = false; deleteButton.Enabled = false; } else { editButton.Enabled = true; deleteButton.Enabled = true; assemblyPath = OSTabsControl.SelectedTab.Controls["dllAddressLabel"].Text; if (!isAssemblyLoaded(assemblyPath)) { BackgroundWorker assemblyWorker = new BackgroundWorker(); assemblyWorker.WorkerReportsProgress = true; assemblyWorker.DoWork += new DoWorkEventHandler(assemblyWorker_DoWork); assemblyWorker.ProgressChanged += new ProgressChangedEventHandler(assemblyWorker_ProgressChanged); assemblyWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(assemblyWorker_RunWorkerCompleted); OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusLabel"].Text = "Loading plugin..."; ((Button)OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusButton"]).Visible = false; ((Button)OSTabsControl.SelectedTab.Controls["recoverButton"]).Enabled = false; if (assemblyWorker.IsBusy == false) { assemblyWorker.RunWorkerAsync(); } } else { string status = ""; if (PluginServices.isDeviceConnected(plugin)) { if (PluginServices.isDeviceRoot(plugin)) { status = "Root"; } else { status = "not Root"; } } else { status = "Offline"; } Button statusButton = (Button)OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusButton"]; OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["statusLabel"].Text = status; if (status == "Offline") { statusButton.Text = "Refresh"; statusButton.Visible = false; } else if (status == "not Root") { statusButton.Text = "Root"; statusButton.Visible = true; } else { statusButton.Visible = false; } ((Button)OSTabsControl.SelectedTab.Controls["statusGroupBox"].Controls["refreshButton"]).Visible = true; } } }