Skip to content
This repository has been archived by the owner on Nov 21, 2019. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
nairaner committed Dec 27, 2014
2 parents b7c754f + 8c7d394 commit 8b8eab7
Show file tree
Hide file tree
Showing 15 changed files with 311 additions and 101 deletions.
2 changes: 1 addition & 1 deletion LegendaryClient/Controls/ChatItem.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

<TextBox x:Name="ChatTextBox" Width="250" Height="23" Margin="10,0,0,10" HorizontalAlignment="Left"
VerticalAlignment="Bottom" TextWrapping="Wrap" />
<Button x:Name="SendButton" Width="75" Height="26" Margin="0,0,10,10"
<Button x:Name="SendButton" Width="76" Height="26" Margin="0,0,11,10"
HorizontalAlignment="Right" VerticalAlignment="Bottom" Content="Send"
Click="SendButton_Click"
IsDefault="True" />
Expand Down
68 changes: 34 additions & 34 deletions LegendaryClient/Logic/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static string ToSHA1(this string input)
using (SHA1Managed sha1 = new SHA1Managed())
{
var hash = sha1.ComputeHash(Encoding.UTF8.GetBytes(input));
return Convert.ToBase64String(hash);
return System.Convert.ToBase64String(hash);
}
}
internal static bool patching = true;
Expand Down Expand Up @@ -124,7 +124,7 @@ public static Dictionary<String, String> LeagueSettingsReader(this string fileLo
}

public static bool InstaCall = false;
public static string CallString = "";
public static string CallString = string.Empty;

