Skip to content

Commit 8472d59

Browse files
committed
rent modify
1 parent 4b40d34 commit 8472d59

File tree

3 files changed

+39
-35
lines changed

3 files changed

+39
-35
lines changed

StarSharksTool/BatchRentPage.cs

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -128,36 +128,32 @@ public BatchRentPage()
128128
}
129129
});
130130

131-
//Task.Run(async () =>
132-
//{
133-
// while (true)
134-
// {
135-
// try
136-
// {
137-
// await Task.Delay(5000);
138-
// bool isApproveContract = await Services.Service.IsApproveRentContract(this._accountModel.Account.Address);
139-
140-
// MethodInvoker mi = new MethodInvoker(() =>
141-
// {
142-
// var textboxPrice = Convert.ToInt32(priceTextbox.Text);
143-
// if (isApproveContract == true)
144-
// {
145-
// approveContract.Enabled = false;
146-
// }
147-
// });
148-
// BeginInvoke(mi);
149-
// }
150-
// catch (InvalidOperationException)
151-
// {
152-
// break;
153-
// }
154-
// catch (Exception e)
155-
// {
156-
157-
// }
158-
// }
159-
//});
160-
131+
Task.Run(async () =>
132+
{
133+
while (true)
134+
{
135+
try
136+
{
137+
await Task.Delay(3);
138+
MethodInvoker mi = new MethodInvoker(() =>
139+
{
140+
if (NeedRentAccounts.Count == 0) {
141+
this.autoRent.Checked = false;
142+
this.checkBox1.Checked = false;
143+
}
144+
});
145+
BeginInvoke(mi);
146+
}
147+
catch (InvalidOperationException)
148+
{
149+
break;
150+
}
151+
catch (Exception e)
152+
{
153+
break;
154+
}
155+
}
156+
});
161157
}
162158

163159

@@ -246,7 +242,8 @@ public void RerenderRentHistory()
246242
dt.Columns.Add("RentId");
247243
dt.Columns.Add("RentPrice");
248244
dt.Columns.Add("Status");
249-
foreach (var item in RentHistory)
245+
var tmp = RentHistory.Reverse();
246+
foreach (var item in tmp)
250247
{
251248
dt.Rows.Add(item.Key.Item1, item.Key.Item2, item.Value);
252249
}

StarSharksTool/Global.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ internal static HttpClient GetClient(string proxy)
5656
clientHandler.Proxy = new WebProxy(PROXY);
5757
}
5858
_httpClient = new HttpClient(clientHandler);
59+
_httpClient.DefaultRequestHeaders.ConnectionClose = true;
5960
return _httpClient;
6061
}
6162

@@ -71,6 +72,7 @@ internal static HttpClient HTTPCLIENT
7172
clientHandler.Proxy = new WebProxy(PROXY);
7273
}
7374
_httpClient = new HttpClient(clientHandler);
75+
_httpClient.DefaultRequestHeaders.ConnectionClose = true;
7476
return _httpClient;
7577
}
7678
set

StarSharksTool/Services/Service.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,14 @@ internal async static Task<MarketRentResponseModel> GetMarketplace(int maxPrice,
135135
req.Speed = new List<int> { 1, 100 + r.Next(1, 50) };
136136
req.RentExceptGain = new List<int> { 1, 13 + step + maxPrice };
137137
req.Star = level;
138+
138139
if (step % 2 == 0)
139140
{
140141
req.Page = 2;
142+
}
143+
144+
if (step % 4 == 0)
145+
{
141146
req.Sort = "LatestDesc";
142147
}
143148

@@ -345,18 +350,18 @@ internal static async Task<bool> ApproveContract(string rentAddress)
345350
{
346351
if (sharkResp.Message.StartsWith("shark was rented by others"))
347352
{
348-
return (-1, sharkResp.Message);
353+
return (-1, "取消租赁:原因:" + sharkResp.Message);
349354
}
350355
else
351356
{
352-
return (-2, sharkResp.Message);
357+
return (-2, "取消租赁:原因:" + sharkResp.Message);
353358
}
354359
}
355360

356361
var price = BigInteger.Parse(sharkResp.Data.Price) / 1000000000000000000;
357-
if (price > maxPrice)
362+
if (price != maxPrice)
358363
{
359-
return (-1, "价格超了");
364+
return (-1, "价格不一致");
360365
}
361366
int nonce = obj.Nonce;
362367
//lock (obj)

0 commit comments

Comments
 (0)