예제 #1
0
        private void FileSaved(string path)
        {
            if (!FileChanged(path)) return;

            try
            {
                var stopwatch = Stopwatch.StartNew();

                Log.Debug("FileSaved {0}", path);

                var projectItem = dte.Solution.FindProjectItem(path);
                var template = new Template(projectItem);

                foreach (var item in GetReferencedProjectItems(projectItem, ".cs"))
                {
                    eventQueue.Enqueue(generationEvent => Render(template, generationEvent), GenerationType.Render, item.Path());
                }

                template.SaveProjectFile();

                stopwatch.Stop();
                Log.Debug("FileSaved completed in {0} ms", stopwatch.ElapsedMilliseconds);

            }
            catch (Exception e)
            {
                Log.Debug(e.Message);
            }
        }