public void QuickBuild(string filename) { // environment string currentPath = Directory.GetCurrentDirectory(); string buildPath = mainForm.ProcessArgString("@PROJECTDIR"); if (!Directory.Exists(buildPath) || !filename.ToLower().StartsWith(buildPath.ToLower())) { buildPath = Path.GetDirectoryName(filename); } // command builtSWF = Path.Combine(buildPath, Path.GetFileNameWithoutExtension(filename) + ".swf"); bool playAfterBuild = true; string cmd = "-o;" + builtSWF + ";--;"; Match mCmd = Regex.Match(ASContext.MainForm.CurSciControl.Text, "\\s@mxmlc\\s(?<cmd>.*)"); if (mCmd.Success) { try { bool hasOutput = false; // cleanup tag string tag = mCmd.Groups["cmd"].Value; if (tag.IndexOf("-->") > 0) { tag = tag.Substring(0, tag.IndexOf("-->")); } if (tag.IndexOf("]]>") > 0) { tag = tag.Substring(0, tag.IndexOf("]]>")); } tag = " " + tag.Trim() + " --"; // split MatchCollection mPar = re_SplitParams.Matches(tag); if (mPar.Count > 0) { cmd = ""; string op; string arg; for (int i = 0; i < mPar.Count; i++) { op = mPar[i].Groups["switch"].Value; if (op == "-noplay") { playAfterBuild = false; continue; } int start = mPar[i].Index + mPar[i].Length; int end = (i < mPar.Count - 1) ? mPar[i + 1].Index : 0; if (end > start) { string concat = ";"; arg = tag.Substring(start, end - start).Trim(); if (arg.StartsWith("+=") || arg.StartsWith("=")) { concat = arg.Substring(0, arg.IndexOf('=') + 1); arg = arg.Substring(concat.Length); } bool isPath = false; foreach (string pswitch in PATH_SWITCHES) { if (pswitch.Replace("--", "-") == op) { isPath = true; if (!arg.StartsWith("\\") && !re_Disk.IsMatch(arg)) { arg = ASContext.NormalizeSeparators(Path.Combine(buildPath, arg)); } } } if (op == "-o" || op == "-output") { builtSWF = arg; hasOutput = true; } if (!isPath) { arg = arg.Replace(" ", ";"); } cmd += op + concat + arg + ";"; } else { cmd += op + ";"; } } } // output default if (!hasOutput) { cmd = "-o;" + builtSWF + ";" + cmd; } } catch { ErrorHandler.ShowInfo("The @mxmlc tag seem invalid."); } } // build cmd = cmd.Replace(";;", ";"); RunMxmlc(cmd + filename); if (!playAfterBuild) { builtSWF = null; } // restaure working directory Directory.SetCurrentDirectory(currentPath); }