Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/clovershell-client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ClovershellConnection.cs11
-rw-r--r--Program.cs9
2 files changed, 12 insertions, 8 deletions
diff --git a/ClovershellConnection.cs b/ClovershellConnection.cs
index 9d54305..70d6554 100644
--- a/ClovershellConnection.cs
+++ b/ClovershellConnection.cs
@@ -315,6 +315,17 @@ namespace com.clusterrr.cloverhack
}
}
+ public void Connect()
+ {
+ if (Enabled) return;
+ Enabled = true;
+ while (Enabled && !online)
+ {
+ Thread.Sleep(50);
+ }
+ if (!online) throw new Exception("no clovershell connection, make sure your NES Mini connected, turned on and clovershell mod installed");
+ }
+
void epReader_DataReceived(object sender, EndpointDataEventArgs e)
{
var cmd = (ClovershellCommand)e.Buffer[0];
diff --git a/Program.cs b/Program.cs
index e1be22b..1508ffa 100644
--- a/Program.cs
+++ b/Program.cs
@@ -32,14 +32,7 @@ namespace UsbTest
Environment.Exit(-1);
}
var command = args[0].ToLower();
- nes.Enabled = true;
- int t = 300;
- while (!nes.Online)
- {
- Thread.Sleep(10);
- t--;
- if (t == 0) throw new Exception("no clovershell connection, make sure your NES Mini connected, turned on and clovershell mod installed");
- }
+ nes.Connect();
var ping = nes.Ping();
if (ping < 0) throw new Exception("connected to NES Mini but clovershell is not responding");
switch (command)