Esempio n. 1
0
        public static void SourceFileChanged(string configFile, string sourceFile)
        {
            ThreadPool.QueueUserWorkItem((o) =>
            {
                try
                {
                    WebCompilerInitPackage.StatusText($"Compiling...");

                    var activeProject = ProjectHelpers.GetActiveProject();
                    var projectRoot   = ProjectHelpers.GetRootFolder(activeProject);

                    var result = Processor.SourceFileChanged(configFile, sourceFile, projectRoot);
                    ErrorListService.ProcessCompilerResults(result);
                }
                catch (FileNotFoundException ex)
                {
                    Logger.Log($"{Constants.VSIX_NAME} could not find \"{ex.FileName}\"");
                    WebCompilerInitPackage.StatusText($"{Constants.VSIX_NAME} could not find \"{ex.FileName}\"");
                }
                catch (Exception ex)
                {
                    Logger.Log(ex);
                    ShowError(configFile);
                }
            });
        }
Esempio n. 2
0
        public static void Process(string configFile, IEnumerable <Config> configs = null, bool force = false)
        {
            ThreadPool.QueueUserWorkItem((o) =>
            {
                try
                {
                    var result = Processor.Process(configFile, configs, force);
                    ErrorListService.ProcessCompilerResults(result);

                    if (!result.Any(c => c.HasErrors))
                    {
                        WebCompilerInitPackage.StatusText("Done compiling");
                    }
                }
                catch (Exception ex) when(ex is FileNotFoundException || ex is DirectoryNotFoundException)
                {
                    string message = $"{Constants.VSIX_NAME} found an error in {Constants.CONFIG_FILENAME}";
                    Logger.Log(message);
                    WebCompilerInitPackage.StatusText(message);
                    _dte.StatusBar.Progress(false);
                }
                catch (Exception ex)
                {
                    Logger.Log(ex);
                    ShowError(configFile);
                    _dte.StatusBar.Progress(false);
                    WebCompilerInitPackage.StatusText($"{Constants.VSIX_NAME} couldn't compile successfully");
                }
                finally
                {
                    _dte.StatusBar.Progress(false);
                }
            });
        }
Esempio n. 3
0
        public static void SourceFileChanged(string configFile, string sourceFile)
        {
            ThreadPool.QueueUserWorkItem((o) =>
            {
                try
                {
                    StatusText($"Compiling \"{Path.GetFileName(sourceFile)}\"...");

                    var result = Processor.SourceFileChanged(configFile, sourceFile);
                    ErrorListService.ProcessCompilerResults(result, configFile);
                }
                catch (FileNotFoundException ex)
                {
                    Logger.Log($"{Constants.VSIX_NAME} could not find \"{ex.FileName}\"");
                    StatusText($"Compiling \"{Path.GetFileName(sourceFile)}\"...");
                }
                catch (Exception ex)
                {
                    Logger.Log(ex);
                    ShowError(configFile);
                }
            });
        }