예제 #1
0
        public void ExecuteCreateNewRule()
        {
            var t = new ForensicRulePackage()
            {
                Name            = RuleName,
                Desc            = RuleDesc,
                PackageFilePath = VMMain.Instance.VMConfig.RulePath + RuleName + ".txt",
                Items           = new List <ForensicRuleItemInfo>()
            };

            RuleManager.SavePackage(t, false);
            var tNode = new RuleFileNode()
            {
                Desc    = RuleDesc,
                Package = t,
            };

            if (dataSource == null)
            {
                DataSource = new List <RuleFileNode>()
                {
                    tNode
                };
            }
            else
            {
                var tSource = DataSource as List <RuleFileNode>;
                tSource.Add(tNode);
            }
            CurrentEditPackages.Add(tNode);
        }
예제 #2
0
        public void ExecuteLoadRuleFromFile()
        {
            var ofd = new System.Windows.Forms.OpenFileDialog();

            ofd.InitialDirectory = VMMain.Instance.VMConfig.RulePath;
            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string path = ofd.FileName;
                string name = System.IO.Path.GetFileNameWithoutExtension(path);
                var    t    = CurrentEditPackages.FirstOrDefault(c => c.Package.PackageFilePath == path);
                if (t == null)
                {
                    var tNode = new RuleFileNode()
                    {
                        Desc    = name,
                        Package = new ForensicRulePackage()
                        {
                            Desc            = name,
                            PackageFilePath = path,
                            OrgText         = System.IO.File.ReadAllText(path, System.Text.Encoding.Default)
                        }
                    };

                    CurrentEditPackages.Add(tNode);
                    SelectedTabIndex = CurrentEditPackages.Count - 1;
                }
                else
                {
                    SelectedTabIndex = CurrentEditPackages.FindIndex(c => c == t);
                }
            }
        }
예제 #3
0
        public void ExecuteOpenSelectedFile()
        {
            if (SelectedItem == null || SelectedItem.Package == null)
            {
                return;
            }

            if (!CurrentEditPackages.Contains(SelectedItem))
            {
                CurrentEditPackages.Add(SelectedItem);
                SelectedTabIndex = CurrentEditPackages.Count - 1;
            }
            else
            {
                SelectedTabIndex = CurrentEditPackages.FindIndex(c => c == SelectedItem);
            }
        }
예제 #4
0
 public void ExecuteCloseTab(RuleFileNode node)
 {
     CurrentEditPackages.Remove(node);
 }