Esempio n. 1
0
        public void LoadFile(byte[] data, string Name = "")
        {
            Textures = new Dictionary <string, TextureData>();

            Data          = data;
            BinaryTexFile = new BntxFile(new MemoryStream(Data));
            Text          = BinaryTexFile.Name;

            prop               = new PropertieGridData();
            prop.Target        = new string(BinaryTexFile.Target);
            prop.VersionMajor  = BinaryTexFile.VersionMajor;
            prop.VersionMajor2 = BinaryTexFile.VersionMajor2;
            prop.VersionMinor  = BinaryTexFile.VersionMinor;
            prop.VersionMinor2 = BinaryTexFile.VersionMinor2;
            prop.VersionFull   = $"{BinaryTexFile.VersionMajor}.{BinaryTexFile.VersionMajor2}.{BinaryTexFile.VersionMinor}.{BinaryTexFile.VersionMinor2}";

            foreach (Texture tex in BinaryTexFile.Textures)
            {
                TextureData texData = new TextureData(tex, BinaryTexFile);
                //      texData.LoadOpenGLTexture();

                Nodes.Add(texData);
                Textures.Add(tex.Name, texData);
            }
            BinaryTexFile.Textures.Clear(); //We don't need these in memeory anymore
            BinaryTexFile.TextureDict.Clear();
        }
Esempio n. 2
0
        public void LoadFile(byte[] data, string Name = "")
        {
            Textures = new Dictionary <string, TextureData>();

            Data          = data;
            BinaryTexFile = new BntxFile(new MemoryStream(Data));
            Text          = BinaryTexFile.Name;

            prop               = new PropertieGridData();
            prop.Target        = new string(BinaryTexFile.Target);
            prop.VersionMajor  = BinaryTexFile.VersionMajor;
            prop.VersionMajor2 = BinaryTexFile.VersionMajor2;
            prop.VersionMinor  = BinaryTexFile.VersionMinor;
            prop.VersionMinor2 = BinaryTexFile.VersionMinor2;
            prop.VersionFull   = $"{BinaryTexFile.VersionMajor}.{BinaryTexFile.VersionMajor2}.{BinaryTexFile.VersionMinor}.{BinaryTexFile.VersionMinor2}";

            foreach (Texture tex in BinaryTexFile.Textures)
            {
                TextureData texData = new TextureData(tex, BinaryTexFile);
                //      texData.LoadOpenGLTexture();

                Nodes.Add(texData);
                Textures.Add(tex.Name, texData);
            }

            ContextMenu = new ContextMenu();
            MenuItem export = new MenuItem("Export BNTX");

            ContextMenu.MenuItems.Add(export);
            export.Click += Export;
            MenuItem replace = new MenuItem("Replace BNTX");

            ContextMenu.MenuItems.Add(replace);
            replace.Click += Import;
            MenuItem importTex = new MenuItem("Import Texture");

            ContextMenu.MenuItems.Add(importTex);
            importTex.Click += ImportTexture;
            MenuItem exportAll = new MenuItem("Export All Textures");

            ContextMenu.MenuItems.Add(exportAll);
            exportAll.Click += ExportAll;
            MenuItem clear = new MenuItem("Clear");

            ContextMenu.MenuItems.Add(clear);
            clear.Click += Clear;
        }