summaryrefslogtreecommitdiff
path: root/love2dToAPK/Forms/frmOutput.cs
blob: 5d63b719b56ee59498a2775ac83a606ba4c76a06 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Threading;
using System.Windows.Forms;

namespace love2dToAPK.Forms {
    public partial class frmOutput : love2dToAPK.Forms.baseForm {

        public string projectPath { get; set; }
        public string responseCode { get; set; }

        private Thread _compilerThread;
        private string _toolsPath = AppDomain.CurrentDomain.BaseDirectory;

        public frmOutput() {
            InitializeComponent();

            WindowTitle = "Output";
            MinimizeAble = false;
            txtOutput.ScrollBars = ScrollBars.Vertical;
        }

        private void frmOutput_Load(object sender, EventArgs e) {
            _compilerThread = new Thread(compileRoutine);
            _compilerThread.Start();

            this.TopMost = Properties.Settings.Default.alwaysOnTop;
        }

        private void compileRoutine() {
            Compiler compiler = new Compiler(projectPath);
            compiler.compile();
            
            if (compiler.BuildSuccessful && Properties.Settings.Default.closeOnSuccess) {
                this.Invoke((MethodInvoker)delegate {
                    this.Close();
                });
            }
        }

        public void log(string str) {
            if (InvokeRequired) {
                this.Invoke(new Action<string>(log), new object[] { str });
                return;
            }
            txtOutput.AppendText(str + "\r\n");
        }

    }
}