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

            var ctx = CreateDecompileContext();

            if (ctx == 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 != null)
                {
                    messageBoxManager.Show(result.Exception);
                }
            });
        }
Ejemplo 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;
                documentViewer.ShowCancelButton(dnSpy_Resources.SavingCode, () => cs.Cancel());
            }, () => {
                fileTreeNodeDecompiler.Decompile(ctx.DecompileNodeContext, nodes);
            }, result => {
                ctx.Dispose();
                documentViewer.HideCancelButton();
                if (result.Exception != null)
                {
                    messageBoxManager.Show(result.Exception);
                }
            });
        }