예제 #1
0
            /// <summary>
            /// FileResolutionHandler callback that looks for a valid path based on where
            /// the sources were located.
            /// </summary>
            /// <param name="source">Original source path.</param>
            /// <param name="fileType">Type of file to look for.</param>
            /// <returns>Source path to be used when importing the file.</returns>
            public override string FileResolutionHandler(string source, FileResolutionType fileType)
            {
                string filePath = null;

                if (source.StartsWith("SourceDir\\") || source.StartsWith("SourceDir/"))
                {
                    foreach (string basePath in this.basePaths)
                    {
                        filePath = Path.Combine(basePath, source.Substring(10));
                        if (File.Exists(filePath))
                        {
                            return(filePath);
                        }
                    }
                }

                if (Path.IsPathRooted(source) || File.Exists(source))
                {
                    return(source);
                }

                foreach (string path in this.sourcePaths)
                {
                    filePath = Path.Combine(path, source);
                    if (File.Exists(filePath))
                    {
                        return(filePath);
                    }

                    if (source.StartsWith("SourceDir\\") || source.StartsWith("SourceDir/"))
                    {
                        filePath = Path.Combine(path, source.Substring(10));
                        if (File.Exists(filePath))
                        {
                            return(filePath);
                        }
                    }
                }

                throw new WixFileNotFoundException(source, fileType.ToString());
            }
예제 #2
0
 /// <summary>
 /// Callback which allows host to adjust file source paths.
 /// </summary>
 /// <param name="source">Original source value.</param>
 /// <param name="fileType">Import file type.</param>
 /// <returns>Should return a valid path for the stream to be imported.</returns>
 public virtual string FileResolutionHandler(string source, FileResolutionType fileType)
 {
     return source;
 }
예제 #3
0
            /// <summary>
            /// FileResolutionHandler callback that looks for a valid path based on where
            /// the sources were located.
            /// </summary>
            /// <param name="source">Original source path.</param>
            /// <param name="fileType">Type of file to look for.</param>
            /// <returns>Source path to be used when importing the file.</returns>
            public override string FileResolutionHandler(string source, FileResolutionType fileType)
            {
                string filePath = null;

                if (source.StartsWith("SourceDir\\") || source.StartsWith("SourceDir/"))
                {
                    foreach (string basePath in this.basePaths)
                    {
                        filePath = Path.Combine(basePath, source.Substring(10));
                        if (File.Exists(filePath))
                        {
                            return filePath;
                        }
                    }
                }

                if (Path.IsPathRooted(source) || File.Exists(source))
                {
                    return source;
                }

                foreach (string path in this.sourcePaths)
                {
                    filePath = Path.Combine(path, source);
                    if (File.Exists(filePath))
                    {
                        return filePath;
                    }

                    if (source.StartsWith("SourceDir\\") || source.StartsWith("SourceDir/"))
                    {
                        filePath = Path.Combine(path, source.Substring(10));
                        if (File.Exists(filePath))
                        {
                            return filePath;
                        }
                    }
                }

                throw new WixFileNotFoundException(source, fileType.ToString());
            }
예제 #4
0
 /// <summary>
 /// Callback which allows host to adjust file source paths.
 /// </summary>
 /// <param name="source">Original source value.</param>
 /// <param name="fileType">Import file type.</param>
 /// <returns>Should return a valid path for the stream to be imported.</returns>
 public virtual string FileResolutionHandler(string source, FileResolutionType fileType)
 {
     return(source);
 }