Esempio n. 1
0
        public void Save()
        {
            if (!CanSave)
            {
                return;
            }

            var ctx = CreateDecompileContext();

            if (ctx == null)
            {
                return;
            }

            tab.AsyncExec(cs => {
                ctx.Token = cs.Token;
                uiContext.ShowCancelButton(() => cs.Cancel(), dnSpy_BamlDecompiler_Resources.Saving);
            }, () => {
                bamlNode.Decompile(ctx.Output, ctx.Token);
            }, result => {
                ctx.Dispose();
                uiContext.HideCancelButton();
                if (result.Exception != null)
                {
                    messageBoxManager.Show(result.Exception);
                }
            });
        }
Esempio n. 2
0
        public void Save()
        {
            if (!CanSave)
            {
                return;
            }

            var ctx = CreateDecompileContext();

            if (ctx == null)
            {
                return;
            }

            tab.AsyncExec(cs => {
                ctx.DecompileNodeContext.DecompilationContext.CancellationToken = cs.Token;
                uiContext.ShowCancelButton(() => cs.Cancel(), dnSpy_Resources.SavingCode);
            }, () => {
                fileTreeNodeDecompiler.Decompile(ctx.DecompileNodeContext, nodes);
            }, result => {
                ctx.Dispose();
                uiContext.HideCancelButton();
                if (result.Exception != null)
                {
                    messageBoxManager.Show(result.Exception);
                }
            });
        }