Пример #1
0
        private void testToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Signatures = new SignatureController("test.sdb");
            Signatures.SetDbVersion(3.3);
            using (OpenFileDialog ofd = new OpenFileDialog())
            {
                if (ofd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                using (System.IO.StreamReader sr = new System.IO.StreamReader(ofd.FileName))
                {
                    while (sr.Peek() > 0)
                    {
                        string   line = sr.ReadLine();
                        string[] data = line.Split('=');
                        this.lstSignatures.Items.Add(new ListViewItem(new string[]
                        {
                            (lstSignatures.Items.Count + 1).ToString(),
                            data[0],
                            format(data[1].ToUpper()),
                            "TEST",
                            DateTime.Now.ToShortDateString()
                        }));

                        var sig = new Signature()
                        {
                            Id          = Signatures.NextId(),
                            DateFound   = DateTime.Now.ToShortDateString(),
                            Definition  = data[0],
                            Description = "Imported"
                        };

                        sig.SetPatternBytes(format(data[1].ToUpper()));

                        Signatures.AddOne(sig);
                    }
                }
            }
        }
Пример #2
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // create a new save file dialog to save the new sig db to
            using (SaveFileDialog sfd = new SaveFileDialog())
            {
                // set the filter
                sfd.Filter = "(*.sdb)|*.sdb";

                // If a file location was selected
                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    // create new signatures db
                    Signatures = new SignatureController(sfd.FileName);

                    // set default db version
                    Signatures.SetDbVersion(0.1);

                    // clean up currently loaded db if any
                    CleanUp();
                }
            }
        }