Пример #1
0
 public void FromConfuserProject(ConfuserProject prj)
 {
     output = prj.OutputPath;
     snKey  = prj.SNKeyPath;
     seed   = prj.Seed;
     dbg    = prj.Debug;
     foreach (var i in prj.Plugins)
     {
         LoadAssembly(Assembly.LoadFrom(i), false);
     }
     if (prj.Packer != null)
     {
         this.packer = new PrjConfig <Packer>(Packers.Single(_ => _.ID == prj.Packer.Id), this);
         foreach (var j in prj.Packer.AllKeys)
         {
             this.packer.Add(new PrjArgument(this)
             {
                 Name = j, Value = prj.Packer[j]
             });
         }
     }
     foreach (var i in prj)
     {
         PrjAssembly asm = new PrjAssembly(this);
         asm.FromCrAssembly(this, i);
         Assemblies.Add(asm);
     }
     foreach (var i in prj.Rules)
     {
         PrjRule rule = new PrjRule(this);
         rule.FromCrRule(this, i);
         Rules.Add(rule);
     }
 }
Пример #2
0
 public EditRule(string title, PrjRule src, IHost host)
 {
     InitializeComponent();
     Title = title;
     if (src == null)
     {
         Rule = new PrjRule(null);
     }
     else
     {
         Rule = src.Clone(null);
     }
     DataContext  = Rule;
     Host         = host;
     this.Loaded += (sender, e) => patternBox.Focus();
 }
Пример #3
0
        private void rulesList_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var         elem = rulesList.InputHitTest(e.GetPosition(rulesList));
            ListBoxItem item = Helper.FindParent <ListBoxItem>(elem as DependencyObject);

            if (item != null)
            {
                PrjRule rule = item.Content as PrjRule;
                var     win  = new EditRule("Edit rule", rule, host)
                {
                    Owner = host as Window
                };
                if (win.ShowDialog() ?? false)
                {
                    int idx = host.Project.Rules.IndexOf(rule);
                    host.Project.Rules.RemoveAt(idx);
                    host.Project.Rules.Insert(idx, win.Rule.Clone(host.Project));
                    rulesList.SelectedIndex = idx;
                }
            }
        }
Пример #4
0
        public PrjRule Clone(INotifyChildrenChanged parent)
        {
            PrjRule ret = new PrjRule(parent);

            ret.inherit = inherit;
            ret.preset  = preset;
            ret.pattern = pattern;
            foreach (PrjConfusionCfg i in this)
            {
                PrjConfusionCfg n = new PrjConfusionCfg(i.Object, ret);
                n.Action = i.Action;
                foreach (var j in i)
                {
                    n.Add(new PrjArgument(n)
                    {
                        Name = j.Name, Value = j.Value
                    });
                }
                ret.Add(n);
            }
            return(ret);
        }