Exemple #1
0
        protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
        {
            var project = await VS.Solutions.GetActiveProjectAsync();

            var path      = project.FullPath;
            var xsproject = XSolution.FindProject(path);

            if (xsproject != null)
            {
                path = xsproject.ProjectNode.OutputFile;
                if (System.IO.File.Exists(path))
                {
                    var disasm = XEditorSettings.Disassembler;
                    if (string.IsNullOrEmpty(disasm))
                    {
                        await VS.MessageBox.ShowWarningAsync("No disassembler defined.", "Please setup the disassembler in Tools/Options/X# Customer Editors/Other Editors");
                    }
                    else if (!System.IO.File.Exists(disasm))
                    {
                        await VS.MessageBox.ShowWarningAsync($"Cannot find disassembler '{disasm}'", "Please setup the disassembler in Tools/Options/X# Customer Editors/Other Editors");
                    }
                    else
                    {
                        await Commands.StartProcessAsync(disasm, path);
                    }
                }
                else
                {
                    await VS.MessageBox.ShowWarningAsync($"Output file '{path}' not found.", "Build the project first");
                }
            }
        }
        private async Task CheckAvailabilityAsync()
        {
            Command.Visible = await Commands.ProjectIsXSharpProjectAsync();

            if (Command.Visible)
            {
                var project = await VS.Solutions.GetActiveProjectAsync();

                var path      = project.FullPath;
                var xsproject = XSolution.FindProject(path);
                var isVulcan  = false;
                //if (xsproject != null)
                //{
                //    foreach (var asmref in xsproject.AssemblyReferences)
                //    {
                //        if (asmref.FullName.Contains("Vulcan"))
                //        {
                //            isVulcan = true;
                //            break;
                //        }
                //    }
                //}
                Command.Visible = isVulcan;
            }
        }
        protected override async Task ExecuteAsync(OleMenuCmdEventArgs e)
        {
            if (currentFile != null)
            {
                var newfile = System.IO.Path.ChangeExtension(currentFile.FullPath, ".designer.prg");
                await VS.StatusBar.ShowMessageAsync("Creating designer file:" + newfile);

                System.IO.File.WriteAllText(newfile, "");
                var project = currentFile.ContainingProject;
                if (project != null)
                {
                    var xproject = XSolution.FindProject(project.FullPath);
                    if (xproject != null)
                    {
                        xproject.ProjectNode.AddFileNode(newfile);
                    }
                }
                await VS.StatusBar.ShowMessageAsync("");
            }
        }