Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
Update 3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ic3w0lf22 committed Aug 1, 2022
1 parent abedee9 commit 660efeb
Show file tree
Hide file tree
Showing 25 changed files with 1,435 additions and 149 deletions.
2 changes: 1 addition & 1 deletion RBX Alt Manager/AccountManager.Designer.cs

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

114 changes: 89 additions & 25 deletions RBX Alt Manager/AccountManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public partial class AccountManager : Form
public static AccountManager Instance;
public static List<Account> AccountsList;
public static List<Account> SelectedAccounts;
public static List<RecentGame> RecentGames;
public static Account SelectedAccount;
public static RestClient MainClient;
public static RestClient FriendsClient;
Expand Down Expand Up @@ -69,11 +70,12 @@ public partial class AccountManager : Form

private static Mutex rbxMultiMutex;
private readonly static object saveLock = new object();
private readonly static object rgSaveLock = new object();

private bool LaunchNext;
private CancellationTokenSource LauncherToken;

private delegate void SafeCallDelegateRefresh();
private delegate void SafeCallDelegateRefresh(object obj);
private delegate void SafeCallDelegateGroup(string Group, OLVListItem Item = null);
private delegate void SafeCallDelegateRemoveAt(int Index);
private delegate void SafeCallDelegateUpdateAccountView(Account account);
Expand Down Expand Up @@ -147,8 +149,7 @@ private void Sink_Dropped(object sender, OlvDropEventArgs e)
if (e.Effect == DragDropEffects.Copy)
{
string Text = (string)e.DragEventArgs.Data.GetData(DataFormats.Text);

var RSecRegex = new Regex(@"(_\|WARNING:-DO-NOT-SHARE-THIS\.--Sharing-this-will-allow-someone-to-log-in-as-you-and-to-steal-your-ROBUX-and-items\.\|\w+)");
Regex RSecRegex = new Regex(@"(_\|WARNING:-DO-NOT-SHARE-THIS\.--Sharing-this-will-allow-someone-to-log-in-as-you-and-to-steal-your-ROBUX-and-items\.\|\w+)");
MatchCollection RSecMatches = RSecRegex.Matches(Text);

foreach (Match match in RSecMatches)
Expand All @@ -157,8 +158,9 @@ private void Sink_Dropped(object sender, OlvDropEventArgs e)
}

private readonly static string SaveFilePath = Path.Combine(Environment.CurrentDirectory, "AccountData.json");
private readonly static string RecentGamesFilePath = Path.Combine(Environment.CurrentDirectory, "RecentGames.json"); // i shouldve combined everything that isnt accountdata into one file but oh well im too lazy : |

private void RefreshView()
private void RefreshView(object obj = null)
{
if (AccountsView.InvokeRequired)
{
Expand All @@ -169,6 +171,9 @@ private void RefreshView()
{
AccountsView.BuildList(true);
AccountsView.BuildGroups();

if (obj != null)
AccountsView.EnsureModelVisible(obj);
}
}

Expand Down Expand Up @@ -305,17 +310,20 @@ public static Account AddAccount(string SecurityToken, string Password = "")

if (exists != null)
{
exists.SecurityToken = account.SecurityToken;
exists.SecurityToken = SecurityToken;
exists.Password = Password;
exists.LastUse = DateTime.Now;

Instance.RefreshView();
Utilities.InvokeIfRequired(Instance.AccountsView, () =>
{
Instance.AccountsView.UpdateObject(exists);
});
}
else
{
AccountsList.Add(account);

Instance.RefreshView();
Instance.RefreshView(account);
}

SaveAccounts();
Expand Down Expand Up @@ -372,13 +380,16 @@ private void AccountManager_Load(object sender, EventArgs e)
}
catch { }

if (File.Exists("AU.exe"))
string AFN = Path.Combine(Directory.GetCurrentDirectory(), "Auto Update.exe");
string AU2FN = Path.Combine(Directory.GetCurrentDirectory(), "AU.exe");

if (File.Exists(AU2FN))
{
if (File.Exists("Auto Update.exe"))
File.Delete("Auto Update.exe");
if (File.Exists(AFN))
File.Delete(AFN);

File.Copy("AU.exe", "Auto Update.exe");
File.Delete("AU.exe");
File.Copy(AU2FN, AFN);
File.Delete(AU2FN);
}

if (Directory.Exists(Path.Combine(Environment.CurrentDirectory, "Update")))
Expand Down Expand Up @@ -426,7 +437,7 @@ private void AccountManager_Load(object sender, EventArgs e)

