private void New_Click(object sender, RoutedEventArgs e) { if (Project.IsModified) { switch (MessageBox.Show( "You have unsaved changes in this project!\r\nDo you want to save them?", "Confuser", MessageBoxButton.YesNoCancel, MessageBoxImage.Question)) { case MessageBoxResult.Yes: Save_Click(this, new RoutedEventArgs()); break; case MessageBoxResult.No: break; case MessageBoxResult.Cancel: return; } } Project = new Prj(); foreach (ConfuserTab i in Tab.Items) { i.InitProj(); } Project = new Prj(); foreach (ConfuserTab i in Tab.Items) { i.InitProj(); } Project.PropertyChanged += new PropertyChangedEventHandler(ProjectChanged); ProjectChanged(Project, new PropertyChangedEventArgs("")); Tab.SelectedIndex = 0; }
public void FromCrAssembly(Prj prj, ProjectAssembly asm) { this.path = asm.Path; this.asmDef = asm.Resolve(prj.GetBasePath()); this.IsExecutable = this.asmDef.MainModule.EntryPoint != null; this.isMain = asm.IsMain; }
private void Open_Click(object sender, RoutedEventArgs e) { if (Project.IsModified) { switch (MessageBox.Show( "You have unsaved changes in this project!\r\nDo you want to save them?", "Confuser", MessageBoxButton.YesNoCancel, MessageBoxImage.Question)) { case MessageBoxResult.Yes: Save_Click(this, new RoutedEventArgs()); break; case MessageBoxResult.No: break; case MessageBoxResult.Cancel: return; } } OpenFileDialog sfd = new OpenFileDialog(); sfd.Filter = "Confuser Project (*.crproj)|*.crproj|All Files (*.*)|*.*"; if (sfd.ShowDialog() ?? false) { try { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(sfd.FileName); ConfuserProject proj = new ConfuserProject(); proj.Load(xmlDoc); Prj prj = new Prj(); prj.FromConfuserProject(proj); prj.FileName = sfd.FileName; Project = prj; foreach (ConfuserTab i in Tab.Items) { i.InitProj(); } prj.PropertyChanged += new PropertyChangedEventHandler(ProjectChanged); prj.IsModified = false; ProjectChanged(Project, new PropertyChangedEventArgs("")); Tab.SelectedIndex = 0; } catch (Exception ex) { MessageBox.Show(string.Format( @"Invalid project file! Message : {0} Stack Trace : {1}", ex.Message, ex.StackTrace), "Confuser", MessageBoxButton.OK, MessageBoxImage.Error); } } }
public void LoadPrj(string path) { if (Project.IsModified) { switch (MessageBox.Show( "You have unsaved changes in this project!\r\nDo you want to save them?", "Confuser", MessageBoxButton.YesNoCancel, MessageBoxImage.Question)) { case MessageBoxResult.Yes: Save_Click(this, new RoutedEventArgs()); break; case MessageBoxResult.No: break; case MessageBoxResult.Cancel: return; } } try { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(path); ConfuserProject proj = new ConfuserProject(); proj.Load(xmlDoc); Prj prj = new Prj(); prj.FileName = path; prj.FromConfuserProject(proj); Project = prj; foreach (ConfuserTab i in Tab.Items) { i.InitProj(); } prj.PropertyChanged += new PropertyChangedEventHandler(ProjectChanged); prj.IsModified = false; ProjectChanged(Project, new PropertyChangedEventArgs("")); Tab.SelectedIndex = 0; } catch (Exception ex) { MessageBox.Show(string.Format( @"Invalid project file! Message : {0} Stack Trace : {1}", ex.Message, ex.StackTrace), "Confuser", MessageBoxButton.OK, MessageBoxImage.Error); } }
public MainWindow() { InitializeComponent(); this.Width = 800; this.Height = 600; //=_=|| Tab.ApplyTemplate(); TabPanel panel = Tab.Template.FindName("HeaderPanel", Tab) as TabPanel; panel.SetBinding(TabPanel.IsEnabledProperty, new Binding() { Path = new PropertyPath(EnabledNavigationProperty), Source = this }); menu = FindResource("dropMenu") as ContextMenu; menu.PlacementTarget = drop; menu.Placement = PlacementMode.Bottom; (menu.Items[0] as MenuItem).Click += DbViewer_Click; (menu.Items[1] as MenuItem).Click += StackDecoder_Click; (menu.Items[2] as MenuItem).Click += About_Click; IPage page; page = new Asms(); page.Init(this); Tab.Items.Add(page); page = new Settings(); page.Init(this); Tab.Items.Add(page); page = new Rules(); page.Init(this); Tab.Items.Add(page); page = new Progress(); page.Init(this); Tab.Items.Add(page); Project = new Prj(); foreach (ConfuserTab i in Tab.Items) { i.InitProj(); } Project.PropertyChanged += new PropertyChangedEventHandler(ProjectChanged); ProjectChanged(Project, new PropertyChangedEventArgs("")); }
public void FromCrRule(Prj prj, Rule rule) { pattern = rule.Pattern; preset = rule.Preset; inherit = rule.Inherit; foreach (var i in rule) { PrjConfusionCfg cfg = new PrjConfusionCfg(prj.Confusions.Single(_ => _.ID == i.Id), this); cfg.Action = i.Action; foreach (var j in i.AllKeys) { cfg.Add(new PrjArgument(this) { Name = j, Value = i[j] }); } this.Add(cfg); } }