Ejemplo n.º 1
0
        public NARCFile(NARC arc, ushort id)
            : base()
        {
            if (id >= 0xF000)
                throw new Exception("NARCFile: invalid file ID");

            m_Narc = arc;
            m_ID = id;
            m_Name = m_Narc.GetFileNameFromID(id);
            m_Data = m_Narc.ExtractFile(m_ID);

            if (Read32(0x0) == 0x37375A4C)
                LZ77.Decompress(ref m_Data, true);
        }
Ejemplo n.º 2
0
        private static void LoadFiles(TreeView tvFileList, TreeNode node, NitroROM.FileEntry[] files, NARC.FileEntry[] filesNARC)
        {
            TreeNode parent = node;
            String[] names = new String[0];
            if (files.Length == 0)
            {
                names = new String[filesNARC.Length];
                for (int i = 0; i < filesNARC.Length; i++)
                    names[i] = filesNARC[i].FullName;
            }
            else if (filesNARC.Length == 0)
            {
                names = new String[files.Length];
                for (int i = 0; i < files.Length; i++)
                    names[i] = files[i].FullName;
            }

            for (int i = 0; i < names.Length; i++)
            {
                String[] parts = names[i].Split('/');

                if (parts.Length == 1)
                {
                    /*if (parts[0].Equals(""))
                        tvFiles.Nodes["root"].Nodes.Add("Overlay");
                    else */if (!parts[0].Equals(""))
                        tvFileList.Nodes["root"].Nodes.Add(parts[0]).Tag = names[i];
                }
                else
                {
                    node = parent;

                    for (int j = 0; j < parts.Length; j++)
                    {
                        if (!node.Nodes.ContainsKey(parts[j]))
                            node.Nodes.Add(parts[j], parts[j]).Tag = names[i];
                        node = node.Nodes[parts[j]];

                        if (parts[j].EndsWith(".narc"))
                        {
                            LoadFiles(tvFileList, node, new NitroROM.FileEntry[] { },
                                new NARC(Program.m_ROM, Program.m_ROM.GetFileIDFromName(files[i].FullName)).GetFileEntries());
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public NARCFile(NARC arc, ushort id) : base()
        {
            if (id >= 0xF000)
            {
                throw new Exception("NARCFile: invalid file ID");
            }

            m_Narc = arc;
            m_ID   = id;
            m_Name = m_Narc.GetFileNameFromID(id);
            m_Data = m_Narc.ExtractFile(m_ID);

            if (Read32(0x0) == 0x37375A4C)
            {
                LZ77.Decompress(ref m_Data, true);
            }
        }
Ejemplo n.º 4
0
        public NitroFile GetFileFromName(string name)
        {
            ushort id = GetFileIDFromName(name);

            if (id < 0xF000)
            {
                return(new NitroFile(this, id));
            }

            string[] narcs = (m_Version == Version.EUR ? new String[] { "ar1", "arc0", "c2d", "cee", "cef", "ceg", "cei", "ces", "en1", "vs1", "vs2", "vs3", "vs4" }
                : new String[] { "ar1", "arc0", "c2d", "en1", "vs1", "vs2", "vs3", "vs4" });
            foreach (string narc in narcs)
            {
                NARC thenarc = new NARC(this, GetFileIDFromName("ARCHIVE/" + narc + ".narc"));
                id = thenarc.GetFileIDFromName(name);
                if (id < 0xF000)
                {
                    return(new NARCFile(thenarc, id));
                }
            }

            throw new Exception("NitroROM: cannot find file '" + name + "'");
        }
Ejemplo n.º 5
0
        public bool FileExists(string name)
        {
            ushort id = GetFileIDFromName(name);

            if (id < 0xF000)
            {
                return(true);
            }

            string[] narcNames = (m_Version == Version.EUR ? new String[] { "ar1", "arc0", "c2d", "cee", "cef", "ceg", "cei", "ces", "en1", "vs1", "vs2", "vs3", "vs4" }
                : new String[] { "ar1", "arc0", "c2d", "en1", "vs1", "vs2", "vs3", "vs4" });
            foreach (string narcName in narcNames)
            {
                NARC narc = new NARC(this, GetFileIDFromName("ARCHIVE/" + narcName + ".narc"));
                id = narc.GetFileIDFromName(name);
                if (id < 0xF000)
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 6
0
        public NitroFile GetFileFromName(string name)
        {
            ushort id = GetFileIDFromName(name);
            if (id < 0xF000)
                return new NitroFile(this, id);

            string[] narcs = (m_Version == Version.EUR ? new String[]{ "ar1", "arc0", "c2d", "cee", "cef", "ceg", "cei", "ces", "en1", "vs1", "vs2", "vs3", "vs4" }
                : new String[] { "ar1", "arc0", "c2d", "en1", "vs1", "vs2", "vs3", "vs4" });
            foreach (string narc in narcs)
            {
                NARC thenarc = new NARC(this, GetFileIDFromName("ARCHIVE/" + narc + ".narc"));
                id = thenarc.GetFileIDFromName(name);
                if (id < 0xF000)
                    return new NARCFile(thenarc, id);
            }

            throw new Exception("NitroROM: cannot find file '" + name + "'");
        }