Exemplo n.º 1
0
        private void DocumentSaved(object sender, TextDocumentFileActionEventArgs e)
        {
            if (e.FileActionType == FileActionTypes.ContentSavedToDisk)
            {
                // Check if filename is absolute because when debugging, script files are sometimes dynamically created.
                if (string.IsNullOrEmpty(e.FilePath) || !Path.IsPathRooted(e.FilePath))
                {
                    return;
                }

                var item = WebCompilerPackage._dte.Solution.FindProjectItem(e.FilePath);

                if (item != null && item.ContainingProject != null)
                {
                    string configFile = item.ContainingProject.GetConfigFile();

                    ErrorList.CleanErrors(e.FilePath);

                    if (File.Exists(configFile))
                    {
                        CompilerService.SourceFileChanged(configFile, e.FilePath);
                    }
                }
            }
        }
        private void DocumentSaved(object sender, TextDocumentFileActionEventArgs e)
        {
            if (e.FileActionType == FileActionTypes.ContentSavedToDisk)
            {
                var item = BundlerMinifierPackage._dte.Solution.FindProjectItem(e.FilePath);

                if (item != null && item.ContainingProject != null)
                {
                    string configFile = item.ContainingProject.GetConfigFile();

                    ErrorList.CleanErrors(e.FilePath);

                    if (File.Exists(configFile))
                    {
                        BundleService.SourceFileChanged(configFile, e.FilePath);
                    }

                    string minFile;

                    if (FileHelpers.HasMinFile(e.FilePath, out minFile))
                    {
                        BundleService.MinifyFile(e.FilePath);
                    }
                }
            }
        }
        private void DocumentSaved(object sender, TextDocumentFileActionEventArgs e)
        {
            if (e.FileActionType == FileActionTypes.ContentSavedToDisk)
            {
                var item = WebCompilerPackage._dte.Solution.FindProjectItem(e.FilePath);

                if (item != null && item.ContainingProject != null)
                {
                    string configFile = item.ContainingProject.GetConfigFile();

                    ErrorList.CleanErrors(e.FilePath);

                    if (File.Exists(configFile))
                    {
                        CompilerService.SourceFileChanged(configFile, e.FilePath);
                    }
                }
            }
        }