Skip to content

Commit

Permalink
remove unneccesary whitespace and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MELVARDEV committed Jul 13, 2021
1 parent cda2d96 commit 7cccf86
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 105 deletions.
13 changes: 0 additions & 13 deletions LeagueAccManager/AutoFill.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ public static void lol(Process pr)
{
if (window.GetType() == typeof(MainWindow))
{


try
{
selectedAccount = (LolAccount)(window as MainWindow).datagrid1.SelectedItem;
Expand All @@ -52,14 +50,12 @@ public static void lol(Process pr)
try
{
mainWindow.FindFirstDescendant(cf.ByName("USERNAME")).AsTextBox().Text = result.UserName;

tryAgain = false;
}
catch (Exception e) { }
}
}


tryAgain = true;
if (!String.IsNullOrEmpty(result.Password))
{
Expand All @@ -74,7 +70,6 @@ public static void lol(Process pr)
}
}


tryAgain = true;
while (tryAgain)
{
Expand All @@ -89,13 +84,11 @@ public static void lol(Process pr)
catch (Exception e) { }
}


tryAgain = true;
while (tryAgain)
{
try
{

mainWindow.FindFirstDescendant(cf.ByName("Sign in").And(cf.ByControlType(ControlType.Button))).AsButton().Invoke();
tryAgain = false;
}
Expand Down Expand Up @@ -130,8 +123,6 @@ public static void valorant(Process pr)
{
if (window.GetType() == typeof(MainWindow))
{


try
{
selectedAccount = (ValorantAccount)(window as MainWindow).dataGridValorant.SelectedItem;
Expand All @@ -153,7 +144,6 @@ public static void valorant(Process pr)
try
{
mainWindow.FindFirstDescendant(cf.ByName("USERNAME")).AsTextBox().Text = result.UserName;

tryAgain = false;
}
catch (Exception e) { }
Expand Down Expand Up @@ -196,7 +186,6 @@ public static void valorant(Process pr)
{
try
{

mainWindow.FindFirstDescendant(cf.ByName("Sign in").And(cf.ByControlType(ControlType.Button))).AsButton().Invoke();
tryAgain = false;
}
Expand All @@ -206,9 +195,7 @@ public static void valorant(Process pr)

if ((window as MainWindow).settings.exitAfterFill)
{

(window as MainWindow).Close();

}
return;

Expand Down
4 changes: 0 additions & 4 deletions LeagueAccManager/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ public static void wait(int milliseconds)
{
var timer1 = new System.Windows.Forms.Timer();
if (milliseconds == 0 || milliseconds < 0) return;

// Console.WriteLine("start wait timer");
timer1.Interval = milliseconds;
timer1.Enabled = true;
timer1.Start();
Expand All @@ -32,12 +30,10 @@ public static void wait(int milliseconds)
{
timer1.Enabled = false;
timer1.Stop();
// Console.WriteLine("stop wait timer");
};

while (timer1.Enabled)
{

}
}
}
Expand Down
27 changes: 1 addition & 26 deletions LeagueAccManager/LolAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ public string getIcon()
{
using (WebClient myWebClient = new WebClient())
{

// Download the Web resource and save it into the current filesystem folder.
// Download icon
myWebClient.DownloadFile($"https://raw.communitydragon.org/latest/plugins/rcp-be-lol-game-data/global/default/v1/profile-icons/{this.ProfileIconId}.jpg", path);
}
});
Expand All @@ -182,15 +181,9 @@ public string iconPath
{
get
{

string path = getIcon();
Raise("iconPath");



return path;


}
set
{
Expand Down Expand Up @@ -248,43 +241,25 @@ private void getApiData()
{
HttpClient leagueReq = new HttpClient();
var leagueContent = await leagueReq.GetAsync($"https://express-tp4i3olaqq-ez.a.run.app/riot/league/{this.Region}/{this.SummonerName}");

JsonConvert.PopulateObject(await leagueContent.Content.ReadAsStringAsync(), this);

}
catch (Exception ex)
{

this.Tier = "Unranked";


}

try
{
HttpClient summonerReq = new HttpClient();
var summonerContent = await summonerReq.GetAsync($"https://express-tp4i3olaqq-ez.a.run.app/riot/summoner/{this.Region}/{this.SummonerName}");



JsonConvert.PopulateObject(await summonerContent.Content.ReadAsStringAsync(), this);

}
catch (Exception ex)
{

}





getIcon();
Raise("IconPath");




});

foreach (Window window in Application.Current.Windows)
Expand Down
61 changes: 1 addition & 60 deletions LeagueAccManager/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,6 @@ public MainWindow()

}





private async void fillButton_Click(object sender, RoutedEventArgs e)
{

Expand Down Expand Up @@ -309,26 +305,15 @@ private async void fillButton_Click(object sender, RoutedEventArgs e)
Console.WriteLine(ex.Message);
}





leagueClientProcess = Process.Start(settings.riotClientPath, "--launch-product=league_of_legends --launch-patchline=live");


Process[] pname = Process.GetProcessesByName("RiotClientUx");
while (pname.Length == 0)
{
await Task.Delay(200);
pname = Process.GetProcessesByName("RiotClientUx");
}



// MessageBox.Show(leagueClientProcess.Id.ToString());



var mainWindowTitle = pname[0].MainWindowTitle;
while (mainWindowTitle != "Riot Client")
{
Expand All @@ -351,12 +336,8 @@ private async void fillButton_Click(object sender, RoutedEventArgs e)
else
{
MessageBox.Show("League of Legends login screen not found...");

this.Show();
}



}


Expand Down Expand Up @@ -425,26 +406,15 @@ private async void valorantFillButton_Click(object sender, RoutedEventArgs e)
Console.WriteLine(ex.Message);
}





valorantClientProcess = Process.Start(settings.riotClientPath, "--launch-product=valorant --launch-patchline=live");


Process[] pname = Process.GetProcessesByName("RiotClientUx");
while (pname.Length == 0)
{
await Task.Delay(200);
pname = Process.GetProcessesByName("RiotClientUx");
}



// MessageBox.Show(leagueClientProcess.Id.ToString());



var mainWindowTitle = pname[0].MainWindowTitle;
while (mainWindowTitle != "Riot Client")
{
Expand All @@ -461,24 +431,17 @@ private async void valorantFillButton_Click(object sender, RoutedEventArgs e)
}
}
await Task.Delay(settings.launchDelay);
// MessageBox.Show(pname[0].MainWindowTitle);
AutoFill.valorant(pname[0]);
}
else
{
MessageBox.Show("Valorant login screen not found...");

this.Show();
}



}


