// Token: 0x0600001B RID: 27 RVA: 0x000033A4 File Offset: 0x000015A4
 public void DecryptTextBox()
 {
     if (this.TextBoxImportExport.Lines.Length != 0)
     {
         this.TextBoxImportExport.Lines = RijndaelManagedEncryption.DecryptRijndael(this.TextBoxImportExport.Lines[0]).Split("\n".ToCharArray());
     }
 }
 // Token: 0x0600001A RID: 26 RVA: 0x00003374 File Offset: 0x00001574
 public void EncryptTextBox()
 {
     this.TextBoxImportExport.Lines = new string[]
     {
         RijndaelManagedEncryption.EncryptRijndael(string.Join("\n", this.TextBoxImportExport.Lines))
     };
 }
        // 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();
        }
Exemple #4
0
        // Token: 0x06000025 RID: 37 RVA: 0x00003AFC File Offset: 0x00001CFC
        public static string EncryptRijndael(string text)
        {
            DebugTools.Write("Rijindeal Managed Encryption: Encrypting Text... ");
            if (string.IsNullOrEmpty(text))
            {
                Debug.Print("done.");
                return("");
            }
            RijndaelManaged  rijndaelManaged = RijndaelManagedEncryption.NewRijndaelManaged("PICeOLJdNZ3RjieaC3dfd07qPZeIb3DvkP6Zwb5TOmavgpXDQzrBgT5HrUqOFL6l");
            ICryptoTransform transform       = rijndaelManaged.CreateEncryptor(rijndaelManaged.Key, rijndaelManaged.IV);
            MemoryStream     memoryStream    = new MemoryStream();

            using (CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Write))
            {
                using (StreamWriter streamWriter = new StreamWriter(cryptoStream))
                {
                    streamWriter.Write(text);
                }
            }
            Debug.Print("done.");
            return(Convert.ToBase64String(memoryStream.ToArray()));
        }
Exemple #5
0
        // Token: 0x06000027 RID: 39 RVA: 0x00003BD8 File Offset: 0x00001DD8
        public static string DecryptRijndael(string cipherText)
        {
            DebugTools.Write("Rijindeal Managed Encryption: Decrypting Text... ");
            string result;

            try
            {
                if (string.IsNullOrEmpty(cipherText))
                {
                    Debug.Print("done.");
                    return("");
                }
                if (!RijndaelManagedEncryption.IsBase64String(cipherText))
                {
                    throw new Exception("The cipherText input parameter is not base64 encoded.");
                }
                RijndaelManaged  rijndaelManaged = RijndaelManagedEncryption.NewRijndaelManaged("PICeOLJdNZ3RjieaC3dfd07qPZeIb3DvkP6Zwb5TOmavgpXDQzrBgT5HrUqOFL6l");
                ICryptoTransform transform       = rijndaelManaged.CreateDecryptor(rijndaelManaged.Key, rijndaelManaged.IV);
                using (MemoryStream memoryStream = new MemoryStream(Convert.FromBase64String(cipherText)))
                {
                    using (CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Read))
                    {
                        using (StreamReader streamReader = new StreamReader(cryptoStream))
                        {
                            result = streamReader.ReadToEnd();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                DebugTools.Print("Failed to decrypt text: " + ex.Message);
                MessageBox.Show("Failed to decrypt text, an error occured:\n\n" + ex.Message, "Decryption", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                result = "";
            }
            Debug.Print("done.");
            return(result);
        }
Exemple #6
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);
     }
 }