| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- using System;
- using Gtk;
- public partial class MainWindow: Gtk.Window
- {
- //--------------------------------------------------------------------------------
- enum Platform
- {
- Linux32 = 0,
- Linux64,
- Windows32,
- Windows64,
- Android
- }
- //--------------------------------------------------------------------------------
- enum BuildMode
- {
- Debug = 0,
- Development,
- Release
- }
- public string project_name = null;
- public string source_path = null;
- public string destination_path = null;
- //--------------------------------------------------------------------------------
- public MainWindow () : base (Gtk.WindowType.Toplevel)
- {
- Build ();
- }
- //--------------------------------------------------------------------------------
- protected void OnDeleteEvent (object sender, DeleteEventArgs a)
- {
- Application.Quit ();
- a.RetVal = true;
- }
- //--------------------------------------------------------------------------------
- protected void OnProjectButtonClicked (object sender, EventArgs e)
- {
- starter.ProjectDialog pd = new starter.ProjectDialog (this);
- pd.Run ();
- pd.Destroy ();
- project_entry.Text = project_name;
- }
- //--------------------------------------------------------------------------------
- protected void OnRunButtonClicked (object sender, EventArgs e)
- {
- Platform platform = (Platform) platform_combobox.Active;
- BuildMode build = (BuildMode) build_combobox.Active;
- // Do not use MD for compiling because it cannot retrieve env value even though is specified in target environment.
- // Use 'xbuild' command instead.
- string path = Environment.GetEnvironmentVariable("CROWN_INSTALL_DIR") + "/";
- string executable = "";
- switch (platform)
- {
- case Platform.Linux32:
- {
- path += "bin/linux32/";
- switch (build)
- {
- case BuildMode.Debug: executable = "crown-debug-32"; break;
- case BuildMode.Development: executable = "crown-development-32"; break;
- case BuildMode.Release: executable = "crown-release-32"; break;
- }
- break;
- }
- case Platform.Linux64:
- {
- path += "bin/linux64/";
- switch (build)
- {
- case BuildMode.Debug: executable = "crown-debug-64"; break;
- case BuildMode.Development: executable = "crown-development-64"; break;
- case BuildMode.Release: executable = "crown-release-64"; break;
- }
- break;
- }
- case Platform.Windows32:
- {
- path += "bin\\windows32\\";
- switch (build)
- {
- case BuildMode.Debug: executable = "crown-debug-32"; break;
- case BuildMode.Development: executable = "crown-development-32"; break;
- case BuildMode.Release: executable = "crown-release-32"; break;
- }
- break;
- }
- case Platform.Windows64:
- {
- path += "bin\\windows64\\";
- switch (build)
- {
- case BuildMode.Debug: executable = "crown-debug-64"; break;
- case BuildMode.Development: executable = "crown-development-64"; break;
- case BuildMode.Release: executable = "crown-release-64"; break;
- }
- break;
- }
- }
- string args = " --source-dir " + source_path;
- args += " --bundle-dir " + destination_path;
- args += " --compile --continue";
- System.IO.Directory.SetCurrentDirectory (path);
- System.Diagnostics.Process.Start (executable, args);
- }
- }
|