private async void datagrid1_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{

saveLolAccounts(password);
try
{
Expand All @@ -487,12 +450,10 @@ private async void datagrid1_CellEditEnding(object sender, DataGridCellEditEndin
datagrid1.Items.Refresh();
}
catch (Exception ex) { }

}

private async void dataGridValorant_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{

saveValorantAccounts(password);
try
{
Expand All @@ -501,11 +462,8 @@ private async void dataGridValorant_CellEditEnding(object sender, DataGridCellEd
dataGridValorant.Items.Refresh();
}
catch (Exception ex) { }

}



private void unlockButton_Click(object sender, RoutedEventArgs e)
{
password = encryptionKey.Password;
Expand All @@ -527,15 +485,11 @@ private void unlockButton_Click(object sender, RoutedEventArgs e)
Application.Current.MainWindow.Width = 846;
Helpers.CenterWindowOnScreen(this);
tabControl.Visibility = Visibility.Visible;


}

bool readValSuccess = await readValorantAccounts();
if (readValSuccess)
{


dataGridValorant.ItemsSource = null;
dataGridValorant.ItemsSource = valorantAccounts;
dataGridValorant.Items.Refresh();
Expand All @@ -546,19 +500,14 @@ private void unlockButton_Click(object sender, RoutedEventArgs e)
Application.Current.MainWindow.Width = 846;
Helpers.CenterWindowOnScreen(this);
tabControl.Visibility = Visibility.Visible;



}

if (!readValSuccess && !readLolSuccess)
{
MessageBox.Show("Wrong encryption key!");
}
});

});

}

private async void datagrid1_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e)
Expand Down Expand Up @@ -702,12 +651,12 @@ private void datagrid1_SelectionChanged(object sender, SelectionChangedEventArgs

}


private void exitAfterFillingSwitch_Unchecked(object sender, RoutedEventArgs e)
{
settings.exitAfterFill = false;
settings.save();
}

private void exitAfterFillingSwitch_Checked(object sender, RoutedEventArgs e)
{
settings.exitAfterFill = true;
Expand All @@ -716,21 +665,17 @@ private void exitAfterFillingSwitch_Checked(object sender, RoutedEventArgs e)

private void autoOpenClientSwitch_Checked(object sender, RoutedEventArgs e)
{

if (String.IsNullOrWhiteSpace(settings.riotClientPath) && tabControl.SelectedIndex == 1 && autoOpenClientSwitch.IsChecked == true)
{

OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.AddExtension = true;
openFileDialog.DefaultExt = "exe";
openFileDialog.Filter = "RiotClientServices.exe|RiotClientServices.exe";
if (openFileDialog.ShowDialog() == true)
{

settings.riotClientPath = openFileDialog.FileName;
settings.autoOpenClient = true;
autoOpenClientSwitch.IsChecked = true;

}
else
{
Expand All @@ -741,9 +686,7 @@ private void autoOpenClientSwitch_Checked(object sender, RoutedEventArgs e)
else
{
settings.autoOpenClient = (bool)autoOpenClientSwitch.IsChecked;

}

settings.save();
}

Expand Down Expand Up @@ -810,12 +753,10 @@ private void changeValorantAccountLocation_Click(object sender, RoutedEventArgs
}
catch (Exception excep)
{

}
settings.valorantAccountFilePath = saveFileDialog.FileName;
valorantPassFileLocation.Text = saveFileDialog.FileName;
settings.save();

MessageBox.Show("New path saved.");
}
}
Expand Down
Loading

0 comments on commit 7cccf86

Please sign in to comment.