Beispiel #1
0
        // Token: 0x0600007A RID: 122 RVA: 0x0000CEE4 File Offset: 0x0000B0E4
        public static int CheckLobby(ulong Id)
        {
            DebugTools.Print("Begin lobby Check (" + Id + ")");
            SteamData.GetLobbyList();
            int lobbyIndex = SteamData.GetLobbyIndex(Id);

            if (lobbyIndex == -1)
            {
                DebugTools.Print("Lobby Check: The lobby does not exist.");
                return(1);
            }
            if (Id == GameData.lobbyId && GameData.onlinePlayerCount > 0)
            {
                DebugTools.Print("Lobby Check: You are in this lobby.");
                return(0);
            }
            SteamData.GetLobbyPlayers(Id);
            if (SteamData.playerCount < 0)
            {
                return(SteamData.playerCount);
            }
            DebugTools.Write("Lobby Check: ");
            if (SteamData.lobbyFriendCount == 0 && SteamData.LobbyList[lobbyIndex].typeId == 3)
            {
                Debug.Print("You do not have permission to join this lobby.");
                return(2);
            }
            if (SteamData.lobbyBanCount > 0)
            {
                Debug.Print("This lobby contains a banned player.");
                return(3);
            }
            Debug.Print("No issues.");
            return(4);
        }
