Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = "AFP Files|*.afp";
            DialogResult result = dlg.ShowDialog();

            if (result == DialogResult.OK)
            {
                // parse for line data
                byte[]      afpdata = File.ReadAllBytes(dlg.FileName);
                AFPDocument Doc     = new AFPDocument(afpdata);

                //Update Document Info
                lblFileName.Text  = dlg.FileName;
                lblNodeCount.Text = Doc.Nodes.Count.ToString();
                // Update list tab
                lstNodes.DataSource    = Doc.Nodes;
                lstNodes.DisplayMember = "Name";

                // build AFP Data field
                // Build readable data field
                //AFPTreeView tv = new AFPTreeView(parsedData);
                //tv.populateTreeView(treeView1);
                string x = "0";
            }
        }
Пример #2
0
        private void btnloadafp_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = "AFP Files|*.afp";
            DialogResult result = dlg.ShowDialog();

            if (result == DialogResult.OK)
            {
                lblFileName.Text = dlg.FileName;

                // parse for line data
                byte[]             afpdata    = File.ReadAllBytes(dlg.FileName);
                AFPDocument        Doc        = new AFPDocument(afpdata);
                List <AFPDataLine> parsedData = AFPFormatHelper.Lines(afpdata);

                lstLines.DataSource    = Doc.Nodes;
                lstLines.DisplayMember = "Name";

                // build AFP Data field
                // Build readable data field
                AFPTreeView tv = new AFPTreeView(parsedData);
                tv.populateTreeView(treeView1);
                string x = "0";
            }
        }