Skip to content

Commit

Permalink
Improved Setup
Browse files Browse the repository at this point in the history
Update Dependency
  • Loading branch information
C9Glax committed Jan 19, 2024
1 parent 6778375 commit 92cc79f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion OpenCS2hock/OpenCS2hock.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<ItemGroup>
<PackageReference Include="CS2GSI" Version="1.0.7" />
<PackageReference Include="CShocker" Version="1.2.3" />
<PackageReference Include="CShocker" Version="1.2.5" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

Expand Down
19 changes: 11 additions & 8 deletions OpenCS2hock/Setup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,23 +218,26 @@ private static List<string> AddShockerIds()

private static List<string> GetShockerIds(List<Shocker> shockers)
{
List<string> allShockerIds = new();
foreach(Shocker shocker in shockers)
allShockerIds.AddRange(shocker.ShockerIds);

List<string> ids = new();
bool addAnother = true;
while (ids.Count < 1 || addAnother)
{
Console.WriteLine("Select Shocker API:");
for(int i = 0; i < shockers.Count; i++)
Console.WriteLine($"{i}) {shockers[i]}");

int selectedShocker;
while (!int.TryParse(Console.ReadLine(), out selectedShocker) || selectedShocker < 0 || selectedShocker >= shockers.Count)
Console.WriteLine("Select Shocker API:");

for (int i = 0; i < allShockerIds.Count; i++)
Console.WriteLine($"{i}) {allShockerIds[i]}");
for (int i = 0; i < shockers[selectedShocker].ShockerIds.Count; i++)
Console.WriteLine($"{i}) {shockers[selectedShocker].ShockerIds[i]}");

int selectedIndex;
while (!int.TryParse(Console.ReadLine(), out selectedIndex) || selectedIndex < 0 || selectedIndex >= allShockerIds.Count)
while (!int.TryParse(Console.ReadLine(), out selectedIndex) || selectedIndex < 0 || selectedIndex >= shockers[selectedShocker].ShockerIds.Count)
Console.WriteLine("Select ID:");

ids.Add(allShockerIds[selectedIndex]);
ids.Add(shockers[selectedShocker].ShockerIds[selectedIndex]);

Console.WriteLine("Add another ID? (Y/N):");
addAnother = Console.ReadKey().Key == ConsoleKey.Y;
Expand Down

0 comments on commit 92cc79f

Please sign in to comment.