Beispiel #2
0
 // Token: 0x06000072 RID: 114 RVA: 0x0000C9B0 File Offset: 0x0000ABB0
 public static string[] GetData(string args, string friendlyName)
 {
     DebugTools.Print("Steam Data: Retrieving...");
     string[] array = SteamData.CaptureConsoleOutput("Steam Communicator.exe", args).Split(new string[]
     {
         "\r\n"
     }, StringSplitOptions.None);
     SteamData.errorCode = Convert.ToInt32(array[0]);
     if (SteamData.errorCode > 0)
     {
         SteamData.errorCode = 0;
     }
     if (SteamData.errorCode == 0)
     {
         DebugTools.Print("Steam Data: Retrieved " + friendlyName + ".");
         MainForm.Message("Successfully retrieved " + friendlyName + ".", 50);
         return(array);
     }
     DebugTools.Write("Steam Data: Failed to retrieve data, ");
     if (SteamData.errorCode == -1)
     {
         Debug.Print("Steam is not running.");
         MessageBox.Show("Steam is not running.", "Could not retrieve data.", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     }
     else if (SteamData.errorCode == -2)
     {
         Debug.Print("timed out.");
         MessageBox.Show("Steam did not respond within 5 seconds.", "Could not retireve data.", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     }
     return(null);
 }
Beispiel #3
0
 // Token: 0x06000008 RID: 8 RVA: 0x000024F4 File Offset: 0x000006F4
 public void GetLobbyLink()
 {
     if (this.ListView.FocusedItem != null)
     {
         DebugTools.Print("Checking the lobby...");
         this.ButtonLink.Enabled = false;
         this.ButtonLink.Text    = "Checking lobby...";
         this.ButtonLink.Update();
         ulong id  = SteamData.LobbyList[this.ListView.FocusedItem.Index].id;
         int   num = SteamData.CheckLobby(id);
         this.UpdateStatic();
         this.ButtonLink.Text = "Get Lobby Link";
         if (num == 1)
         {
             MessageBox.Show("This lobby no longer exists.", "Could not get link.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             return;
         }
         if (num == 2)
         {
             DebugTools.Print("Warning: Skip generating link.");
             MessageBox.Show("This is a private lobby which contains none of your friends.\nTo get a link, please ask a player in the lobby for a lobby/friend invitation.", "Could not get link.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             return;
         }
         DebugTools.Print("Open dialog box: Lobby link (DialogBoxLobbyLink)");
         using (DialogBoxLobbyLink dialogBoxLobbyLink = new DialogBoxLobbyLink())
         {
             dialogBoxLobbyLink.TextBoxLink.Text = "steam://joinlobby/212480/" + id;
             dialogBoxLobbyLink.ShowDialog();
         }
     }
 }
 // Token: 0x06000056 RID: 86 RVA: 0x0000644C File Offset: 0x0000464C
 private void InfoTabUpdate(SteamData.Lobby Lobby, int CheckResult)
 {
     if (CheckResult != 2 || !InternalConfig.Restricted)
     {
         this.LabelIdValue.Text = Lobby.id.ToString();
     }
     else
     {
         this.LabelIdValue.Text = "Private";
     }
     this.LabelTypeValue.Text        = SteamData.lobbyTypes[(int)Lobby.typeId];
     this.LabelCreatorValue.Text     = Lobby.creator;
     this.LabelPlayerCountValue.Text = Lobby.playerCount.ToString();
     if (Lobby.state != 4)
     {
         this.LabelActivityValue.Text = SteamData.GetActivity(Lobby);
         this.LabelEventValue.Text    = PlayerTable.GetEvent(Lobby.typeId, Lobby.matchModeId, false);
         string[] array = PlayerTable.GetTrack(Lobby.typeId, Lobby.matchModeId, false).Split(" ".ToCharArray(), 2);
         this.LabelTrack.Text           = array[0];
         this.LabelTrackValue.Text      = array[1];
         this.LabelDifficultyValue.Text = PlayerTable.GetDifficulty(Lobby.difficultyId, false);
         return;
     }
     this.LabelActivityValue.Text   = "Unknown";
     this.LabelEventValue.Text      = "Unknown";
     this.LabelTrackValue.Text      = "Unknown";
     this.LabelDifficultyValue.Text = "Unknown";
 }
Beispiel #5
0
 // Token: 0x06000078 RID: 120 RVA: 0x0000CD08 File Offset: 0x0000AF08
 private static void ProcessLobbyList(string[] lines)
 {
     DebugTools.Write("Steam Data: Processing lobby list... ");
     SteamData.lobbyCount = Convert.ToInt32(lines[0]);
     SteamData.LobbyList  = new SteamData.Lobby[SteamData.lobbyCount];
     for (int i = 0; i < SteamData.lobbyCount; i++)
     {
         SteamData.Lobby lobby = new SteamData.Lobby
         {
             id           = Convert.ToUInt64(lines[6 * i + 1]),
             creator      = lines[6 * i + 2],
             typeId       = Convert.ToByte(lines[6 * i + 3]),
             playerCount  = Convert.ToByte(lines[6 * i + 4]),
             SLTProtected = (Convert.ToByte(lines[6 * i + 5]) > 10)
         };
         byte[] array = SteamData.DecodeInfo(lines[6 * i + 6]);
         if (array.Length != 0)
         {
             lobby.matchModeId  = SteamData.ExtractByte(array, 8);
             lobby.raceProgress = SteamData.ExtractByte(array, 77);
             lobby.countdown    = Convert.ToByte(SteamData.ExtractByte(array, 60) & 63);
             lobby.state        = Convert.ToByte(SteamData.ExtractByte(array, 22) & 3);
             lobby.difficultyId = Convert.ToByte(SteamData.ExtractByte(array, 62) & 3);
         }
         else
         {
             lobby.state = 4;
         }
         SteamData.LobbyList[i] = lobby;
     }
     Debug.Print("done.");
     DebugTools.Print("Steam Data: Got " + SteamData.lobbyCount + " lobbies.");
 }
Beispiel #6
0
        // Token: 0x06000007 RID: 7 RVA: 0x0000239C File Offset: 0x0000059C
        public void JoinLobby()
        {
            if (this.ListView.FocusedItem != null)
            {
                DebugTools.Print("Request: Join lobby");
                if (GameMemory.gameHandle == 0)
                {
                    DebugTools.Print("Warning: The game is not running. Skip joining lobby.");
                    if (MessageBox.Show("You must be ingame to join lobbies.\nDo you want to start the game now?", "Game not running", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        AllLobbiesUI.LaunchGame();
                        return;
                    }
                }
                else
                {
                    this.ButtonJoinLobby.Enabled = false;
                    this.ButtonJoinLobby.Text    = "Checking lobby...";
                    this.ButtonJoinLobby.Update();
                    ulong id  = SteamData.LobbyList[this.ListView.FocusedItem.Index].id;
                    int   num = SteamData.CheckLobby(id);
                    this.UpdateStatic();
                    this.ButtonJoinLobby.Text = "Join Lobby";
                    switch (num)
                    {
                    case 0:
                        if (MessageBox.Show("You are already in this lobby!\nDo you want to rejoin?", "Rejoin Lobby", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
                        {
                            DebugTools.Print("Rejoining the lobby.");
                            AllLobbiesUI.JoinLobby(id);
                            return;
                        }
                        break;

                    case 1:
                        MessageBox.Show("This lobby no longer exists.", "Could not join lobby.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;

                    case 2:
                        DebugTools.Print("Warning: Skip joining lobby.");
                        MessageBox.Show("This is a private lobby which contains none of your friends.\nTo join this lobby, please ask a player in the lobby for a lobby/friend invitation.", "Could not join lobby.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;

                    case 3:
                        if (MessageBox.Show("This lobby contains players on your banlist!\nAre you sure you want to join?", "Caution", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
                        {
                            DebugTools.Print("Joining anyway...");
                            AllLobbiesUI.JoinLobby(id);
                            return;
                        }
                        break;

                    default:
                        AllLobbiesUI.JoinLobby(id);
                        break;
                    }
                }
            }
        }
Beispiel #7
0
 // Token: 0x06000071 RID: 113 RVA: 0x0000C993 File Offset: 0x0000AB93
 public static void Init()
 {
     DebugTools.Print("Startup: Initialising Steam data.");
     SteamData.GetFriendList();
     if (SteamData.errorCode == 0)
     {
         SteamData.GetLobbyList();
     }
 }
 // Token: 0x0600000F RID: 15 RVA: 0x00002C34 File Offset: 0x00000E34
 public void MigrateHost()
 {
     if (this.ListView.SelectedIndices.Count == 1)
     {
         SteamData.MigrateHost(GameData.PlayerList[this.ListView.SelectedIndices[0]].SteamId);
         return;
     }
     MessageBox.Show("Please select a single player.", "Multiple Selections", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
 }
Beispiel #9
0
        // Token: 0x0600007F RID: 127 RVA: 0x0000D15C File Offset: 0x0000B35C
        public static SteamData.Lobby GetLobby(ulong Id)
        {
            int lobbyIndex = SteamData.GetLobbyIndex(Id);

            if (lobbyIndex > 0)
            {
                return(SteamData.LobbyList[lobbyIndex]);
            }
            return(default(SteamData.Lobby));
        }
Beispiel #10
0
 // Token: 0x06000081 RID: 129 RVA: 0x0000D1E0 File Offset: 0x0000B3E0
 public static void SetPlayerLimit(int limit)
 {
     DebugTools.Print("Steam Data: Setting lobby player limit to " + limit + ".");
     SteamData.CaptureConsoleOutput("Steam Communicator.exe", string.Concat(new object[]
     {
         "setplayerlimit ",
         GameData.lobbyId,
         " ",
         limit
     }));
 }
Beispiel #11
0
 // Token: 0x06000073 RID: 115 RVA: 0x0000CA90 File Offset: 0x0000AC90
 public static void GetLobbyList()
 {
     string[] data = SteamData.GetData("lobbylist", "lobby list");
     if (data != null)
     {
         SteamData.ProcessLobbyList(data);
         return;
     }
     SteamData.LobbyList  = new SteamData.Lobby[0];
     SteamData.lobbyCount = 0;
 }
Beispiel #12
0
 // Token: 0x06000075 RID: 117 RVA: 0x0000CB18 File Offset: 0x0000AD18
 public static void GetFriendList()
 {
     string[] data = SteamData.GetData("friendlist", "friend list");
     if (data != null)
     {
         SteamData.ProcessFriendList(data);
         return;
     }
     SteamData.FriendList  = new SteamData.Player[0];
     SteamData.friendCount = 0;
 }
Beispiel #13
0
 // Token: 0x06000080 RID: 128 RVA: 0x0000D18C File Offset: 0x0000B38C
 public static void MigrateHost(ulong steamId)
 {
     DebugTools.Print("Steam Data: Migrating host.");
     SteamData.CaptureConsoleOutput("Steam Communicator.exe", string.Concat(new object[]
     {
         "migratehost ",
         GameData.lobbyId,
         " ",
         steamId
     }));
 }
Beispiel #14
0
 // Token: 0x06000005 RID: 5 RVA: 0x000022C4 File Offset: 0x000004C4
 public void RefreshList()
 {
     DebugTools.Print("Request: Refresh all lobbies list.");
     this.ButtonRefreshList.Enabled = false;
     this.ButtonRefreshList.Text    = "Refreshing...";
     this.ButtonRefreshList.Update();
     SteamData.GetLobbyList();
     this.UpdateStatic();
     this.ButtonRefreshList.Enabled = true;
     this.ButtonRefreshList.Text    = "Refresh List";
     this.ButtonRefreshList.Update();
 }
Beispiel #15
0
 // Token: 0x060000BC RID: 188 RVA: 0x000150B0 File Offset: 0x000132B0
 public static void UpdateHandle()
 {
     Process[] processesByName = Process.GetProcessesByName("ASN_App_PcDx9_Final");
     if (processesByName.Length != 0)
     {
         if (GameMemory.gameHandle == 0)
         {
             DebugTools.Print("Update handle: Found new game handle.");
             GameMemory.processId  = processesByName[0].Id;
             GameMemory.gameHandle = GameMemory.OpenProcess(56, 0, GameMemory.processId);
             DebugTools.Print("Update handle: Will wait " + GameMemory.newHandleTime * 100 + "ms before loading game config.");
         }
     }
     else
     {
         GameMemory.gameHandle = 0;
         GameMemory.processId  = 0;
         if (GameMemory._OverlayProcess != null)
         {
             DebugTools.Print("Update handle: Lost game handle.");
             GameMemory.OverlayUnload();
         }
     }
     if (GameMemory.gameHandle > 0)
     {
         GameData.Update();
         if (GameMemory.newHandleTime > 0)
         {
             GameMemory.newHandleTime--;
             if (GameMemory.newHandleTime == 0)
             {
                 MainForm.AllLobbiesUI.RefreshList();
                 GameData.Update();
                 if (SteamData.errorCode == 0 && GameData.youAreHost)
                 {
                     SteamData.SetPlayerLimit(20);
                 }
                 GameMemory.ListCheckerLoad();
                 GameMemory.FullLobbyFixLoad();
                 GameMemory.HostMigrationFixLoad();
                 GameMemory.SLTCheckerLoad();
                 GameMemory.OptionsUpdate();
                 GameMemory.OverlayLoad();
                 return;
             }
         }
     }
     else
     {
         GameMemory.newHandleTime = 50;
     }
 }
Beispiel #16
0
 // Token: 0x06000074 RID: 116 RVA: 0x0000CAC8 File Offset: 0x0000ACC8
 public static void GetLobbyPlayers(ulong lobbyId)
 {
     string[] data = SteamData.GetData("playerlist " + lobbyId, "lobby players");
     if (data != null)
     {
         SteamData.ProcessPlayerList(data);
         return;
     }
     SteamData.PlayerList       = new SteamData.Player[0];
     SteamData.playerCount      = 0;
     SteamData.lobbyFriendCount = 0;
     SteamData.lobbyBanCount    = 0;
 }
Beispiel #17
0
 // Token: 0x060000A0 RID: 160 RVA: 0x0000DA3C File Offset: 0x0000BC3C
 private void WhitelistButtonManualAdd_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Do you want to add friends?", "Add Player", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
     {
         MainForm.WhitelistUI.AddPlayer();
         return;
     }
     SteamData.GetFriendList();
     if (SteamData.errorCode == 0)
     {
         MainForm.WhitelistUI.AddFriends();
         return;
     }
     MainForm.WhitelistUI.AddPlayer();
 }
Beispiel #18
0
        // Token: 0x06000002 RID: 2 RVA: 0x000020A8 File Offset: 0x000002A8
        public void UpdateStatic()
        {
            DebugTools.Write("All lobbies: Updating user interface static elements... ");
            int num  = 0;
            int num2 = -1;

            if (this.ListView.FocusedItem != null)
            {
                num2 = this.ListView.FocusedItem.Index;
            }
            this.ListView.Items.Clear();
            if (SteamData.lobbyCount > 0)
            {
                foreach (SteamData.Lobby lobby in SteamData.LobbyList)
                {
                    string[] array = new string[4];
                    array[0] = lobby.creator;
                    array[1] = SteamData.lobbyTypes[(int)lobby.typeId];
                    int  num3        = 2;
                    byte playerCount = lobby.playerCount;
                    array[num3] = playerCount.ToString();
                    array[3]    = SteamData.GetActivity(lobby);
                    ListViewItem listViewItem = new ListViewItem(array);
                    if (lobby.SLTProtected)
                    {
                        listViewItem.ForeColor = Color.Green;
                    }
                    this.ListView.Items.Add(listViewItem);
                    num += (int)lobby.playerCount;
                }
                if (num2 >= 0 && num2 < this.ListView.Items.Count)
                {
                    MainForm.ListViewFocus(this.ListView.Items, num2, true);
                }
            }
            this.ButtonJoinLobby.Enabled   = (SteamData.lobbyCount > 0);
            this.ButtonViewPlayers.Enabled = (SteamData.lobbyCount > 0);
            this.ButtonLink.Enabled        = (SteamData.lobbyCount > 0);
            this.LabelLobbyCount.Text      = string.Format("Lobby Total: {0}", (SteamData.errorCode == 0) ? SteamData.lobbyCount.ToString() : "");
            this.LabelPlayerCount.Text     = string.Format("Player Total: {0}", (SteamData.errorCode == 0) ? num.ToString() : "");
            Debug.Print("done.");
        }
        // Token: 0x06000055 RID: 85 RVA: 0x00006350 File Offset: 0x00004550
        private void ButtonRefresh_Click(object sender, EventArgs e)
        {
            this.ButtonRefresh.Enabled = false;
            this.ButtonRefresh.Text    = "Refreshing...";
            this.ButtonRefresh.Update();
            int checkResult = SteamData.CheckLobby(this.lobbyId);

            MainForm.AllLobbiesUI.UpdateStatic();
            this.ButtonRefresh.Enabled = true;
            this.ButtonRefresh.Text    = "Refresh";
            switch (checkResult)
            {
            case -2:
                base.Close();
                return;

            case -1:
                base.Close();
                return;

            case 0:
                DebugTools.Print("Warning: Will not retrieve lobby details.");
                MessageBox.Show("You are already in this lobby.", "Lobby details unneccesary.", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                base.Close();
                return;

            case 1:
                MessageBox.Show("This lobby no longer exists.", "Could not retrieve details.", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                base.Close();
                return;

            default:
            {
                SteamData.Lobby lobby = SteamData.LobbyList[SteamData.GetLobbyIndex(this.lobbyId)];
                this.InfoTabUpdate(lobby, checkResult);
                this.HostDetailsTabUpdate(lobby, checkResult);
                this.PlayerTabUpdate(checkResult);
                return;
            }
            }
        }
Beispiel #20
0
 private static void Main()
 {
     Application.EnableVisualStyles();
     try
     {
         if (Directory.Exists(Application.StartupPath + "/logs"))
         {
             Debug.Listeners.Add(new TextWriterTraceListener(Application.StartupPath + "/logs/" + DateTime.Now.ToString("yyyy-MM-dd--HH-mm-ss") + ".txt"));
             Debug.AutoFlush = true;
         }
         DebugTools.Print("Welcome to the Super Lobby Tool.");
         DebugTools.Print(string.Format("This is the {0} version.", InternalConfig.Restricted ? "public" : "full"));
         DebugTools.Print("Startup: Begin!");
         DebugTools.Print("Startup: Loading program configuration.");
         try
         {
             Program.configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
             Program.Config     = (Program.configFile.GetSection("ProgramConfig") as ProgramConfigSection);
         }
         catch (Exception ex)
         {
             DebugTools.Print("Startup: Unrecoverable error while reading the configuration file.");
             DebugTools.Print(ex.ToString());
             if (MessageBox.Show("An unrecoverable error occured while reading the configuration file:" + ex.Message + "\n\nThe configuration file cannot be used until this is corrected.\nDo you want to continue startup?", "Error loading configuration.", MessageBoxButtons.YesNo, MessageBoxIcon.Hand) == DialogResult.No)
             {
                 Environment.Exit(1);
                 DebugTools.Print("Closing due to the previous error.");
             }
         }
         if (Program.Config == null)
         {
             DebugTools.Print("Startup: Using default configuration.");
             MessageBox.Show("Configuration file was unreadable, loading an empty configuration.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             Program.Config = new ProgramConfigSection();
             Program.configFile.Sections.Add("ProgramConfig", Program.Config);
         }
         GameData.Init();
         SteamData.Init();
     }
     catch (Exception arg)
     {
         DebugTools.Print("Unexpected error during startup: " + arg);
         MessageBox.Show("An unexpected error has occured during startup:\n\n" + arg + "\n\nSuper Lobby Tool must close now.\nPlease send the latest log file (located in the logs folder) to Tyapp.", "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     }
     try
     {
         Application.Run(new MainForm());
     }
     catch (Exception arg2)
     {
         DebugTools.Print("Unexpected error: " + arg2);
         MessageBox.Show("An unexpected error has occured:\n\n" + arg2 + "\n\nSuper Lobby Tool must close now.\nPlease send the latest log file (located in the logs folder) to Tyapp.", "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     }
     try
     {
         DebugTools.Print("Shutdown: Begin!");
         if (GameMemory._OverlayProcess != null)
         {
             GameMemory.OverlayUnload();
         }
         DebugTools.Write("Shutdown: Saving program configuration... ");
         Program.configFile.Save(ConfigurationSaveMode.Modified);
         Debug.Print("done.");
         DebugTools.Print("Shutdown: Updating encrypted banlist text file.");
         string path = Application.StartupPath + "/banlist_encrypted.txt";
         if (File.Exists(path))
         {
             File.Delete(path);
         }
         string contents = RijndaelManagedEncryption.EncryptRijndael(string.Join("\n", PlayerListUI.TextExport("banlist", Program.Config.Banlist.Players)));
         File.WriteAllText(path, contents);
         DebugTools.Print("Saved to banlist_encrypted.txt");
         DebugTools.Print("Thank you for using Super Lobby Tool. :)");
         Application.Exit();
     }
     catch (Exception arg3)
     {
         DebugTools.Print("Unexpected error during shutdown: " + arg3);
         MessageBox.Show("An unexpected error has occured during shutdown:\n\n" + arg3 + "\n\nPlease send the latest log file (located in the logs folder) to Tyapp.", "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     }
 }