Skip to content

Commit

Permalink
OSL-Client
Browse files Browse the repository at this point in the history
  • Loading branch information
Sky-CSC committed Nov 10, 2022
1 parent 5e71152 commit e32fd5d
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 40 deletions.
62 changes: 34 additions & 28 deletions OSL-Client/OSL-Client.csproj
Original file line number Diff line number Diff line change
@@ -1,35 +1,41 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>OSL_Client</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<StartupObject></StartupObject>
<ApplicationIcon>Icone_Feu.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>OSL_Client</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<StartupObject></StartupObject>
<ApplicationIcon>Icone_Feu.ico</ApplicationIcon>
<Copyright>Sky-csc</Copyright>
<PackageProjectUrl>https://github.com/Sky-CSC/OSL</PackageProjectUrl>
<AssemblyVersion>0.1.0.0</AssemblyVersion>
<FileVersion>0.1.0.0</FileVersion>
</PropertyGroup>

<ItemGroup>
<Content Include="Icone_Feu.ico" />
</ItemGroup>
<ItemGroup>
<Content Include="Icone_Feu.ico" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="6.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="6.0.9" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Core" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="6.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

<ItemGroup>
<None Update="Configuration\configHost.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Configuration\configRiot.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Update="Configuration\configHost.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Configuration\configRiot.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
12 changes: 12 additions & 0 deletions OSL-Client/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
using OSL_Client.RiotApp.API.LCU;
using System.Diagnostics;
using System.Runtime.InteropServices;
using OSL_Client.RiotApp.MemoryProcessing;
using OSL_Client.Communication.OSLServer;
using System.Net;

Console.WriteLine("");
OSLLogger logger = new("Program");
Expand All @@ -22,6 +25,9 @@
//Config.LoadConfigHost();
//Initialisation for acces att the champion selection or a game
//PostCom.Test2();
String data = "Bonjour Skynet";
AsyncClient.StartClient(data);

while (true)
{
if (LaunchChecker.LoLLauncherCheck())
Expand All @@ -38,6 +44,10 @@
// LcuApi.GameFlowPhaseCheck(gameFlowPhase);

//}
//Console.WriteLine("Start");
//TestClass.Test();
//Console.WriteLine("End");

string gameFlowPhase;
do
{
Expand All @@ -52,6 +62,8 @@
}
}
}


//See what phase is of the game
//if (ApiRequest.RequestGameClientAPI(LcuApi.lolgameflowv1session))
//while (true)
Expand Down
10 changes: 10 additions & 0 deletions OSL-Client/RiotApp/API/LCU/LcuApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ public static void GameFlowPhaseCheck(string gameFlowPhase)
}
}
}

public class GameFlowPhaseStatus
{
//public Int64 IdGame { get; set; }
public string? Phase { get; set; }
public string? Status { get; set; }
public string? Date { get; set; }
}

public class UrlRequest
{
public static readonly string riotclientappname = "/riotclient/app-name"; //Application name without file extension
Expand All @@ -114,6 +123,7 @@ public class UrlRequest
//lol-champ-select
public static readonly string lolchampselectv1gridchampions = "/lol-champ-select/v1/grid-champions/"; //
public static readonly string lolchampselectv1session = "/lol-champ-select/v1/session"; //
public static readonly string lolsummonerv1summonersid = "/lol-summoner/v1/summoners/"; //
public static readonly string lolchampselectv1bannablechampionids = "/lol-champ-select/v1/bannable-champion-ids"; //All champ possible to ban
public static readonly string lolchampselectv1currentchampion = "/lol-champ-select/v1/current-champion"; //No info

Expand Down
40 changes: 28 additions & 12 deletions OSL-Client/RiotApp/DataProcessing/ChampSelectProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using OSL_Client.Communication.OSLServer;
using OSL_Client.FileManager;
using OSL_Client.RiotApp.API;
using OSL_Client.RiotApp.API.LCU;
Expand All @@ -23,22 +24,23 @@ public static void InChampSelect()
{
NewGameProcess.IdGame = random.NextInt64(); //Possible server give IdGame
//Send to server json
var champSelect = new ChampSelect
var champSelectStart = new GameFlowPhaseStatus
{
IdGame = NewGameProcess.IdGame,
Info = "ChampSelect",
//IdGame = NewGameProcess.IdGame,
Phase = "ChampSelect",
Status = "Running",
Date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
};
string InChampSelectSend = JsonConvert.SerializeObject(champSelect); //send to server information
string InChampSelectStartSend = JsonConvert.SerializeObject(champSelectStart); //send to server information
AsyncClient.StartClient(InChampSelectStartSend);

//All information necessary for display pick and ban overlay
string champSelectContentPrevious = "";
string champSelectContent;
int i = 0;
while ((champSelectContent = ApiRequest.RequestGameClientAPI(UrlRequest.lolchampselectv1session)) != null)
{
_logger.log(LoggingLevel.INFO, "ManageChampionSelect()", $"ChampSelectContent is {champSelectContent}");
//_logger.log(LoggingLevel.INFO, "ManageChampionSelect()", $"ChampSelectContent is {champSelectContent}");
if (!champSelectContent.Equals(champSelectContentPrevious))
{
champSelectContentPrevious = champSelectContent;
Expand Down Expand Up @@ -96,14 +98,28 @@ public static void InChampSelect()
FileManagerLocal.RewrittenFile($"E:/Overlay-found-riot/ChampSelectAll/champSelectAll{i}.json", champSelectContent);
_logger.log(LoggingLevel.INFO, "ManageChampionSelect()", "Send ChampSelectContent");
i++;

//Send to Server ChampSelectContent
AsyncClient.StartClient(champSelectContent);


}
else
{
_logger.log(LoggingLevel.WARN, "ManageChampionSelect()", "No modification of ChampSelectContent");
}
Thread.Sleep(1000);
}
//Send to server json
var champSelectEnd = new GameFlowPhaseStatus
{
//IdGame = NewGameProcess.IdGame,
Phase = "ChampSelect",
Status = "End",
Date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
};
string InChampSelectEndSend = JsonConvert.SerializeObject(champSelectEnd); //send to server information
AsyncClient.StartClient(InChampSelectEndSend);
_logger.log(LoggingLevel.WARN, "ManageChampionSelect()", "End of ChampSelect");
}

Expand All @@ -112,12 +128,12 @@ private class summoner
public string NameSummoner { get; set; }
}

private class ChampSelect
{
public Int64 IdGame { get; set; }
public string? Info { get; set; }
public string? Status { get; set; }
public string? Date { get; set; }
}
//private class ChampSelect
//{
// public Int64 IdGame { get; set; }
// public string? Info { get; set; }
// public string? Status { get; set; }
// public string? Date { get; set; }
//}
}
}
13 changes: 13 additions & 0 deletions OSL-Client/RiotApp/DataProcessing/NewGameProcess.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OSL_Client.RiotApp.DataProcessing
{
internal class NewGameProcess
{
public static Int64 IdGame = 0;
}
}

0 comments on commit e32fd5d

Please sign in to comment.