static void Build(string projectPath, string outputPath) { Console.Out.WriteLine("\nBuilding: " + projectPath); Console.Out.WriteLine(); string appExePath = System.Reflection.Assembly.GetExecutingAssembly().Location; System.IO.FileInfo fi = new System.IO.FileInfo(appExePath); appExePath = Util.FixPath(fi.DirectoryName); //NOTE: In order to load an existing settings.xml file for debugging, you must first //create one using the GUI then copy it into the directory from which this assembly //is running (normally jsbuildconsole\bin\debug). Otherwise it will simply use defaults. Options.GetInstance().Load(appExePath); if (cleanOutputDir != null) { //If the clean flag was specified as a param, override the project setting Options.GetInstance().ClearOutputDir = (bool)cleanOutputDir; } ProjectBuilder.MessageAvailable += new MessageDelegate(ProjectBuilder_MessageAvailable); ProjectBuilder.ProgressUpdate += new ProgressDelegate(ProjectBuilder_ProgressUpdate); ProjectBuilder.BuildComplete += new BuildCompleteDelegate(ProjectBuilder_BuildComplete); Project project = Project.GetInstance(); project.Load(appExePath, projectPath); ProjectBuilder.Build(project, outputPath); Wait(); }
private void okButton_Click(object sender, EventArgs e) { string filePath = txtPath.Text.Trim(); DirectoryInfo path = Directory.GetParent(filePath); if (path == null) { MessageBox.Show("The File Name is not valid", "JS Builder Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!path.Exists) { DialogResult dr = MessageBox.Show("Directory '" + path.FullName + "' does not exist. Create it?", "JS Builder", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dr == DialogResult.OK) { Directory.CreateDirectory(path.FullName); } else { return; } } filePath = filePath + (filePath.EndsWith(".jsb") ? "" : ".jsb"); Options.GetInstance().LastProject = filePath; Project.GetInstance().Load(Application.ExecutablePath, Options.GetInstance().LastProject); Project.GetInstance().Name = txtName.Text; this.DialogResult = DialogResult.OK; this.Close(); }
public void Load(string applicationExePath) { XmlSerializer s = new XmlSerializer(typeof(Options)); FileInfo fi = new FileInfo(new FileInfo(applicationExePath).Directory.FullName + "\\settings.xml"); if (fi.Exists) { TextReader r = new StreamReader(new FileInfo(applicationExePath).Directory.FullName + "\\settings.xml"); instance = (Options)s.Deserialize(r); r.Close(); } Project.GetInstance().FileFilter = this.Files; }
private void okButton_Click(object sender, EventArgs e) { Project p = Project.GetInstance(); if (txtName.Text.Trim().Length < 1) { MessageBox.Show("A target name is required.", "JS Builder Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtName.Focus(); return; } if (txtFile.Text.Trim().Length < 1) { MessageBox.Show("A file name is required.", "JS Builder Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtFile.Focus(); return; } if (incs.Items.Count < 1) { MessageBox.Show("You must select at least one file to include.", "JS Builder Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); files.Focus(); return; } if (originalName.Length == 0) { List <Target> targets = p.GetTargets(false); foreach (Target t in targets) { if (t.Name.Trim().ToLower() == txtName.Text.Trim().ToLower()) { MessageBox.Show("The target name '" + txtName.Text.Trim() + "' already exists. Please choose a new name.", "JS Builder Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } } target.Includes = new List <string>(incs.Items.Count); foreach (ListViewItem li in incs.Items) { target.Add(li.Name); } p.AddTarget(target, originalName); this.Close(); }
private void RefreshTree() { LoadFiles(); Project.GetInstance().FileFilter = Options.GetInstance().Files; tbRemoveFolder.Enabled = false; }
public OutputForm(Target t) { Project p = Project.GetInstance(); InitializeComponent(); files.BeginUpdate(); if (t == null) { this.target = new Target("New Target", "$output\\target.js", new List <string>()); this.originalName = ""; } else { this.target = t; this.originalName = target.Name; } List <FileInfo> selFiles = p.SelectedFiles; ListViewItem[] incItems = new ListViewItem[target.Includes.Count]; foreach (FileInfo sf in selFiles) { string name = p.GetPath(sf.FullName); int index = target.Includes.IndexOf(name); if (index != -1) { (incItems[index] = new ListViewItem(new string[] { sf.Name, sf.FullName }, 9)).Name = name; } else { ListViewItem li = files.Items.Add(name, sf.Name, 9); li.SubItems.Add(sf.FullName); } } incs.BeginUpdate(); foreach (ListViewItem li in incItems) { if (li != null) { incs.Items.Add(li); } } incs.EndUpdate(); files.EndUpdate(); txtName.DataBindings.Add("Text", target, "Name"); txtFile.DataBindings.Add("Text", target, "File"); cbWrap.DataBindings.Add("Checked", target, "Shorthand"); txtList.DataBindings.Add("Text", target, "ShorthandList"); debug.DataBindings.Add("Checked", target, "Debug"); if (t == null) { FileInfo fi = new FileInfo(new FileInfo(Application.ExecutablePath).Directory.FullName + "\\shorthand.txt"); if (fi.Exists) { StreamReader sr = new StreamReader(fi.FullName); this.target.ShorthandList = sr.ReadToEnd(); sr.Close(); } } }