- Katılım
- 23 Haz 2018
- Mesajlar
- 1,118
- Tepkime puanı
- 5,737
- Puanları
- 113
- Yaş
- 22
Çevrimdışı
Gizli İçerik
C# Eğitim serisine ADB - FastBoot kontrolü ile başlıyorum.
Mutlaka Giriş seviye C# bilgisine sahip olmalısınız.
Mutlaka Giriş seviye C# bilgisine sahip olmalısınız.
Gizli İçerik
Microsoft Visual Studio 2017 (En az 2010)
Net Framework 4
ADB - FastBoot Araçları
ADB - FastBoot Driver
Net Framework 4
ADB - FastBoot Araçları
ADB - FastBoot Driver
Yeni C# Form Application projesi oluşturun.
Form'a sağ tıklayıp Show Code - Kodu Göster tıklayın.
Ardından en üst tarafa aşağıdaki kodu ekleyin.
Görselden de yararlanabilirsiniz.
C#:
//EKLENECEKLER
using System.Diagnostics;
using System.IO;
//EKLENECEKLER
Tasarıma dönün ve aşağıdaki gibi tasarlayın.
2 Adet button
2 Adet textBox
2 Adet label
1 Adet richTextbox
Şimdi de ADB - FastBoot araçlarının bulunduğu klasöre gidip ;
Kod:
adb.exe
AdbWinApi.dll
AdbWinUsbApi.dll
fastboot.exe
Debug klasörüne kadar açın ve içine kopyalayın.
Öncelikle araçların değişken isimlerine yani "name"lerine bakalım.
Araçlara sağ tıklayıp Properties ya da Özellikler penceresine bastığınız zaman en üstte name olarak yazacaktır.
Burada button1'e çift tıklıyoruz ve şu kodları yapıştırıyoruz.
Kod:
Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.CreateNoWindow = true;
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
startInfo.FileName = "adb.exe";
startInfo.Arguments = textBox1.Text;
process.StartInfo = startInfo;
process.Start();
richTextBox1.Text = richTextBox1.Text + process.StandardOutput.ReadToEnd();
Kod:
Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.CreateNoWindow = true;
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
startInfo.FileName = "fastboot.exe";
startInfo.Arguments = textBox2.Text;
process.StartInfo = startInfo;
process.Start();
richTextBox1.Text = richTextBox1.Text + process.StandardOutput.ReadToEnd();
Programımız bitmiştir çalıştırıp textboxlara komut girebilirsiniz
Unutmayın adb ya da fastboot komutlarını yazdığımız yerlerde sadece komutu yazıyoruz
Örneğin ADB için : devices olacak. ADB Devices değil.
C#:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//EKLENECEKLER
using System.Diagnostics;
using System.IO;
//EKLENECEKLER
using System.Windows.Forms;
namespace CSharp_Dersleri_Ders_1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.CreateNoWindow = true;
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
startInfo.FileName = "adb.exe";
startInfo.Arguments = textBox1.Text;
process.StartInfo = startInfo;
process.Start();
richTextBox1.Text = richTextBox1.Text + process.StandardOutput.ReadToEnd();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.CreateNoWindow = true;
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
startInfo.FileName = "fastboot.exe";
startInfo.Arguments = textBox2.Text;
process.StartInfo = startInfo;
process.Start();
richTextBox1.Text = richTextBox1.Text + process.StandardOutput.ReadToEnd();
}
}
}
Görsellerin kırılma ihtimaline karşı yedeklemesini sağladım.
Google Drive
Google Drive
İznimiz olmadan alıntısı ve-ya paylaşımı yasaktır.
Gizli İçerik
C# Android Dersleri
Developer : Barış MIZRAKLI
Developer : Barış MIZRAKLI
Son düzenleme: