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

Commit

Permalink
Private Server stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
ic3w0lf22 committed Sep 11, 2021
1 parent 600255f commit f9381d6
Show file tree
Hide file tree
Showing 14 changed files with 539 additions and 423 deletions.
71 changes: 34 additions & 37 deletions RBX Alt Manager/AccountManager.Designer.cs

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

93 changes: 80 additions & 13 deletions RBX Alt Manager/AccountManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using System.Net;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security.Principal;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
Expand All @@ -34,7 +35,9 @@ public partial class AccountManager : Form
public static RestClient client;
public static RestClient econclient;
public static RestClient AccountClient;
public static RestClient webClient = new RestClient("https://web.roblox.com");
public static string CurrentPlaceId;
public static string CurrentJobId;
private AccountAdder aaform;
private ArgumentsForm afform;
private ServerList ServerListForm;
Expand All @@ -52,6 +55,7 @@ public partial class AccountManager : Form
public static IniFile IniSettings;
private string WSPassword = "";
private static DateTime LastAccountSave = DateTime.Now;
private static System.Timers.Timer SaveAccountsTimer;

private static Mutex rbxMultiMutex;

Expand Down Expand Up @@ -126,6 +130,16 @@ public static void SaveAccounts()
File.WriteAllText(SaveFilePath, SaveData);
}

public static void DelayedSaveAccounts() // Prevent file being locked
{
if ((DateTime.Now - startTime).TotalMilliseconds < 5000) return;

if (SaveAccountsTimer.Enabled)
SaveAccountsTimer.Stop();

SaveAccountsTimer.Start();
}

public static long GetUserID(string Username)
{
RestRequest request = new RestRequest("users/get-by-username?username=" + Username, Method.GET);
Expand Down Expand Up @@ -157,7 +171,7 @@ public void AddAccountToList(Account account)

AccountsView.Items.Add(Item);

if (!string.IsNullOrEmpty(account.Group)) AddGroupToList(account.Group, Item);
if (!string.IsNullOrEmpty(account.Group)) AddGroupToList(account.Group, Item, true);
}
}

Expand All @@ -181,7 +195,7 @@ public void SetAccountViewSubItem(Account account, int Index, string Text)
}
}

public void AddGroupToList(string GroupName, ListViewItem Item = null)
public void AddGroupToList(string GroupName, ListViewItem Item = null, bool OnStartup = false)
{
bool CreateGroup = true;
ListViewGroup GroupItem = null;
Expand Down Expand Up @@ -209,7 +223,8 @@ public void AddGroupToList(string GroupName, ListViewItem Item = null)
SelectedAccountItem.Group = GroupItem;
AccountsList.Remove(SelectedAccount);
AccountsList.Insert(AccountsList.Count, SelectedAccount); // move to end of account list
SaveAccounts();

if (!OnStartup) SaveAccounts();
}
}

Expand Down Expand Up @@ -263,12 +278,25 @@ public static string ShowDialog(string text, string caption) //tbh pasted from s

private void AccountManager_Load(object sender, EventArgs e)
{
if (Directory.GetParent(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)).FullName.Contains(Path.GetTempPath()))
int Stupid = 1337;

try
{
int Stupid = 1337;
MessageBox.Show("bro extract the files, don't run it in winrar");
Environment.Exit(Stupid);
bool RanAsAdmin = new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator);

if (RanAsAdmin)
{
MessageBox.Show("Roblox Account Manager will not work properly if it is ran as admin!", "Roblox Account Manager", MessageBoxButtons.OK, MessageBoxIcon.Error);
Environment.Exit(Stupid);
}

if (Directory.GetParent(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)).FullName.Contains(Path.GetTempPath().Remove(Path.GetTempPath().Length - 1)))
{
MessageBox.Show("bro extract the files, don't run it in winrar");
Environment.Exit(Stupid);
}
}
catch { }