public static Brush Change()
{
Expand Down Expand Up @@ -168,9 +168,9 @@ internal static async Task<LoginDataPacket> AddAccount(string username, string p
var credentials = new AuthenticationCredentials
{
ClientVersion = Version,
AuthToken = "",
AuthToken = string.Empty,
Password = password,
IpAddress = ""
IpAddress = string.Empty
};
//pvp.Login();
return new LoginDataPacket();
Expand Down Expand Up @@ -264,7 +264,7 @@ internal static async Task<LoginDataPacket> AddAccount(string username, string p
/// <summary>
/// The current directory the client is running from
/// </summary>
internal static string ExecutingDirectory = "";
internal static string ExecutingDirectory = string.Empty;

/// <summary>
/// Riot's database with all the client data
Expand Down Expand Up @@ -424,7 +424,7 @@ internal static async void GameInvite(object sender, PVPNetConnection PVPConnect

internal static void ChatClientConnect(object sender)
{
Level = Convert.ToInt32(LoginPacket.AllSummonerData.SummonerLevel.Level);
Level = System.Convert.ToInt32(LoginPacket.AllSummonerData.SummonerLevel.Level);
Groups.Add(new Group("Online"));

//Get all groups
Expand Down Expand Up @@ -629,32 +629,32 @@ internal static void PresManager_OnPrimarySessionChange(object sender, JID bare)
{
case "profileIcon":
reader.Read();
Player.ProfileIcon = Convert.ToInt32(reader.Value);
Player.ProfileIcon = System.Convert.ToInt32(reader.Value);
break;

case "level":
reader.Read();
Player.Level = Convert.ToInt32(reader.Value);
Player.Level = System.Convert.ToInt32(reader.Value);
break;

case "wins":
reader.Read();
Player.Wins = Convert.ToInt32(reader.Value);
Player.Wins = System.Convert.ToInt32(reader.Value);
break;

case "leaves":
reader.Read();
Player.Leaves = Convert.ToInt32(reader.Value);
Player.Leaves = System.Convert.ToInt32(reader.Value);
break;

case "rankedWins":
reader.Read();
Player.RankedWins = Convert.ToInt32(reader.Value);
Player.RankedWins = System.Convert.ToInt32(reader.Value);
break;

case "timeStamp":
reader.Read();
Player.Timestamp = Convert.ToInt64(reader.Value);
Player.Timestamp = System.Convert.ToInt64(reader.Value);
break;

case "statusMsg":
Expand Down Expand Up @@ -726,17 +726,17 @@ internal static string GetObfuscatedChatroomName(string Subject, string Type)
byte[] data = Encoding.UTF8.GetBytes(Subject);
SHA1 sha = new SHA1CryptoServiceProvider();
byte[] result = sha.ComputeHash(data);
string obfuscatedName = "";
string obfuscatedName = string.Empty;
int incrementValue = 0;
while (incrementValue < result.Length)
{
int bitHack = result[incrementValue];
obfuscatedName = obfuscatedName + Convert.ToString(((uint)(bitHack & 240) >> 4), 16);
obfuscatedName = obfuscatedName + Convert.ToString(bitHack & 15, 16);
obfuscatedName = obfuscatedName + System.Convert.ToString(((uint)(bitHack & 240) >> 4), 16);
obfuscatedName = obfuscatedName + System.Convert.ToString(bitHack & 15, 16);
incrementValue = incrementValue + 1;
}
obfuscatedName = Regex.Replace(obfuscatedName, @"/\s+/gx", "");
obfuscatedName = Regex.Replace(obfuscatedName, @"/[^a-zA-Z0-9_~]/gx", "");
obfuscatedName = Regex.Replace(obfuscatedName, @"/\s+/gx", string.Empty);
obfuscatedName = Regex.Replace(obfuscatedName, @"/[^a-zA-Z0-9_~]/gx", string.Empty);

return Type + "~" + obfuscatedName;
}
Expand Down Expand Up @@ -907,7 +907,7 @@ UIElement element in
/// <summary>
/// Game Name of the current game that the client is connected to
/// </summary>
internal static string GameName = "";
internal static string GameName = string.Empty;

/// <summary>
/// The DTO of the game lobby when connected to a custom game
Expand Down Expand Up @@ -980,7 +980,7 @@ internal static void OnMessageReceived(object sender, object message)
default:
messageOver.MessageTextBox.Text = notification.MessageCode + Environment.NewLine;
messageOver.MessageTextBox.Text = Convert.ToString(notification.MessageArgument);
messageOver.MessageTextBox.Text = System.Convert.ToString(notification.MessageArgument);
break;
}
OverlayContainer.Content = messageOver.Content;
Expand Down Expand Up @@ -1118,29 +1118,29 @@ internal static string InternalQueueToPretty(string internalQueue)
/// <summary>
/// Super complex method to get the queue name when it is unknown
/// </summary>
/// <param name="QueueName"></param>
/// <param name="queueName"></param>
/// <returns></returns>
private static string convert(string QueueName)
private static string Convert(string queueName)
{
string result = string.Empty;
string Queueinternal = "";
string Bots = "";
const string Players = "";
const string Extra = "";
string start = QueueName.Replace("matching-queue-", "").Replace("-game-queue", "");
string queueinternal = string.Empty;
string bots = string.Empty;
const string players = "";
const string extra = "";
string start = queueName.Replace("matching-queue-", string.Empty).Replace("-game-queue", string.Empty);
string[] x = start.Split('_');
if (x[1].ToLower() == "bot")
{
Bots = " Bots";
bots = " Bots";
string[] m = x[3].Split('-');
}
else if (x[0].ToLower() == "bot" && x[1].ToLower() == "intro")
{
Queueinternal = "Intro";
Bots = "Bots";
queueinternal = "Intro";
bots = "Bots";
}

result = string.Format("{0}{1} {2} {3}", Queueinternal, Bots, Players, Extra);
result = string.Format("{0}{1} {2} {3}", queueinternal, bots, players, extra);
return result;
}

Expand Down Expand Up @@ -1309,7 +1309,7 @@ public static String TitleCaseString(String s)
continue;

Char firstChar = Char.ToUpper(words[i][0]);
String rest = "";
String rest = string.Empty;
if (words[i].Length > 1)
rest = words[i].Substring(1).ToLower();

Expand Down Expand Up @@ -1373,7 +1373,7 @@ public static BitmapImage GetImage(string address)

internal static void ChatClient_OnPresence(object sender, Presence pres)
{
if (pres.InnerText == "")
if (pres.InnerText == string.Empty)
ChatClient.Presence(CurrentPresence, GetPresence(), presenceStatus, 0);
}

Expand Down Expand Up @@ -1408,7 +1408,7 @@ internal static string EncryptStringAES(this string input, string secret)
swEncrypt.Write(input);
}
}
output = Convert.ToBase64String(msEncrypt.ToArray());
output = System.Convert.ToBase64String(msEncrypt.ToArray());
}
}
finally
Expand All @@ -1433,7 +1433,7 @@ public static string DecryptStringAES(this string input, string Secret)
var key = new Rfc2898DeriveBytes(Secret, Encoding.ASCII.GetBytes("o6806642kbM7c5"));

