예제 #1
0
        private static void LoadItemData()
        {
            model.items = new List <dynamic>();

            try
            {
                DisplayMessage("Loading item data...");

                int[][] fileids =
                {     //                                 Armor   Weapons
                    new [] { 0x0049, 0x004A, 0x004D, 0x004C, 0x004B, 0x005B, 0xD973, 0xD974, 0xD977, 0xD975 },
                    new [] { 0x0004, 0x0005, 0x0008, 0x0007, 0x0006, 0x0009, 0xD8FB, 0xD8FC, 0xD8FF, 0xD8FD },
                };

                for (var i = 0; i < fileids[0].Length; ++i)
                {
                    using (FileStream stream = File.Open(GetPath(fileids[0][i]), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                        using (FileStream streamja = File.Open(GetPath(fileids[1][i]), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                        {
                            ResourceParser.ParseItems(stream, streamja);
                        }
                }
            }
            finally
            {
                DisplayResult(model.items.Count != 0);
            }
        }
        private static void LoadStreamItem(Stream stream, Header header)
        {
            switch (header.Type)
            {
            case BlockType.ContainerEnd:
                break;

            case BlockType.ContainerBegin:
                stream.Position -= Marshal.SizeOf(typeof(Header));
                ParseMainStream(stream);
                break;

            case BlockType.SpellData:
                ResourceParser.ParseSpells(stream, header.Size);
                break;

            case BlockType.AbilityData:
                ResourceParser.ParseActions(stream, header.Size);
                break;

            default:
                Trace.WriteLine(string.Format(CultureInfo.InvariantCulture, "Unknown [{0:X2}]", (int)header.Type));
                break;
            }
        }
예제 #3
0
        private static void LoadMainData()
        {
            DisplayMessage("Loading main data stream...");
#if !DEBUG
            try
            {
#endif
            using (var file = File.OpenRead(GetPath(0x0051)))
            {
                ResourceParser.ParseMainStream(file);
            }
#if !DEBUG
        }

        catch
        {
            DisplayError();
            throw;
        }
#endif

            DisplaySuccess();
        }
예제 #4
0
        private static void Main()
        {
#if !DEBUG
            try
            {
#endif
            Console.CursorVisible = false;

            model = new ModelObject();
            foreach (var category in categories)
            {
                model[category] = new List <dynamic>();
            }
            foreach (var pair in DatLut)
            {
                model[pair.Key] = new List <dynamic>();
            }

            ResourceParser.Initialize(model);

            Dir = GetBaseDirectory();
            Console.WriteLine();
            if (Dir != null)
            {
                LoadItemData();         // Items, Monstrosity
                LoadMainData();         // Abilities, Spells

                ParseStringTables();
                Console.WriteLine();

                PostProcess();
                Console.WriteLine();

                ApplyFixes();
                Console.WriteLine();

                // Clear directories
                Directory.CreateDirectory("resources");
                foreach (var path in new [] { "lua", "xml", "json", "maps" }.Select(dir => "resources/" + dir))
                {
                    Directory.CreateDirectory(path);
                    foreach (var file in Directory.EnumerateFiles(path))
                    {
                        File.Delete(file);
                    }
                }

                WriteData();
                Console.WriteLine();

                MapParser.Extract();
                Console.WriteLine();

                Console.WriteLine("Resource extraction complete!");
            }
            else
            {
                Console.WriteLine("Unable to locate Final Fantasy XI installation.");
            }
#if !DEBUG
        }

        catch
        {
            if (Debugger.IsAttached)
            {
                throw;
            }
        }
#endif
            Console.WriteLine();
        }