Beispiel #1
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);
                }
            }
        }
Beispiel #2
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);
            }
        }