Example #1
0
        public string Complie(string coffeText)
        {
            string javaScriptText;
            string tempFile   = Path.Combine(Directory.GetCurrentDirectory(), Guid.NewGuid() + "temp");
            string tempTsFile = tempFile + ".ts";
            string tempJsFile = tempFile + ".js";

            try
            {
                File.WriteAllText(tempTsFile, coffeText);
                var output = ExeRunner.Execute(Helper.GetCoffeePath(), tempTsFile);

                if (!string.IsNullOrEmpty(output))
                {
                    throw new CompileException(output);
                }

                javaScriptText = File.ReadAllText(tempJsFile);
                File.Delete(tempTsFile);
                File.Delete(tempJsFile);
            }
            catch (ExeExecutionException ex)
            {
                throw new CompileException(ex.ExeErrorMessage);
            }

            return(javaScriptText);
        }
Example #2
0
        /// <summary>
        /// The complie.
        /// </summary>
        private void Complie()
        {
            try
            {
                JavaScriptText = ExeRunner.Execute(Helper.GetCoffeePath(), @"--compile --print " + tempFile);

                BeginInvoke((Action)(() => txtJavaScript.Text = JavaScriptText));
                BeginInvoke((Action)(() => txtErrors.Text = string.Empty));
            }
            catch (CompileException ex)
            {
                BeginInvoke((Action)(() => txtErrors.Text = ex.ExeErrorMessage));
            }
        }
Example #3
0
        private void Complie()
        {
            try
            {
                javaScriptText = ExeRunner.Execute(@"C:\Users\Owner\AppData\Roaming\npm\coffee.cmd", @"--compile --print " + _filePath);

                BeginInvoke((Action)(() => txtJavaScript.Text = javaScriptText));
                //  BeginInvoke(new Delegate() => );
                // javaScriptText = ExeRunner.Execute(@"C:\Users\Owner\AppData\Roaming\npm\coffee.cmd", @"--eval --print " + "\"" + txtCoffee.Text + "\"");
            }
            catch (ExeExecutionException ex)
            {
                MessageBox.Show(ex.ToString());
                // Error err = new Error(ex.Message);
                // err.Show();
            }
        }
Example #4
0
        public string Complie(string coffeText)
        {
            string javaScriptText;
            string tempFile = Path.Combine(Directory.GetCurrentDirectory(), Guid.NewGuid() + "temp.coffee");

            try
            {
                File.WriteAllText(tempFile, coffeText);
                javaScriptText = ExeRunner.Execute(Helper.GetCoffeePath(), @"--compile --print " + tempFile);
                File.Delete(tempFile);
            }
            catch (ExeExecutionException ex)
            {
                throw;
            }
            return(javaScriptText);
        }