This repository has been archived by the owner on Nov 10, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
102 additions
and
24 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
37 changes: 37 additions & 0 deletions
37
RiotGames.LeagueOfLegends.LeagueClient.Client/LeagueClient.Process.cs
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System.Diagnostics; | ||
using RiotGames.Messaging; | ||
// ReSharper disable UnusedMember.Global | ||
|
||
namespace RiotGames.LeagueOfLegends.LeagueClient; | ||
|
||
/// <summary> | ||
/// You can use it to communicate with the League Client. Didn't want to name it LeagueClientClient. | ||
/// </summary> | ||
public partial class LeagueClient | ||
{ | ||
private Process? _process; | ||
|
||
/// <summary> | ||
/// Occurs when the League Client exits. | ||
/// </summary> | ||
public event EventHandler Exited | ||
{ | ||
add | ||
{ | ||
_process ??= LockFile.GetProcess(); | ||
|
||
_process.Exited += value; | ||
|
||
} | ||
remove | ||
{ | ||
_process!.Exited -= value; | ||
|
||
//if (_process.Exited == null) | ||
//{ | ||
// _process.Dispose(); | ||
// _process = null; | ||
//} | ||
} | ||
} | ||
} |
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
20 changes: 18 additions & 2 deletions
20
RiotGames.LeagueOfLegends.LeagueClient.Client/LeagueClientEventHandler.cs
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,3 +1,19 @@ | ||
namespace RiotGames.LeagueOfLegends.LeagueClient; | ||
using RiotGames.Messaging; | ||
|
||
public delegate void LeagueClientEventHandler<in T>(object sender, T args); | ||
namespace RiotGames.LeagueOfLegends.LeagueClient; | ||
|
||
public delegate void LeagueClientEventHandler<T>(object sender, LeagueClientEventArgs<T> args); | ||
|
||
public class LeagueClientEventArgs<T> : RmsEventArgs<T> | ||
{ | ||
public LeagueClientEventArgs(RmsChangeType changeType, T data) : base(changeType, data) | ||
{ | ||
} | ||
} | ||
|
||
internal static class LeagueClientEventExtensions | ||
{ | ||
internal static void Invoke<T>(this LeagueClientEventHandler<T> eventHandler, object sender, | ||
RmsChangeType changeType, T data) => | ||
eventHandler.Invoke(sender, new LeagueClientEventArgs<T>(changeType, data)); | ||
} |
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
3 changes: 2 additions & 1 deletion
3
...Messaging.Client/Messages/RmsEventType.cs → ...essaging.Client/Messages/RmsChangeType.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace RiotGames.Messaging; | ||
|
||
public class RmsEventArgs<T> : EventArgs | ||
{ | ||
public RmsEventArgs(RmsChangeType changeType, T data) | ||
{ | ||
ChangeType = changeType; | ||
Data = data; | ||
} | ||
|
||
public RmsChangeType ChangeType { get; } | ||
public T Data { get; } | ||
} |
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