Esempio n. 1
0
 // Token: 0x0600004D RID: 77 RVA: 0x00005EA8 File Offset: 0x000040A8
 public void ConnectionBlockedEvent()
 {
     DebugTools.Print(PlayerListUI.UppercaseFirst(this.listName) + ": A player connection has been blocked.");
     MainForm.Message("A player on the " + this.listName + " has been blocked.", 50);
     this.blockedConnections++;
     this.LabelBlockedConnections.Text = "Blocked Connections: " + this.blockedConnections;
 }
Esempio n. 2
0
 // Token: 0x06000046 RID: 70 RVA: 0x0000592C File Offset: 0x00003B2C
 public void TextImport()
 {
     DebugTools.Print("Open dialog box: " + PlayerListUI.UppercaseFirst(this.listName) + " Import (DialogBoxImportExport)");
     using (DialogBoxImportExport dialogBoxImportExport = new DialogBoxImportExport())
     {
         dialogBoxImportExport.Text = PlayerListUI.UppercaseFirst(this.listName) + " Import";
         dialogBoxImportExport.ButtonImport.Visible = true;
         dialogBoxImportExport.ButtonCancel.Text    = "Cancel";
         if (this.restricted)
         {
             dialogBoxImportExport.CheckBoxEncryptedText.Enabled = false;
             dialogBoxImportExport.CheckBoxEncryptedText.Checked = true;
         }
         if (dialogBoxImportExport.ShowDialog() == DialogResult.OK)
         {
             if (dialogBoxImportExport.CheckBoxEncryptedText.Checked)
             {
                 dialogBoxImportExport.DecryptTextBox();
             }
             this.TextImport(dialogBoxImportExport.TextBoxImportExport.Lines);
             this.UpdateStatic();
             GameMemory.OptionsUpdate();
         }
     }
 }
Esempio n. 3
0
 // Token: 0x0600004B RID: 75 RVA: 0x00005CF0 File Offset: 0x00003EF0
 public void AddPlayer(ListView.SelectedIndexCollection indices)
 {
     foreach (object obj in indices)
     {
         int num = (int)obj;
         GameData.PlayerOnline playerOnline = GameData.PlayerList[num];
         this.AddPlayer(playerOnline.LocalList[(int)(playerOnline.LocalCount - 1)].Name, playerOnline.SteamId, true);
     }
     this.UpdateStatic();
     GameMemory.OptionsUpdate();
     if (indices.Count > 1)
     {
         MainForm.Message(string.Concat(new object[]
         {
             "Added ",
             indices.Count,
             " players to the ",
             this.listName,
             "."
         }), 50);
         DebugTools.Print(string.Concat(new object[]
         {
             PlayerListUI.UppercaseFirst(this.listName),
             ": Added ",
             indices.Count,
             " players."
         }));
     }
 }
Esempio n. 4
0
        // Token: 0x06000041 RID: 65 RVA: 0x000052AC File Offset: 0x000034AC
        public void RemovePlayer()
        {
            int count = this.ListView.SelectedIndices.Count;

            for (int i = this.ListView.SelectedItems.Count - 1; i >= 0; i--)
            {
                int index = this.ListView.SelectedIndices[i];
                DebugTools.Print("Option change: Remove " + PlayerListUI.UppercaseFirst(this.listName) + " entry.");
                this.Config.Players.RemoveAt(index);
                MainForm.Message(this.ListView.Items[index].SubItems[0].Text + " was removed from the " + this.listName, 50);
            }
            this.UpdateStatic();
            GameMemory.OptionsUpdate();
            if (count > 1)
            {
                MainForm.Message(string.Concat(new object[]
                {
                    "Removed ",
                    count,
                    " players from the ",
                    this.listName,
                    "."
                }), 50);
            }
        }