PlaceID_TextChanged(PlaceID, new EventArgs());

IniSettings = File.Exists("RAMSettings.ini") ? new IniFile("RAMSettings.ini") : new IniFile();
IniSettings = File.Exists(Path.Combine(Environment.CurrentDirectory, "RAMSettings.ini")) ? new IniFile("RAMSettings.ini") : new IniFile();

General = IniSettings.Section("General");
Developer = IniSettings.Section("Developer");
Expand All @@ -439,6 +450,7 @@ private void AccountManager_Load(object sender, EventArgs e)
if (!General.Exists("DisableAgingAlert")) General.Set("DisableAgingAlert", "false");
if (!General.Exists("SavePasswords")) General.Set("SavePasswords", "true");
if (!General.Exists("ServerRegionFormat")) General.Set("ServerRegionFormat", "<city>, <countryCode>", "Visit http://ip-api.com/json/1.1.1.1 to see available format options");
if (!General.Exists("MaxRecentGames")) General.Set("MaxRecentGames", "8");

if (!Developer.Exists("DevMode")) Developer.Set("DevMode", "false");
if (!Developer.Exists("EnableWebServer")) Developer.Set("EnableWebServer", "false");
Expand Down Expand Up @@ -499,8 +511,6 @@ private void AccountManager_Load(object sender, EventArgs e)

if (result == DialogResult.Yes)
{
string AFN = Path.Combine(Directory.GetCurrentDirectory(), "Auto Update.exe");

if (File.Exists(AFN))
{
Process.Start(AFN);
Expand Down Expand Up @@ -546,12 +556,18 @@ private void AccountManager_Load(object sender, EventArgs e)
catch { }

IniSettings.Save("RAMSettings.ini");

PlaceID.AutoCompleteCustomSource = new AutoCompleteStringCollection();
PlaceID.AutoCompleteMode = AutoCompleteMode.Suggest;
PlaceID.AutoCompleteSource = AutoCompleteSource.CustomSource;

LoadRecentGames();
}

public void ApplyTheme()
{
this.BackColor = ThemeEditor.FormsBackground;
this.ForeColor = ThemeEditor.FormsForeground;
BackColor = ThemeEditor.FormsBackground;
ForeColor = ThemeEditor.FormsForeground;

if (AccountsView.BackColor != ThemeEditor.AccountBackground || AccountsView.ForeColor != ThemeEditor.AccountForeground)
{
Expand Down Expand Up @@ -608,6 +624,33 @@ public void ApplyTheme()
if (SettingsForm != null) SettingsForm.ApplyTheme();
}

private void LoadRecentGames()
{
RecentGames = new List<RecentGame>();

if (File.Exists(RecentGamesFilePath))
{
foreach (RecentGame RG in JsonConvert.DeserializeObject<List<RecentGame>>(File.ReadAllText(RecentGamesFilePath)))
AddRecentGame(RG);
}
}

private void AddRecentGame(RecentGame RG)
{
RecentGames.Add(RG);

while (RecentGames.Count > General.Get<int>("MaxRecentGames"))
{
PlaceID.AutoCompleteCustomSource.Remove(RecentGames[0].Name);
RecentGames.RemoveAt(0);
}

PlaceID.AutoCompleteCustomSource.Add(RG.Name);

lock (rgSaveLock)
File.WriteAllText(RecentGamesFilePath, JsonConvert.SerializeObject(RecentGames));
}

private List<ServerData> AttemptedJoins = new List<ServerData>();

private string SendResponse(HttpListenerContext Context)
Expand Down Expand Up @@ -875,7 +918,7 @@ private void AccountManager_Shown(object sender, EventArgs e)
if (!rbxMultiMutex.WaitOne(TimeSpan.Zero, true) && !General.Get<bool>("HideRbxAlert"))
MessageBox.Show("WARNING: Roblox is currently running, multi roblox will not work until you restart the account manager with roblox closed.", "Roblox Account Manager", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
finally { }
catch { }
}
}

Expand Down Expand Up @@ -969,12 +1012,20 @@ private void JoinServer_Click(object sender, EventArgs e)
if (PlaceID.Text.Contains("privateServerLinkCode") && IDMatch.Success)
JobID.Text = PlaceID.Text;

RecentGame G = RecentGames.FirstOrDefault(RG => RG.Name == PlaceID.Text);

if (G != null)
PlaceID.Text = G.PlaceId.ToString();

PlaceID.Text = IDMatch.Success ? IDMatch.Groups[1].Value : Regex.Replace(PlaceID.Text, "[^0-9]", "");

bool VIPServer = JobID.TextLength > 4 ? JobID.Text.Substring(0, 4) == "VIP:" : false;

if (!long.TryParse(PlaceID.Text, out long PlaceId)) return;

if (!RecentGames.Exists(RG => RG.PlaceId == PlaceId) && !PlaceTimer.Enabled)
AddRecentGame(new RecentGame { PlaceId = PlaceId, Name = CurrentPlace.Text });

CancelLaunching();

if (AccountsView.SelectedObjects.Count > 1)
Expand Down Expand Up @@ -1121,10 +1172,26 @@ private void reAuthToolStripMenuItem_Click(object sender, EventArgs e)

private void getAuthenticationTicketToolStripMenuItem_Click(object sender, EventArgs e)
{
if (SelectedAccount == null) return;
if (SelectedAccount != null)
{
if (SelectedAccount.GetAuthTicket(out string STicket))
Clipboard.SetText(STicket);

if (SelectedAccount.GetAuthTicket(out string Ticket))
Clipboard.SetText(Ticket);
return;
}

if (SelectedAccounts.Count < 1) return;

List<string> Tickets = new List<string>();

foreach (Account acc in SelectedAccounts)
{
if (acc.GetAuthTicket(out string Ticket))
Tickets.Add($"{acc.Username}:{Ticket}");
}

if (Tickets.Count > 0)
Clipboard.SetText(string.Join("\n", Tickets));
}

private void copyRbxplayerLinkToolStripMenuItem_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -1235,10 +1302,7 @@ private void copyAppLinkToolStripMenuItem_Click(object sender, EventArgs e)
}
}

