Skip to content

Commit

Permalink
Merge pull request #2 from DeDaMrAzR/main
Browse files Browse the repository at this point in the history
RTL platform added
  • Loading branch information
openshwprojects authored Dec 24, 2024
2 parents 06f3036 + c3f8702 commit 8be7c49
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 26 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
} else {
Write-Error "PROTATool.exe.config is missing."
}
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
Expand Down
10 changes: 5 additions & 5 deletions PROTATool/Form1.Designer.cs

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

36 changes: 19 additions & 17 deletions PROTATool/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

namespace PROTATool
{
public partial class Form1 : Form
public partial class PROTATool : Form
{
Settings settings;
public Form1()
public PROTATool()
{
InitializeComponent();
}
Expand Down Expand Up @@ -55,7 +55,7 @@ void startRefreshIfPossible()
}
private async void RefreshCommits()
{
Form1.setState("Entering...");
PROTATool.setState("Entering...");
LogUtil.log("Entering refresh commits");
string prLink = textBoxPR.Text;

Expand All @@ -72,7 +72,7 @@ private async void RefreshCommits()

try
{
Form1.setState("Getting commits...");
PROTATool.setState("Getting commits...");
LogUtil.log($"Fetching commits for PR: {owner}/{repo}/pull/{pullRequestNumber}");

var client = new GitHubClient(new Octokit.ProductHeaderValue("PROTATool"));
Expand Down Expand Up @@ -117,7 +117,7 @@ private async void RefreshCommits()
string youngestSha = youngestCommit.Sha;
if (prevTopCommit != youngestSha)
{
Form1.setState("Fetching artifacts...");
PROTATool.setState("Fetching artifacts...");
LogUtil.log("Commit has changed, fetching artifacts...");
CommitInfo c = await GitUtils.fetchCommitInfo(owner, repo,
youngestSha, pullRequestNumber.ToString());
Expand Down Expand Up @@ -146,7 +146,7 @@ private async void RefreshCommits()
MessageBox.Show("Invalid PR link format. Please enter a valid link, e.g., https://github.com/owner/repo/pull/1234.", "Invalid Input");
}

Form1.setState("Done...");
PROTATool.setState("Done...");
bBusy = false;
LogUtil.log("Exiting refresh commits.");
}
Expand All @@ -171,8 +171,10 @@ private async Task sendToDevices(CommitInfo c)
}
private async Task sendToDevice(CommitInfo c, string ip)
{
Form1.setState("Sending OTA to " + ip + "...");
LogUtil.log("Starting OTA " + ip + " process...");

PROTATool.setState("Sending OTA to " + ip + "...");
LogUtil.log("Starting OTA " + ip + "process...");

string prefix = "OpenBK7231T_";
string ext = "rbl";

Expand Down Expand Up @@ -279,18 +281,18 @@ private async Task sendToDevice(CommitInfo c, string ip)
}

public static void setState(string s)
{
if (Singleton.InvokeRequired)
{
Singleton.Invoke(new Action<string>(setState), s);
}
else
{
if (Singleton.InvokeRequired)
{
Singleton.Invoke(new Action<string>(setState), s);
}
else
{
Singleton.labelState.Text = "State: " + s;
Singleton.labelState.Text = "State: " + s;
}
}
static Form1 Singleton;
private void Form1_Load(object sender, EventArgs e)
static PROTATool Singleton;
private void PROTATool_Load(object sender, EventArgs e)
{
settings = Settings.Load();
settings.BindTextBox(textBoxPassword, "ApiKey");
Expand Down
4 changes: 2 additions & 2 deletions PROTATool/GitUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static async Task<CommitInfo> fetchCommitInfo(string owner, string repo,
continue;
if (run.Status == "in_progress")
{
Form1.setState("Waiting for build to finish - " + run.Name + "");
PROTATool.setState("Waiting for build to finish - " + run.Name + "");
LogUtil.log("Waiting for build to finish - " + run.Name + "");
await Task.Delay(5000);
break;
Expand Down Expand Up @@ -106,7 +106,7 @@ public static async Task<CommitInfo> fetchCommitInfo(string owner, string repo,
}
else
{
Form1.setState("Waiting for build");
PROTATool.setState("Waiting for build");
LogUtil.log("Waiting for build");
await Task.Delay(5000);
}
Expand Down
4 changes: 3 additions & 1 deletion PROTATool/Platforms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.XPath;

namespace PROTATool
{
Expand Down Expand Up @@ -37,7 +38,8 @@ internal static Platform[] CreatePlatformsArray()
new Platform { name = "OpenLN882H", extension = "_OTA.bin" },
new Platform { name = "OpenTR6260", extension = ".bin" },
new Platform { name = "OpenW600", extension = ".img" },
new Platform { name = "OpenW800", extension = ".img" }
new Platform { name = "OpenW800", extension = ".img" },
new Platform { name = "OpenRTL87X0C", extension = ".img" }
};
}

Expand Down
2 changes: 1 addition & 1 deletion PROTATool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
Application.Run(new PROTATool());
}
}
}

0 comments on commit 8be7c49

Please sign in to comment.