Esempio n. 5
0
        // Token: 0x0600003C RID: 60 RVA: 0x00004DC0 File Offset: 0x00002FC0
        public PlayerListUI(string _listName, Color _listColour, bool _restricted, PlayerListElement _Config, ListView _ListView, CheckBox _CheckBoxEnable, Label _LabelCount, Label _LabelBlockedConnections, Button _ButtonAdd, Button _ButtonRemove, Button _ButtonEdit, Button _ButtonViewProfile, Button _ButtonImport, Button _ButtonExport)
        {
            DebugTools.Print("Startup: Initialising " + _listName + " user interface.");
            this.listName   = _listName;
            this.listColour = _listColour;
            this.restricted = _restricted;
            this.Config     = _Config;
            this.ListView   = _ListView;
            this.LabelCount = _LabelCount;
            this.LabelBlockedConnections = _LabelBlockedConnections;
            this.CheckBoxEnable          = _CheckBoxEnable;
            this.ButtonAdd         = _ButtonAdd;
            this.ButtonRemove      = _ButtonRemove;
            this.ButtonEdit        = _ButtonEdit;
            this.ButtonViewProfile = _ButtonViewProfile;
            this.ButtonImport      = _ButtonImport;
            this.ButtonExport      = _ButtonExport;
            string path = Application.StartupPath + "/" + this.listName + "_encrypted.txt";

            if (this.restricted)
            {
                this.Config.Players.Clear();
                if (File.Exists(path))
                {
                    DebugTools.Print(PlayerListUI.UppercaseFirst(this.listName) + ": Importing from encrypted text file.");
                    string text = RijndaelManagedEncryption.DecryptRijndael(File.ReadAllText(path));
                    if (text != "")
                    {
                        this.TextImport(text.Split("\n".ToCharArray()));
                    }
                    else
                    {
                        MessageBox.Show(string.Concat(new string[]
                        {
                            "Failed to load ",
                            this.listName,
                            " from ",
                            this.listName,
                            "_encrypted.txt"
                        }), PlayerListUI.UppercaseFirst(this.listName), MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    }
                }
                else
                {
                    MessageBox.Show(string.Concat(new string[]
                    {
                        "Could not find: ",
                        this.listName,
                        "_encrypted.txt\n\nNo ",
                        this.listName,
                        " has been loaded."
                    }), PlayerListUI.UppercaseFirst(this.listName), MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
            }
            this.UpdateStatic();
            this.ListView.CreateGraphics();
        }
Esempio n. 6
0
 // Token: 0x06000049 RID: 73 RVA: 0x00005C0C File Offset: 0x00003E0C
 public static string[] TextExport(string listName, GenericConfigurationElementCollection <PlayerElement> Players)
 {
     DebugTools.Write(PlayerListUI.UppercaseFirst(listName) + ": Generating text list... ");
     string[] array = new string[Players.Count];
     for (int i = 0; i < Players.Count; i++)
     {
         array[i] = Players[i].SteamId + " # " + Players[i].Name;
     }
     Debug.Print("done.");
     return(array);
 }
Esempio n. 7
0
 // Token: 0x06000048 RID: 72 RVA: 0x00005B48 File Offset: 0x00003D48
 public void TextExport()
 {
     DebugTools.Print("Open dialog box: " + PlayerListUI.UppercaseFirst(this.listName) + " Export (DialogBoxImportExport)");
     using (DialogBoxImportExport dialogBoxImportExport = new DialogBoxImportExport())
     {
         dialogBoxImportExport.Text = PlayerListUI.UppercaseFirst(this.listName) + " Export";
         dialogBoxImportExport.ButtonImport.Visible = false;
         dialogBoxImportExport.ButtonCancel.Text    = "Close";
         if (this.restricted)
         {
             dialogBoxImportExport.TextBoxImportExport.ReadOnly = true;
         }
         dialogBoxImportExport.TextBoxImportExport.Lines = PlayerListUI.TextExport(this.listName, this.Config.Players);
         dialogBoxImportExport.ShowDialog();
     }
 }
Esempio n. 8
0
        // Token: 0x06000047 RID: 71 RVA: 0x00005A0C File Offset: 0x00003C0C
        private int TextImport(string[] lines)
        {
            DebugTools.Print(PlayerListUI.UppercaseFirst(this.listName) + ": Begin text import.");
            int num = 0;

            foreach (string text in lines)
            {
                if (text != "")
                {
                    try
                    {
                        this.AddPlayer(text.Substring(20), Convert.ToUInt64(text.Substring(0, 17)), true);
                        num++;
                    }
                    catch
                    {
                        DebugTools.Print("Error: Unable to process a line (" + text + ")");
                        MessageBox.Show("There was a problem processing this line:\n\n " + text, "Text Import", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    }
                }
            }
            if (num > 1)
            {
                MainForm.Message(string.Concat(new object[]
                {
                    "Imported ",
                    num,
                    " players to the ",
                    this.listName,
                    "."
                }), 50);
                DebugTools.Print(string.Concat(new object[]
                {
                    PlayerListUI.UppercaseFirst(this.listName),
                    ": Imported ",
                    num,
                    " players to the ",
                    this.listName,
                    "."
                }));
            }
            return(num);
        }
Esempio n. 9
0
        // Token: 0x0600003E RID: 62 RVA: 0x00004FD8 File Offset: 0x000031D8
        public void UpdateStatic()
        {
            DebugTools.Write(PlayerListUI.UppercaseFirst(this.listName) + ": Updating user interface static elements... ");
            this.settingValues          = true;
            this.CheckBoxEnable.Checked = this.Config.Enabled;
            int num = -1;

            if (this.ListView.SelectedIndices.Count == 1)
            {
                num = this.ListView.SelectedItems[0].Index;
            }
            this.ListView.Items.Clear();
            if (this.Config.Players.Count > 0)
            {
                foreach (object obj in this.Config.Players)
                {
                    PlayerElement playerElement = (PlayerElement)obj;
                    this.ListView.Items.Add(new ListViewItem(new string[]
                    {
                        playerElement.Name,
                        playerElement.SteamId.ToString()
                    })
                    {
                        Checked   = playerElement.Enabled,
                        ForeColor = this.listColour
                    });
                }
                if (num >= 0 && num < this.ListView.Items.Count)
                {
                    MainForm.ListViewFocus(this.ListView.Items, num, true);
                }
            }
            this.ButtonAdd.Enabled         = !this.restricted;
            this.ButtonRemove.Enabled      = (this.Config.Players.Count > 0);
            this.ButtonEdit.Enabled        = (this.Config.Players.Count > 0);
            this.ButtonViewProfile.Enabled = (this.Config.Players.Count > 0);
            this.ButtonExport.Enabled      = (this.Config.Players.Count > 0);
            this.LabelCount.Text           = "Player Total: " + this.Config.Players.Count;
            this.settingValues             = false;
            Debug.Print("done.");
        }
Esempio n. 10
0
 // Token: 0x06000043 RID: 67 RVA: 0x000054C8 File Offset: 0x000036C8
 public void AddFriends()
 {
     DebugTools.Print("Open dialog box: Add friends (DialogBoxAddFriends)");
     using (DialogBoxAddFriends dialogBoxAddFriends = new DialogBoxAddFriends())
     {
         foreach (SteamData.Player player in SteamData.FriendList)
         {
             dialogBoxAddFriends.ListView.Items.Add(new ListViewItem(player.name));
         }
         if (dialogBoxAddFriends.ShowDialog() == DialogResult.OK)
         {
             foreach (object obj in dialogBoxAddFriends.ListView.SelectedIndices)
             {
                 int num = (int)obj;
                 this.AddPlayer(SteamData.FriendList[num].name, SteamData.FriendList[num].steamId, true);
             }
             this.UpdateStatic();
             GameMemory.OptionsUpdate();
             if (dialogBoxAddFriends.ListView.SelectedIndices.Count > 1)
             {
                 MainForm.Message(string.Concat(new object[]
                 {
                     "Added ",
                     dialogBoxAddFriends.ListView.SelectedIndices.Count,
                     " friends to the ",
                     this.listName,
                     "."
                 }), 50);
                 DebugTools.Print(string.Concat(new object[]
                 {
                     PlayerListUI.UppercaseFirst(this.listName),
                     ": Added ",
                     dialogBoxAddFriends.ListView.SelectedIndices.Count,
                     " friends."
                 }));
             }
         }
     }
 }
Esempio n. 11
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);
     }
 }