예제 #1
0
        /// <summary>
        /// Creates a new ScriptFile instance by reading file contents from
        /// the given TextReader.
        /// </summary>
        /// <param name="filePath">The path at which the script file resides.</param>
        /// <param name="clientFilePath">The path which the client uses to identify the file.</param>
        /// <param name="textReader">The TextReader to use for reading the file's contents.</param>
        public ScriptFile(string filePath, string clientFilePath, TextReader textReader)
        {
            this.FilePath          = filePath;
            this.ClientFilePath    = clientFilePath;
            this.IsAnalysisEnabled = true;
            this.IsInMemory        = Workspace.IsPathInMemory(filePath);

            this.SetFileContents(textReader.ReadToEnd());
        }
예제 #2
0
        /// <summary>
        /// Creates a new ScriptFile instance by reading file contents from
        /// the given TextReader.
        /// </summary>
        /// <param name="filePath">The path at which the script file resides.</param>
        /// <param name="clientFilePath">The path which the client uses to identify the file.</param>
        /// <param name="textReader">The TextReader to use for reading the file's contents.</param>
        /// <param name="powerShellVersion">The version of PowerShell for which the script is being parsed.</param>
        public ScriptFile(
            string filePath,
            string clientFilePath,
            TextReader textReader,
            Version powerShellVersion)
        {
            this.FilePath          = filePath;
            this.ClientFilePath    = clientFilePath;
            this.IsAnalysisEnabled = true;
            this.IsInMemory        = Workspace.IsPathInMemory(filePath);
            this.powerShellVersion = powerShellVersion;

            // SetFileContents() calls ParseFileContents() which initializes the rest of the properties.
            this.SetFileContents(textReader.ReadToEnd());
        }