-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from sout233/dev
WHAT A 0.3.0!!!!
- Loading branch information
Showing
43 changed files
with
1,095 additions
and
606 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
using Nalai.CoreConnector; | ||
|
||
|
||
const string Url2 = "https://mirrors.tuna.tsinghua.edu.cn/debian/dists/Debian10.13/ChangeLog"; | ||
// var id = await preCore.StartAsync("https://mirrors.tuna.tsinghua.edu.cn/debian-cd/current/amd64/iso-cd/debian-12.7.0-amd64-netinst.iso","C:/download"); | ||
var id = await CoreService.SendStartMsgAsync(Url2, "C:/download","",""); | ||
Console.WriteLine(id.Id); | ||
|
||
// Task.Run(async () => | ||
// { | ||
// while (true) | ||
// { | ||
// var status = await PreCore.GetStatusAsync(id.Id); | ||
// if (status.TotalBytes > 0) | ||
// { | ||
// var progress = (((float)status.DownloadedBytes / status.TotalBytes) * 100).ToString("0.00")+"%"; | ||
// Console.WriteLine($"Downloaded:{status.DownloadedBytes} Total:{status.TotalBytes} FileName:{status.FileName} Status:{status.StatusText} Progress:{progress}"); | ||
// } | ||
// await Task.Delay(500); | ||
// } | ||
// }); | ||
|
||
await Task.Delay(5000); | ||
|
||
var result = await CoreService.SendStopMsgAsync(id.Id); | ||
|
||
Console.WriteLine(result.IsSuccess); | ||
|
||
Environment.Exit(0); | ||
// using Nalai.CoreConnector; | ||
// | ||
// | ||
// const string Url2 = "https://mirrors.tuna.tsinghua.edu.cn/debian/dists/Debian10.13/ChangeLog"; | ||
// // var id = await preCore.StartAsync("https://mirrors.tuna.tsinghua.edu.cn/debian-cd/current/amd64/iso-cd/debian-12.7.0-amd64-netinst.iso","C:/download"); | ||
// var id = await CoreService.SendStartMsgAsync(Url2, "C:/download","",""); | ||
// Console.WriteLine(id.Id); | ||
// | ||
// // Task.Run(async () => | ||
// // { | ||
// // while (true) | ||
// // { | ||
// // var status = await PreCore.GetStatusAsync(id.Id); | ||
// // if (status.TotalBytes > 0) | ||
// // { | ||
// // var progress = (((float)status.DownloadedBytes / status.TotalBytes) * 100).ToString("0.00")+"%"; | ||
// // Console.WriteLine($"Downloaded:{status.DownloadedBytes} Total:{status.TotalBytes} FileName:{status.FileName} Status:{status.StatusText} Progress:{progress}"); | ||
// // } | ||
// // await Task.Delay(500); | ||
// // } | ||
// // }); | ||
// | ||
// await Task.Delay(5000); | ||
// | ||
// var result = await CoreService.SendStopMsgAsync(id.Id); | ||
// | ||
// // Console.WriteLine(result.IsSuccess); | ||
// | ||
// Environment.Exit(0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,64 @@ | ||
namespace Nalai.CoreConnector.Models; | ||
using Newtonsoft.Json; | ||
|
||
public enum DownloadStatus | ||
namespace Nalai.CoreConnector.Models; | ||
|
||
public enum DownloadStatusKind | ||
{ | ||
NoStart, | ||
Running, | ||
Pending, | ||
Error, | ||
Finished, | ||
Cancelled, | ||
} | ||
|
||
public class DownloadStatus | ||
{ | ||
public DownloadStatus(DownloadStatusKind kind, string message) | ||
{ | ||
Kind = kind; | ||
Message = message; | ||
} | ||
|
||
[JsonIgnore] | ||
public DownloadStatusKind Kind | ||
{ | ||
get | ||
{ | ||
var kind = KindRaw switch | ||
{ | ||
"NoStart" => DownloadStatusKind.NoStart, | ||
"Running" => DownloadStatusKind.Running, | ||
"Error" => DownloadStatusKind.Error, | ||
"Finished" => DownloadStatusKind.Finished, | ||
"DownloadFinished" => DownloadStatusKind.Finished, | ||
"Pending(Initializing)" => DownloadStatusKind.Pending, | ||
"Pending(Starting)" => DownloadStatusKind.Pending, | ||
"Pending(Stopping)" => DownloadStatusKind.Pending, | ||
"Cancelled" => DownloadStatusKind.Cancelled, | ||
_ => DownloadStatusKind.NoStart | ||
}; | ||
|
||
return kind; | ||
} | ||
private set | ||
{ | ||
KindRaw = value switch | ||
{ | ||
DownloadStatusKind.NoStart => "NoStart", | ||
DownloadStatusKind.Running => "Running", | ||
DownloadStatusKind.Error => "Error", | ||
DownloadStatusKind.Finished => "Finished", | ||
DownloadStatusKind.Pending => "Pending(Initializing)", | ||
DownloadStatusKind.Cancelled => "Cancelled", | ||
_ => "NoStart" | ||
}; | ||
} | ||
} | ||
|
||
[JsonProperty("kind")] | ||
public string? KindRaw { get; set; } | ||
|
||
|
||
[JsonProperty("message")] public string Message { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.