예제 #1
0
        public void CompileProject(EnvDTE.Project project)
        {
            if (project == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(project.FullName))
            {
                return;
            }

            Logger.Log("Compiling CoffeeScript...");
            _projectFileCount = 0;

            try
            {
                string fullPath = project.Properties.Item("FullPath").Value.ToString();

                if (!string.IsNullOrEmpty(fullPath))
                {
                    if (MadsKristensen.EditorExtensions.WEIgnore.TestWEIgnore(fullPath, "compiler", "coffeescript"))
                    {
                        Logger.Log(String.Format(CultureInfo.CurrentCulture, "CoffeeScript: The file {0} is ignored by .weignore. Skipping..", Path.GetFileName(fullPath)));
                        return;
                    }

                    string dir   = Path.GetDirectoryName(fullPath);
                    var    files = Directory.GetFiles(dir, "*.coffee", SearchOption.AllDirectories);

                    foreach (string file in files)
                    {
                        string jsFile = GetCompiledFileName(file, ".js", UseCompiledFolder);

                        if (EditorExtensionsPackage.DTE.Solution.FindProjectItem(file) != null &&
                            File.Exists(jsFile))
                        {
                            _projectFileCount++;

                            CoffeeScriptCompiler compiler = new CoffeeScriptCompiler(Dispatcher.CurrentDispatcher);
                            compiler.Completed += compiler_Completed;
                            compiler.Compile(File.ReadAllText(file), file);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }
        }
        public void CompileProject(EnvDTE.Project project)
        {
            if(project == null)
                return;

            if (string.IsNullOrEmpty(project.FullName))
                return;

            Logger.Log("Compiling CoffeeScript...");
            _projectFileCount = 0;

            try
            {
                string fullPath = project.Properties.Item("FullPath").Value.ToString();

                if (!string.IsNullOrEmpty(fullPath))
                {
                    if (MadsKristensen.EditorExtensions.WEIgnore.TestWEIgnore(fullPath, "compiler", "coffeescript"))
                    {
                        Logger.Log(String.Format(CultureInfo.CurrentCulture, "CoffeeScript: The file {0} is ignored by .weignore. Skipping..", Path.GetFileName(fullPath)));
                        return;
                    }
                    
                    string dir = Path.GetDirectoryName(fullPath);
                    var files = Directory.GetFiles(dir, "*.coffee", SearchOption.AllDirectories);

                    foreach (string file in files)
                    {
                        string jsFile = GetCompiledFileName(file, ".js", UseCompiledFolder);

                        if (EditorExtensionsPackage.DTE.Solution.FindProjectItem(file) != null &&
                            File.Exists(jsFile))
                        {
                            _projectFileCount++;

                            CoffeeScriptCompiler compiler = new CoffeeScriptCompiler(Dispatcher.CurrentDispatcher);
                            compiler.Completed += compiler_Completed;
                            compiler.Compile(File.ReadAllText(file), file);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }
        }
예제 #3
0
        public void CompileProject(EnvDTE.Project project)
        {
            if (string.IsNullOrEmpty(project.FullName))
            {
                return;
            }

            Logger.Log("Compiling CoffeeScript...");
            _projectFileCount = 0;

            try
            {
                string fullPath = project.Properties.Item("FullPath").Value.ToString();

                if (project != null && !string.IsNullOrEmpty(fullPath))
                {
                    string dir   = Path.GetDirectoryName(fullPath);
                    var    files = Directory.GetFiles(dir, "*.coffee", SearchOption.AllDirectories);

                    foreach (string file in files)
                    {
                        string jsFile = GetCompiledFileName(file, ".js", UseCompiledFolder);

                        if (EditorExtensionsPackage.DTE.Solution.FindProjectItem(file) != null &&
                            File.Exists(jsFile))
                        {
                            _projectFileCount++;

                            CoffeeScriptCompiler compiler = new CoffeeScriptCompiler(Dispatcher.CurrentDispatcher);
                            compiler.Completed += compiler_Completed;
                            compiler.Compile(File.ReadAllText(file), file);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }
        }
        public void CompileProject(EnvDTE.Project project)
        {
            if(project == null)
                return;

            if (string.IsNullOrEmpty(project.FullName))
                return;

            Logger.Log("Compiling CoffeeScript...");
            _projectFileCount = 0;

            try
            {
                string fullPath = project.Properties.Item("FullPath").Value.ToString();

                if (!string.IsNullOrEmpty(fullPath))
                {
                    string dir = Path.GetDirectoryName(fullPath);
                    var files = Directory.GetFiles(dir, "*.coffee", SearchOption.AllDirectories);

                    foreach (string file in files)
                    {
                        if (EditorExtensionsPackage.DTE.Solution.FindProjectItem(file) != null)
                        {
                            _projectFileCount++;

                            CoffeeScriptCompiler compiler = new CoffeeScriptCompiler(Dispatcher.CurrentDispatcher);
                            compiler.Completed += compiler_Completed;
                            compiler.Compile(File.ReadAllText(file), file);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }
        }
        public void CompileProject(EnvDTE.Project project)
        {
            if (string.IsNullOrEmpty(project.FullName))
                return;

            if (!CompileEnabled)
                return;

            Logger.Log("Compiling CoffeeScript...");
            _projectFileCount = 0;

            try
            {
                string dir = ProjectHelpers.GetRootFolder(project);
                if (string.IsNullOrEmpty(dir))
                    return;

                var files = Directory.GetFiles(dir, "*.coffee", SearchOption.AllDirectories);

                foreach (string file in files)
                {
                    string jsFile = GetCompiledFileName(file, ".js", CompileToLocation);

                    if (EditorExtensionsPackage.DTE.Solution.FindProjectItem(file) != null &&
                        File.Exists(jsFile))
                    {
                        _projectFileCount++;

                        CoffeeScriptCompiler compiler = new CoffeeScriptCompiler(Dispatcher.CurrentDispatcher);
                        compiler.Completed += compiler_Completed;
                        compiler.Compile(File.ReadAllText(file), file);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }
        }
 public CoffeeScriptMargin(string contentType, string source, bool showMargin, ITextDocument document)
     : base(source, MarginName, contentType, showMargin, document)
 {
     _compiler = new CoffeeScriptCompiler(Dispatcher);
     _compiler.Completed += _compiler_Completed; //+= (s, e) => { OnCompilationDone(e.Result, e.State); };
 }
 public CoffeeScriptMargin(string contentType, string source, bool showMargin, ITextDocument document)
     : base(source, MarginName, contentType, showMargin, document)
 {
     _compiler            = new CoffeeScriptCompiler(Dispatcher);
     _compiler.Completed += _compiler_Completed; //+= (s, e) => { OnCompilationDone(e.Result, e.State); };
 }