// Create the streams used for decryption.
byte[] bytes = Convert.FromBase64String(input);
byte[] bytes = System.Convert.FromBase64String(input);
using (var msDecrypt = new MemoryStream(bytes))
{
// Create a RijndaelManaged object
Expand Down
6 changes: 3 additions & 3 deletions LegendaryClient/Logic/JSON/Runes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static List<runes> PopulateRunes()
{
var runeList = new List<runes>();

string runeJson =
var runeJson =
File.ReadAllText(Path.Combine(Client.ExecutingDirectory, "Assets", "data", "en_US", "rune.json"));
var serializer = new JavaScriptSerializer();
var deserializedJson = serializer.Deserialize<Dictionary<string, object>>(runeJson);
Expand All @@ -39,14 +39,14 @@ public static List<runes> PopulateRunes()
description = singularRuneData["description"] as string
};
newRune.description = newRune.description.Replace("(", "\n");
newRune.description = newRune.description.Replace(")", "");
newRune.description = newRune.description.Replace(")", string.Empty);
newRune.stats = singularRuneData["stats"] as Dictionary<string, object>;
newRune.tags = singularRuneData["tags"] as ArrayList;

var imageData = singularRuneData["image"] as Dictionary<string, object>;
if (imageData != null)
{
string uriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "rune",
var uriSource = Path.Combine(Client.ExecutingDirectory, "Assets", "rune",
(string) imageData["full"]);
newRune.icon = Client.GetImage(uriSource);
}
Expand Down
27 changes: 12 additions & 15 deletions LegendaryClient/Windows/PatcherPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
using ICSharpCode.SharpZipLib.Tar;
using LegendaryClient.Logic;
using LegendaryClient.Logic.Patcher;
using LegendaryClient.Logic.SQLite;
using LegendaryClient.Logic.UpdateRegion;
using LegendaryClient.Properties;
using Microsoft.Win32;
Expand All @@ -36,7 +35,7 @@ namespace LegendaryClient.Windows
public partial class PatcherPage
{
//#FF2E2E2E
internal static bool LoLDataIsUpToDate = false;
internal static bool LoLDataIsUpToDate;
internal static string LatestLolDataVersion = string.Empty;
internal static string LolDataVersion = string.Empty;

Expand All @@ -45,11 +44,7 @@ public PatcherPage()
InitializeComponent();
Change();


if (Settings.Default.updateRegion != string.Empty)
UpdateRegionComboBox.SelectedValue = Settings.Default.updateRegion;
else
UpdateRegionComboBox.SelectedValue = "Live";
UpdateRegionComboBox.SelectedValue = Settings.Default.updateRegion != string.Empty ? Settings.Default.updateRegion : "Live";
Client.UpdateRegion = (string)UpdateRegionComboBox.SelectedValue;

bool x = Settings.Default.DarkTheme;
Expand Down Expand Up @@ -267,7 +262,6 @@ private void StartPatcher()
File.ReadAllText(Path.Combine(Client.ExecutingDirectory, "Assets", "VERSION_AIR"));
LogTextBox("Current Air Assets Version: " + airVersion);
var updateClient = new WebClient();
string vers = latestAir;
if (airVersion != latestAir)
{
//Download Air Assists from riot
Expand All @@ -277,16 +271,19 @@ private void StartPatcher()
string[] allFiles = patcher.GetManifest(airManifestLink);
int i = 0;
while (!allFiles[i].Contains("gameStats_en_US.sqlite"))
{
i++;
}
string gameStatsLink = allFiles[i].Split(',')[0];
updateClient.DownloadFile(
new Uri(updateRegion.AirManifest + allFiles[i].Split(',')[0]),
Path.Combine(Client.ExecutingDirectory, "gameStats_en_US.sqlite"));
GetAllPngs(allFiles);
if (File.Exists(Path.Combine(Client.ExecutingDirectory, "Assets", "VERSION_AIR")))
{
File.Delete(Path.Combine(Client.ExecutingDirectory, "Assets", "VERSION_AIR"));
}
using (
FileStream file =
Expand Down Expand Up @@ -446,12 +443,12 @@ private string GetLolRootPath(bool restart)
RegistryKey key = Registry.CurrentUser.CreateSubKey("Software\\RIOT GAMES");
if (key != null)
key.SetValue("Path",
findLeagueDialog.FileName.Replace("lol.launcher.exe", "").Replace("lol.launcher.admin.exe", ""));
findLeagueDialog.FileName.Replace("lol.launcher.exe", string.Empty).Replace("lol.launcher.admin.exe", string.Empty));

if (restart)
LogTextBox("Saved value, please restart the client to login.");

return findLeagueDialog.FileName.Replace("lol.launcher.exe", "").Replace("lol.launcher.admin.exe", "");
return findLeagueDialog.FileName.Replace("lol.launcher.exe", string.Empty).Replace("lol.launcher.admin.exe", string.Empty);
}

private void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
Expand All @@ -462,7 +459,7 @@ private void client_DownloadProgressChanged(object sender, DownloadProgressChang

Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
{
CurrentProgressBar.Value = int.Parse(Math.Truncate(percentage).ToString());
CurrentProgressBar.Value = int.Parse(Math.Truncate(percentage).ToString(CultureInfo.InvariantCulture));
CurrentProgressLabel.Content = "Now downloading LegendaryClient";
}));
}
Expand Down Expand Up @@ -553,7 +550,7 @@ private string GetMd5()

