Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
iXeor authored Apr 9, 2021
0 parents commit e0ca7ab
Show file tree
Hide file tree
Showing 17 changed files with 2,668 additions and 0 deletions.
25 changes: 25 additions & 0 deletions OneKeyBreventCaller.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31129.286
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OneKeyBreventCaller", "OneKeyBreventCaller\OneKeyBreventCaller.csproj", "{91930454-244A-4A8E-84DA-26DD572160F2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{91930454-244A-4A8E-84DA-26DD572160F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{91930454-244A-4A8E-84DA-26DD572160F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{91930454-244A-4A8E-84DA-26DD572160F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{91930454-244A-4A8E-84DA-26DD572160F2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {93FD10AD-A553-47C4-BC83-A7BF3AF72E1E}
EndGlobalSection
EndGlobal
Binary file added OneKeyBreventCaller/ADB_Bin/AdbWinApi.dll
Binary file not shown.
Binary file added OneKeyBreventCaller/ADB_Bin/AdbWinUsbApi.dll
Binary file not shown.
Binary file added OneKeyBreventCaller/ADB_Bin/adb.exe
Binary file not shown.
111 changes: 111 additions & 0 deletions OneKeyBreventCaller/Caller.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

83 changes: 83 additions & 0 deletions OneKeyBreventCaller/Caller.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
using System;
using System.Diagnostics;
using System.Windows.Forms;

namespace OneKeyBreventCaller
{
public partial class BreventCallerMain : Form
{
private int count;
private Process p = new Process();

private void ProcessInit()
{
p.StartInfo.FileName = "./ADB_Bin/adb.exe";//设定程序名
p.StartInfo.UseShellExecute = false; //关闭shell的使用
p.StartInfo.RedirectStandardInput = true; //重定向标准输入
p.StartInfo.RedirectStandardOutput = true; //重定向标准输出
p.StartInfo.RedirectStandardError = true; //重定向错误输出
p.StartInfo.CreateNoWindow = true;//设置不显示窗口
}

private void DeviceScanner()
{
ProcessInit();
p.StartInfo.Arguments = " kill-server";
p.Start();
p.Close();
p.StartInfo.Arguments = " shell getprop ro.product.model";
p.Start();
DeviceInfoStr.Text = p.StandardOutput.ReadToEnd();
p.Close();
if (DeviceInfoStr.Text == "")
{
if (count <= 5)
{
DialogResult result = MessageBox.Show(@"请确保手机已连接并开启USB调试!", @"提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
if (result == DialogResult.OK)
{
DeviceScanner();
}
else if (result == DialogResult.Cancel)
{
DeviceInfoStr.Text = @"(暂无)";
}
}
}
}

public BreventCallerMain()
{
InitializeComponent();
}
private void BreventCallerMain_Load(object sender, EventArgs e)
{
DeviceScanner();
}
private void Refreshbutton_Click(object sender, EventArgs e)
{
DeviceScanner();
}

private void Run_Click(object sender, EventArgs e)
{
ProcessInit();
p.StartInfo.Arguments = " -d shell sh /data/data/me.piebridge.brevent/brevent.sh";
p.Start();
string msg = p.StandardOutput.ReadToEnd();
p.Close();
if(msg != "")
{
DialogResult res = MessageBox.Show("黑阈启动成功!\n"+msg, @"恭喜", MessageBoxButtons.OK, MessageBoxIcon.Information);
if (res == DialogResult.OK)
{
Close();
}
}
else
{
MessageBox.Show(@"黑阈启动失败,请确保手机已连接并开启USB调试!", @"提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
Loading

0 comments on commit e0ca7ab

Please sign in to comment.