patch
This commit is contained in:
@@ -32,15 +32,15 @@ namespace PluginManager.Online
|
||||
var op = Functions.GetOperatinSystem();
|
||||
string[] lines = text.Split('\n');
|
||||
int len = lines.Length;
|
||||
string[] titles = { "Name", "Description", "Plugin Type" };
|
||||
data.Add(new string[] { "-", "-", "-" });
|
||||
string[] titles = { "Name", "Description", "Plugin Type", "Libraries" };
|
||||
data.Add(new string[] { "-", "-", "-", "-" });
|
||||
data.Add(titles);
|
||||
data.Add(new string[] { "-", "-", "-" });
|
||||
data.Add(new string[] { "-", "-", "-", "-" });
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
if (lines[i].Length <= 2) continue;
|
||||
string[] content = lines[i].Split(',');
|
||||
string[] display = new string[3];
|
||||
string[] display = new string[4];
|
||||
if (op == PluginManager.Others.OperatingSystem.WINDOWS)
|
||||
{
|
||||
if (content[4].Contains("Windows"))
|
||||
@@ -48,6 +48,10 @@ namespace PluginManager.Online
|
||||
display[0] = content[0];
|
||||
display[1] = content[1];
|
||||
display[2] = content[2];
|
||||
if (content.Length == 6 && (content[5] != null || content[5].Length > 2))
|
||||
display[3] = ((await ServerCom.ReadTextFromFile(content[5])).Count + 1).ToString();
|
||||
|
||||
else display[3] = "1";
|
||||
data.Add(display);
|
||||
continue;
|
||||
}
|
||||
@@ -65,7 +69,7 @@ namespace PluginManager.Online
|
||||
}
|
||||
}
|
||||
|
||||
data.Add(new string[] { "-", "-", "-" });
|
||||
data.Add(new string[] { "-", "-", "-", "-" });
|
||||
|
||||
Functions.FormatAndAlignTable(data);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace PluginManager.Online
|
||||
string oldTitle = Console.Title ?? "";
|
||||
client.DownloadProgressChanged += (sender, e) =>
|
||||
{
|
||||
Console.Title = e.BytesReceived / 1024 + "/" + e.TotalBytesToReceive / 1024 + " (" + e.ProgressPercentage + "%) (" + downloadNumber + " / " + totalToDownload + ")";
|
||||
Console.Title = e.BytesReceived + "/" + e.TotalBytesToReceive + " (" + e.ProgressPercentage + "%) (" + downloadNumber + " / " + totalToDownload + ")";
|
||||
};
|
||||
client.DownloadFileCompleted += (sender, e) =>
|
||||
{
|
||||
|
||||
@@ -174,14 +174,68 @@ namespace PluginManager.Others
|
||||
return command.Arguments;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A way to create a table based on input data
|
||||
/// EpicWings (Pasca Robert) este cel mai bun
|
||||
/// Special thanks to Kami-sama <3
|
||||
/// </summary>
|
||||
/// <param name="data">The List of arrays of strings that represent the rows.</param>
|
||||
public static void FormatAndAlignTable(List<string[]> data)
|
||||
{
|
||||
char tableLine = '-';
|
||||
char tableCross = '+';
|
||||
char tableWall = '|';
|
||||
|
||||
int[] len = new int[data[0].Length];
|
||||
foreach (var line in data)
|
||||
{
|
||||
for (int i = 0; i < line.Length; i++)
|
||||
if (line[i].Length > len[i])
|
||||
len[i] = line[i].Length;
|
||||
}
|
||||
|
||||
|
||||
foreach (string[] row in data)
|
||||
{
|
||||
//Console.Write("\t");
|
||||
if (row[0][0] == tableLine) Console.Write(tableCross);
|
||||
else Console.Write(tableWall);
|
||||
for (int l = 0; l < row.Length; l++)
|
||||
{
|
||||
if (row[l][0] == tableLine)
|
||||
{
|
||||
for (int i = 0; i < len[l] + 4; ++i)
|
||||
Console.Write(tableLine);
|
||||
}
|
||||
else if (row[l].Length == len[l])
|
||||
{
|
||||
Console.Write(" ");
|
||||
Console.Write(row[l]);
|
||||
Console.Write(" ");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
int lenHalf = row[l].Length / 2;
|
||||
for (int i = 0; i < ((len[l] + 4) / 2 - lenHalf); ++i)
|
||||
Console.Write(" ");
|
||||
Console.Write(row[l]);
|
||||
for (int i = (len[l] + 4) / 2 + lenHalf + 1; i < len[l] + 4; ++i)
|
||||
Console.Write(" ");
|
||||
if (row[l].Length % 2 == 0)
|
||||
Console.Write(" ");
|
||||
}
|
||||
|
||||
if (row[l][0] == tableLine) Console.Write(tableCross);
|
||||
else Console.Write(tableWall);
|
||||
}
|
||||
Console.WriteLine(); //end line
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Obsolite
|
||||
#region Old Code -> Spacing by the lomgest item in any cell
|
||||
/*
|
||||
int maxLen = 0;
|
||||
foreach (string[] row in data)
|
||||
foreach (string s in row)
|
||||
@@ -192,7 +246,7 @@ namespace PluginManager.Others
|
||||
|
||||
foreach (string[] row in data)
|
||||
{
|
||||
Console.Write("\t");
|
||||
//Console.Write("\t");
|
||||
if (row[0] == "-") Console.Write("+");
|
||||
else Console.Write("|");
|
||||
|
||||
@@ -225,7 +279,8 @@ namespace PluginManager.Others
|
||||
else Console.Write("|");
|
||||
}
|
||||
Console.WriteLine(); //end line
|
||||
}
|
||||
}*/
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Discord.Net" Version="3.1.0" />
|
||||
<PackageReference Include="Discord.Net" Version="3.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user