Пример #1
0
        protected override void BeginProcessing()
        {
            base.BeginProcessing();

            ProviderInfo        pInfo;
            Collection <string> resolvedPaths = SessionState.Path.GetResolvedProviderPathFromPSPath(path, out pInfo);
            string pathName = resolvedPaths[0];

            if (!Directory.Exists(pathName))
            {
                ThrowTerminatingError(new ErrorRecord(new DirectoryNotFoundException(string.Format("Directory '{0}' not found", pathName)), "100", ErrorCategory.OpenError, path));
            }
            else
            {
                foreach (string fileName in Directory.GetFiles(path, "Sorlov.PowerShell.*.dll", SearchOption.TopDirectoryOnly))
                {
                    XMLHelpGenerator.GenerateHelp(fileName, pathName, true);
                }
            }
        }
Пример #2
0
        private void Init_SupportFiles(string localDir)
        {
            WriteProgress("Extracting help content..", 10);
            if (!File.Exists(Path.Combine(localDir, "Sorlov.PowerShell-help.xml")))
            {
                XMLHelpGenerator.GenerateHelp(Path.Combine(localDir, "Sorlov.PowerShell.dll"), localDir, true);
            }

            WriteProgress("Extracting type and format data..", 15);
            if (!File.Exists(Path.Combine(localDir, "Sorlov.PowerShell.Format.ps1xml")) || !File.Exists(Path.Combine(localDir, "Sorlov.PowerShell.Types.ps1xml")))
            {
                PS1XMLGenerator.GeneratePS1XML(localDir, localDir, "Sorlov.PowerShell");
            }
            InvokeCommand("Update-TypeData", new Dictionary <string, object>()
            {
                { "AppendPath", System.IO.Path.Combine(localDir, "Sorlov.PowerShell.Types.ps1xml") }
            });
            InvokeCommand("Update-FormatData", new Dictionary <string, object>()
            {
                { "AppendPath", System.IO.Path.Combine(localDir, "Sorlov.PowerShell.Format.ps1xml") }
            });
        }