if (File.Exists("AU.exe"))
{
Expand Down Expand Up @@ -320,7 +348,11 @@ private void AccountManager_Load(object sender, EventArgs e)
AltManagerWS = new WebServer(SendResponse, $"http://localhost:{Port}/");
AltManagerWS.Run();
}
} catch(Exception x) { MessageBox.Show("Failed to start webserver! " + x, "Roblox Account Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); }
}
catch (Exception x) { MessageBox.Show("Failed to start webserver! " + x, "Roblox Account Manager", MessageBoxButtons.OK, MessageBoxIcon.Error); }

SaveAccountsTimer = new System.Timers.Timer(2500);
SaveAccountsTimer.Elapsed += SaveTimer_Tick;

// SetupNamedPipe(); // unused now

Expand Down Expand Up @@ -350,6 +382,9 @@ private void AccountManager_Load(object sender, EventArgs e)
AccountClient = new RestClient("https://accountsettings.roblox.com/");
AccountClient.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.BypassCache);

webClient = new RestClient("https://web.roblox.com/");
AccountClient.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.BypassCache);

PlaceID_TextChanged(PlaceID, new EventArgs());

Task.Run(() =>
Expand Down Expand Up @@ -476,8 +511,6 @@ private string SendResponse(HttpListenerRequest request)

string Body = new StreamReader(request.InputStream).ReadToEnd();

Console.WriteLine(Body);

if (Method == "SetAlias" && !string.IsNullOrEmpty(Body))
{
if (IniSettings.Read("AllowAccountEditing", "WebServer") != "true") return "Method not allowed";
Expand Down Expand Up @@ -586,6 +619,9 @@ private void AccountsView_SelectedIndexChanged(object sender, EventArgs e)
SelectedAccount = account;
Alias.Text = account.Alias;
DescriptionBox.Text = account.Description;

if (!string.IsNullOrEmpty(SelectedAccount.GetField("SavedPlaceId"))) PlaceID.Text = SelectedAccount.GetField("SavedPlaceId");
if (!string.IsNullOrEmpty(SelectedAccount.GetField("SavedJobId"))) JobID.Text = SelectedAccount.GetField("SavedJobId");
}
}
catch { }
Expand Down Expand Up @@ -981,7 +1017,6 @@ private void copySecurityTokenToolStripMenuItem_Click(object sender, EventArgs e
{
if (SelectedAccount == null) return;

SelectedAccount.RemoveField("test");
Clipboard.SetText(SelectedAccount.SecurityToken);
}

Expand Down Expand Up @@ -1009,7 +1044,7 @@ private void PlaceTimer_Tick(object sender, EventArgs e)

RestRequest request = new RestRequest("Marketplace/ProductInfo?assetId=" + PlaceID.Text, Method.GET);
request.AddHeader("Accept", "application/json");
IRestResponse response = response = apiclient.Execute(request);
IRestResponse response = apiclient.Execute(request);

if (response.IsSuccessful && response.StatusCode == HttpStatusCode.OK)
{
Expand All @@ -1031,7 +1066,7 @@ private void moveToToolStripMenuItem_Click(object sender, EventArgs e)

if (res == DialogResult.No) return;
}

AddGroupToList(GroupName);
}

Expand Down Expand Up @@ -1189,5 +1224,37 @@ private void viewFieldsToolStripMenuItem_Click(object sender, EventArgs e)

FieldsForm.View(SelectedAccount);
}

private void JobID_TextChanged(object sender, EventArgs e)
{
CurrentJobId = JobID.Text;
}

private void SaveToAccount_Click(object sender, EventArgs e)
{
if (SelectedAccount == null) return;

if (string.IsNullOrEmpty(PlaceID.Text) && string.IsNullOrEmpty(JobID.Text))
{
SelectedAccount.RemoveField("SavedPlaceId");
SelectedAccount.RemoveField("SavedJobId");

return;
}

string PlaceId = CurrentPlaceId;

if (JobID.Text.Contains("privateServerLinkCode") && Regex.IsMatch(JobID.Text, @"\/games\/(\d+)\/"))
PlaceId = Regex.Match(CurrentJobId, @"\/games\/(\d+)\/").Groups[1].Value;

SelectedAccount.SetField("SavedPlaceId", PlaceId);
SelectedAccount.SetField("SavedJobId", JobID.Text);
}

private void SaveTimer_Tick(object sender, EventArgs e)
{
SaveAccounts();
SaveAccountsTimer.Stop();
}
}
}
Loading

0 comments on commit f9381d6

Please sign in to comment.