Exemplo n.º 1
0
        void AddTemplate(Type type)
        {
            if (!typeof(IReverseTemplate).IsAssignableFrom(type))
            {
                return;
            }

            IReverseTemplate t = (IReverseTemplate)Activator.CreateInstance(type);

            toolStripDropDownButton1.DropDownItems.Add(t.Template, t.GetLogo(), openToolStripMenuItem_Click).Tag = t;
            formatToolStripMenuItem.DropDownItems.Add(t.Template, t.GetLogo(), openToolStripMenuItem_Click).Tag  = t;
        }
Exemplo n.º 2
0
        void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            IReverseTemplate tag = null;

            if (sender != null && sender is ToolStripItem ti)
            {
                tag = (IReverseTemplate)ti.Tag;
            }

            if (tag == null)
            {
                return;
            }

            if (Reverser != null)
            {
                Reverser = null;
            }
            CleanDebugger();

            if (Result != null)
            {
                Result.Instructions.Clear();
                Result = null;
            }

            Template = tag;

            Reverser = Template.CreateReverser();
            Reverser.OnParseProgress += OnReverseProgress;

            if (Config == null || Template.ConfigType == null || Config.GetType() != Template.ConfigType)
            {
                if (Config != null && Config is IDisposable d)
                {
                    d.Dispose();
                }

                //preferencesToolStripMenuItem_Click(sender, e);
                Config = null;
            }

            EnableDisableConfig();
            EnableDisableDebugger();
        }