ServiceStack.BundlerRunOnSave.BundlerRunOnSavePackage.RunBundler C# (CSharp) Method

RunBundler() private method

private RunBundler ( ProjectItem projectItem ) : void
projectItem ProjectItem
return void
        private void RunBundler(ProjectItem projectItem)
        {
            if (projectItem == null) return;

            try
            {
                if (projectItem.ContainingProject == null) return;

                // make sure this is a valid bundle file type
                if (!IsAllowedExtension(projectItem.Name)) return;

                // make sure the bundler exists
                var directory = new FileInfo(projectItem.ContainingProject.FileName).Directory;
                var bunderDirectory = directory.GetDirectories("bundler").FirstOrDefault();
                if (bunderDirectory == null) return;

                var bundleCommand = bunderDirectory.GetFiles("bundler.cmd").FirstOrDefault();
                if (bundleCommand == null) return;

                // make sure the files are in the bundler folder
                var fileNames = new List<string>();
                for (short i = 0; i < projectItem.FileCount; i += 1)
                    fileNames.Add(projectItem.FileNames[i]);

                if (fileNames.Any(m => m.StartsWith(bunderDirectory.FullName))) return;

                RunBundler(bundleCommand.FullName);
            }
            catch (Exception e)
            {
                // project item probably doesn't have a document
                Debug.WriteLine(e.Message);
            }
        }

Same methods

BundlerRunOnSavePackage::RunBundler ( string bundleCommandFullName ) : void