예제 #1
0
        public static unsafe void Scan(FileMap map, FileScanNode node)
        {
            using (ProgressWindow progress = new ProgressWindow(MainForm.Instance, "File Scanner", "Scanning for known file types, please wait...", true))
            {
                progress.TopMost = true;
                progress.Begin(0, map.Length, 0);

                byte *data = (byte *)map.Address;
                uint  i    = 0;
                do
                {
                    ResourceNode n = null;
                    DataSource   d = new DataSource(&data[i], 0);
                    if ((n = NodeFactory.GetRaw(d)) != null)
                    {
                        if (!(n is MSBinNode))
                        {
                            n.Initialize(node, d);
                            try
                            {
                                i += (uint)n.WorkingSource.Length;
                            }
                            catch
                            {
                            }
                        }
                    }
                    progress.Update(i + 1);
                }while (++i + 4 < map.Length);

                progress.Finish();
            }
        }
예제 #2
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string inFile;
            int    i = Program.OpenFile(InFilter, out inFile);

            if (i != 0)
            {
                if (i == 32)
                {
                    FileMap      map  = FileMap.FromFile(inFile, FileMapProtect.Read);
                    FileScanNode node = new FileScanNode();
                    Program.Scan(map, node);
                    if (node.Children.Count == 0)
                    {
                        MessageBox.Show("No formats recognized.");
                    }
                    else
                    {
                        Program._rootNode = node;
                        Program._rootPath = inFile;
                        node._list        = node._children;
                        node.Initialize(null, new DataSource(map));
                        Reset();
                    }
                }
                else if (Program.Open(inFile))
                {
                    RecentFileHandler.AddFile(inFile);
                }
            }
        }