Esempio n. 1
0
        // shows the UI and returns non-null settings if everything went OK in the
        // setup process.
        public static LogWriterSettings?ConfirmSettingsAndAskToStart(Project project)
        {
            var export = new ExportDisassembly(project);

            if (export.ShowDialog() != DialogResult.OK)
            {
                return(null);
            }

            return(export.settings);
        }
Esempio n. 2
0
        private void exportLogToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ExportDisassembly export = new ExportDisassembly();
            DialogResult      result = export.ShowDialog();

            if (result == DialogResult.OK)
            {
                string file = null, error = null;
                if (LogCreator.structure == LogCreator.FormatStructure.SingleFile)
                {
                    saveLogSingleFile.InitialDirectory = Project.currentFile;
                    result = saveLogSingleFile.ShowDialog();
                    if (result == DialogResult.OK && saveLogSingleFile.FileName != "")
                    {
                        file  = saveLogSingleFile.FileName;
                        error = Path.GetDirectoryName(file) + "/error.txt";
                    }
                }
                else
                {
                    chooseLogFolder.SelectedPath = Path.GetDirectoryName(Project.currentFile);
                    result = chooseLogFolder.ShowDialog();
                    if (result == DialogResult.OK && chooseLogFolder.SelectedPath != "")
                    {
                        file  = chooseLogFolder.SelectedPath + "/main.asm";
                        error = Path.GetDirectoryName(file) + "/error.txt";
                    }
                }

                if (file != null)
                {
                    int errors = 0;
                    using (StreamWriter sw = new StreamWriter(file))
                        using (StreamWriter er = new StreamWriter(error))
                        {
                            errors = LogCreator.CreateLog(sw, er);
                            if (errors > 0)
                            {
                                MessageBox.Show("Disassembly created with errors. See errors.txt for details.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                            else
                            {
                                MessageBox.Show("Disassembly created successfully!", "Complete", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            }
                        }
                    if (errors == 0)
                    {
                        File.Delete(error);
                    }
                }
            }
        }