private void JoinDiscord_Click(object sender, EventArgs e)
{
Process.Start("https://discord.gg/MsEH7smXY8");
}
private void JoinDiscord_Click(object sender, EventArgs e) => Process.Start("https://discord.gg/MsEH7smXY8");

private void OpenApp_Click(object sender, EventArgs e)
{
Expand Down
18 changes: 9 additions & 9 deletions RBX Alt Manager/Classes/Account.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ public bool GetAuthTicket(out string Ticket)

RestRequest request = new RestRequest("/v1/authentication-ticket/", Method.POST);
request.AddCookie(".ROBLOSECURITY", SecurityToken);
request.AddHeader("X-CSRF-TOKEN", GetCSRFToken());
request.AddHeader("Referer", "https://www.roblox.com/games/606849621/Jailbreak");
request.AddHeader("X-CSRF-TOKEN", GetCSRFToken(true));
request.AddHeader("Referer", "https://www.roblox.com/games/185655149/Welcome-to-Bloxburg");

IRestResponse response = AccountManager.AuthClient.Execute(request);

Expand All @@ -128,12 +128,12 @@ public bool GetAuthTicket(out string Ticket)

public string GetCSRFToken(bool ForceRequest = false)
{
if (!ForceRequest && (DateTime.Now - TokenSet).TotalMinutes < 3) return CSRFToken;
if (!ForceRequest && (DateTime.Now - TokenSet).TotalMinutes < 2) return CSRFToken;

RestRequest request = new RestRequest("v1/authentication-ticket/", Method.POST);

request.AddCookie(".ROBLOSECURITY", SecurityToken);
request.AddHeader("Referer", "https://www.roblox.com/games/606849621/Jailbreak");
request.AddHeader("Referer", "https://www.roblox.com/games/185655149/Welcome-to-Bloxburg");

IRestResponse response = AccountManager.AuthClient.Execute(request);
Parameter result = response.Headers.FirstOrDefault(x => x.Name == "x-csrf-token");
Expand Down Expand Up @@ -334,7 +334,7 @@ public bool LogOutOfOtherSessions()

request.AddCookie(".ROBLOSECURITY", SecurityToken);
request.AddHeader("Referer", "https://www.roblox.com/");
request.AddHeader("X-CSRF-TOKEN", GetCSRFToken());
request.AddHeader("X-CSRF-TOKEN", GetCSRFToken(true));
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");

IRestResponse response = AccountManager.MainClient.Execute(request);
Expand Down Expand Up @@ -547,7 +547,7 @@ public string JoinServer(long PlaceID, string JobID = "", bool FollowUser = fals
string Token = GetCSRFToken();

if (string.IsNullOrEmpty(Token))
return "ERROR: Account Session Expired, re-add the account or try again. (1)";
return "ERROR: Account Session Expired, re-add the account or try again. (Invalid X-CSRF-Token)";

if (GetAuthTicket(out string Ticket))
{
Expand All @@ -559,7 +559,7 @@ public string JoinServer(long PlaceID, string JobID = "", bool FollowUser = fals
RestRequest request = new RestRequest(string.Format("/games/{0}?privateServerLinkCode={1}", PlaceID, LinkCode), Method.GET);
request.AddCookie(".ROBLOSECURITY", SecurityToken);
request.AddHeader("X-CSRF-TOKEN", Token);
request.AddHeader("Referer", "https://www.roblox.com/games/606849621/Jailbreak");
request.AddHeader("Referer", "https://www.roblox.com/games/185655149/Welcome-to-Bloxburg");

IRestResponse response = AccountManager.MainClient.Execute(request);

Expand All @@ -579,7 +579,7 @@ public string JoinServer(long PlaceID, string JobID = "", bool FollowUser = fals

request.AddCookie(".ROBLOSECURITY", SecurityToken);
request.AddHeader("X-CSRF-TOKEN", Token);
request.AddHeader("Referer", "https://www.roblox.com/games/606849621/Jailbreak");
request.AddHeader("Referer", "https://www.roblox.com/games/185655149/Welcome-to-Bloxburg");

IRestResponse result = AccountManager.Web13Client.Execute(request);

Expand Down Expand Up @@ -665,7 +665,7 @@ public string SetServer(long PlaceID, string JobID, out bool Successful)
string Token = GetCSRFToken();

if (string.IsNullOrEmpty(Token))
return "ERROR: Account Session Expired, re-add the account or try again. (1)";
return "ERROR: Account Session Expired, re-add the account or try again. (Invalid X-CSRF-Token)";

RestRequest request = new RestRequest("v1/join-game-instance", Method.POST);
request.AddCookie(".ROBLOSECURITY", SecurityToken);
Expand Down
26 changes: 19 additions & 7 deletions RBX Alt Manager/Classes/BorderedRichTextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,42 @@ public struct ANIMATIONINFO
public static uint SPIF_SENDCHANGE = 0x02;
public static uint SPI_SETANIMATION = 0x0049;

private Pen opaquePen;
private Pen borderPen;

public Color BorderColor
{
get { return borderColor; }
set
{
borderColor = value;
opaquePen = new Pen(new SolidBrush(Color.FromArgb(255, value.R, value.G, value.B)));
borderPen = new Pen(BorderColor, 1f);

RedrawWindow(Handle, IntPtr.Zero, IntPtr.Zero, RDW_FRAME | RDW_IUPDATENOW | RDW_INVALIDATE);
}
}

protected override void WndProc(ref Message m)
{
WM msg = (WM)m.Msg;

if (msg == WM.MOUSELEAVE || msg == WM.MOUSEHOVER)
return;

base.WndProc(ref m);
if (m.Msg == WM_NCPAINT && BorderColor != Color.Transparent && BorderStyle == BorderStyle.Fixed3D)

if ((m.Msg == WM_NCPAINT || msg == WM.PAINT) && BorderColor != Color.Transparent && BorderStyle == BorderStyle.Fixed3D)
{
var hdc = GetWindowDC(this.Handle);

using (var g = Graphics.FromHdcInternal(hdc))
using (var p = new Pen(BorderColor))
{
SolidBrush opaqueBrush = new SolidBrush(Color.FromArgb(200, BorderColor.R, BorderColor.G, BorderColor.B));
if (opaquePen == null || borderPen == null)
BorderColor = borderColor;

g.DrawRectangle(new Pen(opaqueBrush), new Rectangle(0, 0, Width - 1, Height - 1));
g.DrawRectangle(p, new Rectangle(1, 1, Width - 3, Height - 3));
g.DrawRectangle(opaquePen, new Rectangle(0, 0, Width - 1, Height - 1));
g.DrawRectangle(borderPen, new Rectangle(1, 1, Width - 3, Height - 3));
}

ReleaseDC(this.Handle, hdc);
Expand All @@ -65,8 +77,8 @@ protected override void WndProc(ref Message m)
protected override void OnSizeChanged(EventArgs e)
{
base.OnSizeChanged(e);
RedrawWindow(Handle, IntPtr.Zero, IntPtr.Zero,
RDW_FRAME | RDW_IUPDATENOW | RDW_INVALIDATE);

RedrawWindow(Handle, IntPtr.Zero, IntPtr.Zero, RDW_FRAME | RDW_IUPDATENOW | RDW_INVALIDATE);
}
}
}
Loading

0 comments on commit 660efeb

Please sign in to comment.