예제 #1
0
        public void Save()
        {
            if (!CanSave)
            {
                return;
            }

            var ctx = CreateDecompileContext();

            if (ctx is null)
            {
                return;
            }

            tab.AsyncExec(cs => {
                ctx.Token = cs.Token;
                documentViewer.ShowCancelButton(dnSpy_BamlDecompiler_Resources.Saving, cs.Cancel);
            }, () => {
                bamlNode.Decompile(ctx.Output, ctx.Token);
            }, result => {
                ctx.Dispose();
                documentViewer.HideCancelButton();
                if (result.Exception is not null)
                {
                    messageBoxService.Show(result.Exception);
                }
            });
        }
예제 #2
0
        public void Save()
        {
            if (!CanSave)
            {
                return;
            }

            var ctx = CreateDecompileContext();

            if (ctx == null)
            {
                return;
            }

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