stream.Close();

string rtrn = md5.Hash.Aggregate("", (current, t) => current + (t.ToString("x2")));
string rtrn = md5.Hash.Aggregate(string.Empty, (current, t) => current + (t.ToString("x2")));
return rtrn.ToUpper();
}

Expand Down Expand Up @@ -657,7 +654,7 @@ private void GetAllExe(string packageManifest)

UncompressFile(Path.Combine(Client.ExecutingDirectory, "RADS", "lol_game_client", savePlace),
Path.Combine(Client.ExecutingDirectory, "RADS", "lol_game_client", savePlace)
.Replace(".compressed", ""));
.Replace(".compressed", string.Empty));
File.Delete(Path.Combine(Client.ExecutingDirectory, "RADS", "lol_game_client", savePlace));
}
}
Expand Down Expand Up @@ -784,7 +781,7 @@ private void UpdateFrom(string version, string packageManifest)
}
UncompressFile(Path.Combine(Client.ExecutingDirectory, "RADS", "lol_game_client", savePlace),
Path.Combine(Client.ExecutingDirectory, "RADS", "lol_game_client", savePlace)
.Replace(".compressed", ""));
.Replace(".compressed", string.Empty));
try
{
File.Delete(Path.Combine(Client.ExecutingDirectory, "RADS", "lol_game_client", savePlace));
Expand Down
Loading

0 comments on commit 8b8eab7

Please sign in to comment.