Skip to content
This repository was archived by the owner on Oct 12, 2023. It is now read-only.

Commit

Permalink
Improved GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
lnx00 committed Jun 1, 2022
1 parent 0fda06e commit 0fc0cff
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 107 deletions.
49 changes: 18 additions & 31 deletions Fedoraloader/MainWindow.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 2 additions & 36 deletions Fedoraloader/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,6 @@ namespace Fedoraloader
{
public partial class MainWindow : Form
{
#region Signatures
[DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")]
private static extern IntPtr CreateRoundRectRgn
(
int nLeftRect,
int nTopRect,
int nRightRect,
int nBottomRect,
int nWidthEllipse,
int nHeightEllipse
);
#endregion

public const string ACTION_URL = "https://nightly.link/tf2cheater2013/Fedoraware/workflows/msbuild/main/Fedoraware.zip";
public static bool IsElevated => new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator);

Expand All @@ -34,7 +21,6 @@ int nHeightEllipse
public MainWindow()
{
InitializeComponent();
Region = Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 15, 15));

// Check for administrator rights
if (!IsElevated)
Expand All @@ -54,13 +40,11 @@ public MainWindow()
Debug.WriteLine(_workDir);

chkBypass.Checked = Properties.Settings.Default.bypass;
chkDefender.Checked = Properties.Settings.Default.defender;

Text = Utils.RandomString(8);

// Initialize tooltips
mainToolTip.SetToolTip(chkBypass, "Starts Steam with a VAC Bypass.\nThis will restart Steam and TF2.");
mainToolTip.SetToolTip(chkDefender, "Tries to add Windows Defender exceptions for Fedoraloader.");
}

private async void btnLoad_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -111,19 +95,6 @@ private void RunLoader()
{
string dlPath = _fileDir + @"\" + Utils.RandomString(8) + ".zip";

// Add defender exception if enabled
if (chkDefender.Checked)
{
UpdateStatus("Adding Defender exception...");
if (!Utils.AddDefender(Directory.GetCurrentDirectory()) || !Utils.AddDefender(_workDir))
{
if (MessageBox.Show("Failed to add Defender exception!\nDo you want to continue?", "", MessageBoxButtons.YesNo) == DialogResult.No)
{
return;
}
}
}

Thread.Sleep(250);

// Download latest build
Expand Down Expand Up @@ -308,7 +279,8 @@ private bool VacBypass()
do
{
Thread.Sleep(1500);
} while (Process.GetProcesses().Count(p => p.ProcessName is "hl2") == 0);
} while (!Process.GetProcesses().Any(p => p.ProcessName is "hl2"));
Thread.Sleep(500);

return true;
}
Expand Down Expand Up @@ -360,12 +332,6 @@ private void chkBypass_CheckedChanged(object sender, EventArgs e)
Properties.Settings.Default.bypass = chkBypass.Checked;
Properties.Settings.Default.Save();
}

private void chkDefender_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.defender = chkDefender.Checked;
Properties.Settings.Default.Save();
}
#endregion
}
}
12 changes: 6 additions & 6 deletions Fedoraloader/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,18 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=6.0.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=6.0.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=6.0.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="logo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\img\logo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="gradient" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\img\gradient.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="logo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\img\logo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="VAC-Bypass" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\VAC-Bypass.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
Expand Down
14 changes: 1 addition & 13 deletions Fedoraloader/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions Fedoraloader/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Fedoraloader.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="defender" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="bypass" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
Expand Down
18 changes: 0 additions & 18 deletions Fedoraloader/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,5 @@ public static string RandomString(int length)
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
return new string(Enumerable.Repeat(chars, length).Select(s => s[_random.Next(s.Length)]).ToArray());
}

public static bool AddDefender(string pDirectory)
{
try
{
PowerShell.Create()
.AddScript(@"Add-MpPreference -ExclusionPath '" + pDirectory + "'")
.Invoke();

Debug.WriteLine("Added folder to defender: " + pDirectory);
}
catch (Exception)
{
return false;
}

return true;
}
}
}

0 comments on commit 0fc0cff

Please sign in to comment.