コード例 #1
0
ファイル: FileMapDisplay.cs プロジェクト: spazmodica/acrender
 private void ShowGraph(FileGraph graph)
 {
     try
     {
         tvStructureTree.BeginUpdate();
         tvStructureTree.Nodes.Clear();
         AddDisplayNodeToTree(tvStructureTree.Nodes, graph.RootNode, 0);
         //tvStructureTree.ExpandAll();
     }
     finally
     {
         tvStructureTree.EndUpdate();
     }
 }
コード例 #2
0
        public FileGraph ApplyFilterToFile(EmbeddedFile file, string filterName,
                                           IParserOutput output)
        {
            if (file == null || filterName == null || output == null)
            {
                throw new ArgumentException("Invalid parameters specified.");
            }

            // lookup the filter with the specified name
            DataFileDef filter = m_mapping.GetFilterByName(filterName);

            if (filter == null)
            {
                output.HandleFatalError("The specified filter does not exist.");
            }

            FileGraph graph = new FileGraph(file.FileId);

            try
            {
                // open the input file
                file.PrepareFileForReading();

                // create a root node in the graph
                graph.RootNode = new GraphNode("Root node", NodeType.Complex, file.Position);
                foreach (object filterObject in filter.Items)
                {
                    DecodeEntry(graph.RootNode, filterObject, output, file);
                }
                graph.RootNode.FilePositionEnd = file.Position;

                graph.UpdateEndPositionOfNodes();
            }
            catch (Exception ex)
            {
                output.HandleFatalError("Unexpected exception: " + ex.Message);
            }
            finally
            {
                file.FileReadingComplete();
            }
            return(graph);
        }
コード例 #3
0
ファイル: FileMapDisplay.cs プロジェクト: spazmodica/acrender
        private void ApplyFilterToFile()
        {
            if (cbFilters.SelectedIndex >= 0 && cbFiles.SelectedIndex >= 0)
            {
                uint   fileId     = UInt32.Parse(cbFiles.SelectedItem.ToString(), NumberStyles.HexNumber);
                string filterName = cbFilters.SelectedItem.ToString();

                m_currentFile = DataProvider.Instance.PortalDatReader.LocateFile(fileId);
                FileGraph graph = m_parser.ApplyFilterToFile(m_currentFile, filterName, this);
                if (graph != null)
                {
                    ShowGraph(graph);
                    ShowFileContents();
                }
            }
            else
            {
                // clear the display
            }
        }