Esempio n. 1
0
        public static void Run()
        {
            var manager = new ArchiveFileManager(LeagueLocations.GetLeaguePath());
            var search  = new ManifestSearch(manager);

            manager.Revert();

            //var filename1 = "DATA/Items/Icons2D/1053_Vampiric_Scepter.dds";
            var filename1 = "DATA/Items/Icons2D/3078_Trinity_Force.dds";
            var filename2 = "DATA/Items/Icons2D/3077_Tiamat.dds";
            //var filename2 = "DATA/Items/Icons2D/3078_Trinity_Force.dds";

            var file1 = manager.ReadFile(filename1);
            var file2 = manager.ReadFile(filename2);

            File.WriteAllBytes(@"C:\File 1 Test 1.dds", file1.Uncompress());
            File.WriteAllBytes(@"C:\File 2 Test 1.dds", file2.Uncompress());

            manager.BeginWriting();

            manager.WriteFile(filename1, false, file2);
            manager.WriteFile(filename2, false, file1);

            manager.EndWriting();

            file1 = manager.ReadFile(filename1);
            file2 = manager.ReadFile(filename2);

            File.WriteAllBytes(@"C:\File 1 Test 2.dds", file1.Uncompress());
            File.WriteAllBytes(@"C:\File 2 Test 2.dds", file2.Uncompress());

            //CompileAssetLists(search);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Console.Title = "League Scrambler";

            string leaguePath = "";

            if (File.Exists("leaguepath.txt"))
            {
                var bytes = File.ReadAllBytes("leaguepath.txt");
                leaguePath = ASCIIEncoding.ASCII.GetString(bytes, 0, bytes.Length);
            }
            else
            {
                leaguePath = LeagueLocations.GetLeaguePath();
            }

            var flag = false;

            // Make sure the path is valid, if not, ask for user to select it manually. Keep repeating until user exits or selects a proper file.
            while (string.IsNullOrEmpty(leaguePath) || !Directory.Exists(leaguePath) || !File.Exists(leaguePath + "lol.launcher.exe"))
            {
                MessageBox.Show("Couldn't automatically detect your League of Legends installation path, please select it manually.", "Error", MessageBoxButtons.OK);
                OpenFileDialog dialog = new OpenFileDialog();
                dialog.Title              = "League of Legends Installation Path";
                dialog.Filter             = "Leagu of Legends Launcher|lol.launcher.exe";
                dialog.FilterIndex        = 0;
                dialog.Multiselect        = false;
                dialog.AutoUpgradeEnabled = true;
                DialogResult result = dialog.ShowDialog();

                if (result == DialogResult.OK)
                {
                    // We only want the directory name. Also add the backslash to keep it consistent with what we get from the registry automatically.
                    leaguePath = Path.GetDirectoryName(dialog.FileName) + "\\";
                    flag       = true;
                }
                else
                {
                    // Ask the user if he'd like to exit since he didn't select a file.
                    result = MessageBox.Show("No file was selected, would you like to exit?", "Error", MessageBoxButtons.YesNo);
                    if (result == DialogResult.Yes)
                    {
                        return;
                    }
                }
            }

            // Save the location if it was manually selected
            if (flag)
            {
                File.WriteAllBytes("leaguepath.txt", ASCIIEncoding.ASCII.GetBytes(leaguePath));
            }

            if (!Directory.Exists(LeagueLocations.GetModPath(leaguePath)))
            {
                Directory.CreateDirectory(LeagueLocations.GetModPath(leaguePath));
            }

            var log = new Log(LeagueLocations.GetModPath(leaguePath) + "Log.txt");

            log.LogLine(new string('#', 100));
            log.LogLine("NEW SESSION STARTED");
            log.LogLine(new string('#', 100));
            Console.SetOut(log);

            // Launch the interface

            try
            {
                Interface ui = new Interface(leaguePath);
                ui.Initialize();
                ui.Run();
            }
            catch (Exception e)
            {
                log.LogLine(new string('#', 50));
                log.LogLine("ERROR OCCURRED");
                log.LogLine(new string('#', 50));
                Console.WriteLine(e.Message);
                Console.WriteLine(e.Source);
                Console.WriteLine(e.StackTrace);
                log.LogLine(new string('#', 50));
                Console.WriteLine("An error has occurred and it has been logged. Please refer to the troubleshooting section found at https://github.com/MythicManiac/League-of-Legends");
                Console.WriteLine("Press any key to exit...");
                Console.ReadKey();
            }
        }