Example #1
0
        /// <summary>
        /// Orders the given set of source files if necessary
        /// </summary>
        /// <param name="project">Project being processed</param>
        /// <param name="files">Input sequence</param>
        /// <returns>Output sequence</returns>
        protected override IEnumerable<SuiteRelativePath> OrderSourceFiles(Project project, IEnumerable<SuiteRelativePath> files)
        {
            if (project.HasParameters("order"))
            {
                var order = project.GetParameters<FsharpFileOrder>("order");
                var remaining = new HashSet<SuiteRelativePath>(files);

                foreach (string file in order.OrderedFiles)
                {
                    var path = new SuiteRelativePath(
                        Path.Combine(Suite.SuiteRoot.GetRelativePath(project.RootDirectory), "fs", file));

                    if (remaining.Contains(path))
                    {
                        remaining.Remove(path);
                        yield return path;
                    }
                }

                foreach (var path in remaining)
                    yield return path;
            }
            else
            {
                foreach (var file in base.OrderSourceFiles(project, files))
                    yield return file;
            }
        }
Example #2
0
        /// <summary>
        /// Removes a file from the set
        /// </summary>
        /// <param name="path">Path of the file relative to the suite root</param>
        public void Remove(SuiteRelativePath path)
        {
            Contract.Requires(Files.Contains(path));
            Contract.Ensures(!files.Contains(path));

            files.Remove(path);
        }
 /// <summary>
 /// Maps a project file to a project
 /// </summary>
 /// <param name="project">The project model</param>
 /// <param name="path">Suite relative path to the visual studio project file</param>
 public void RegisterProjectFile(Project project, SuiteRelativePath path)
 {
     lock (sync)
     {
         map.Add(project, path);
     }
 }
Example #4
0
        protected override void WriteAdditionalOptions(XmlWriter writer, Project project, SuiteRelativePath suiteRelativePath)
        {            
            base.WriteAdditionalOptions(writer, project, suiteRelativePath);

            var relativePath = ToProjectRelativePath(project, suiteRelativePath, "resources");
            writer.WriteElementString("Link", Path.Combine("_Resources", relativePath));
        }
Example #5
0
        /// <summary>
        /// Removes a file from the set
        /// </summary>
        /// <param name="path">Path of the file relative to the suite root</param>
        public void Remove(SuiteRelativePath path)
        {
            Contract.Requires(Files.Contains(path));
            Contract.Ensures(!files.Contains(path));

            files.Remove(path);
        }
Example #6
0
 /// <summary>
 /// Maps a project file to a project
 /// </summary>
 /// <param name="project">The project model</param>
 /// <param name="path">Suite relative path to the visual studio project file</param>
 public void RegisterProjectFile(Project project, SuiteRelativePath path)
 {
     lock (sync)
     {
         map.Add(project, path);
     }
 }
Example #7
0
        /// <summary>
        /// Orders the given set of source files if necessary
        /// </summary>
        /// <param name="project">Project being processed</param>
        /// <param name="files">Input sequence</param>
        /// <returns>Output sequence</returns>
        protected override IEnumerable <SuiteRelativePath> OrderSourceFiles(Project project, IEnumerable <SuiteRelativePath> files)
        {
            if (project.HasParameters("order"))
            {
                var order     = project.GetParameters <FsharpFileOrder>("order");
                var remaining = new HashSet <SuiteRelativePath>(files);

                foreach (string file in order.OrderedFiles)
                {
                    var path = new SuiteRelativePath(
                        Path.Combine(Suite.SuiteRoot.GetRelativePath(project.RootDirectory), "fs", file));

                    if (remaining.Contains(path))
                    {
                        remaining.Remove(path);
                        yield return(path);
                    }
                }

                foreach (var path in remaining)
                {
                    yield return(path);
                }
            }
            else
            {
                foreach (var file in base.OrderSourceFiles(project, files))
                {
                    yield return(file);
                }
            }
        }
Example #8
0
        /// <summary>
        /// Adds a file to the set
        /// </summary>
        /// <param name="path">Path of the file relative to the suite root</param>
        public void Add(SuiteRelativePath path)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(path));
            Contract.Requires(!Path.IsPathRooted(path));
            Contract.Ensures(files.Contains(path));

            files.Add(path);
        }
Example #9
0
 protected override bool FilterOut(SuiteRelativePath path)
 {
     return(IsTLBorIDL(path) ||
            IsDllDataC(path) ||
            IsIdlHeader(path) ||
            IsGuidDefinition(path) ||
            IsProxyStub(path));
 }
Example #10
0
        /// <summary>
        /// Adds a file to the set
        /// </summary>
        /// <param name="path">Path of the file relative to the suite root</param>
        public void Add(SuiteRelativePath path)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(path));
            Contract.Requires(!Path.IsPathRooted(path));
            Contract.Ensures(files.Contains(path));

            files.Add(path);
        }
Example #11
0
 protected override string GetLogicalPath(Project project, SuiteRelativePath file, string sourceSetType)
 {
     var path = base.GetLogicalPath(project, file, sourceSetType);
     if (path.StartsWith("wpf\\"))
         return path.Substring(4).Replace('\\', '/');
     else
         return PrefixWithRootNamespace(project, PrefixNumericComponents(path)).Replace('\\', '.');
 }
Example #12
0
 public SimplePythonBuildScript(SuiteRelativePath scriptPath, [SuiteRoot] IFileSystemDirectory suiteRoot)
 {
     name = Path.GetFileNameWithoutExtension(scriptPath);
     using (var reader = suiteRoot.ReadTextFile(scriptPath))
     {
         script = reader.ReadToEnd();
     }
 }
Example #13
0
 public SimplePythonPostProcessorScript(SuiteRelativePath scriptPath, [SuiteRoot] IFileSystemDirectory suiteRoot)
 {
     name = Path.GetFileNameWithoutExtension(scriptPath);
     using (var reader = suiteRoot.ReadTextFile(scriptPath))
     {
         script = reader.ReadToEnd();
     }
 }
Example #14
0
 protected override bool FilterOut(SuiteRelativePath path)
 {
     return IsTLBorIDL(path) || 
         IsDllDataC(path) ||
         IsIdlHeader(path) ||
         IsGuidDefinition(path) ||
         IsProxyStub(path);
 }
Example #15
0
 /// <summary>
 /// Gets the visual studio project file for a given project
 /// </summary>
 /// <param name="project">The project model</param>
 /// <returns>Returns the suite relative path to the project file, or <c>null</c> if this is not a visual studio project</returns>
 public SuiteRelativePath GetProjectFile(Project project)
 {
     lock (sync)
     {
         SuiteRelativePath result = null;
         map.TryGetValue(project, out result);
         return(result);
     }
 }
Example #16
0
        protected override void WriteItem(XmlWriter writer, Project project, SuiteRelativePath file, string relativePath, SourceSetType sourceSetType, string logicalPath)
        {
            var resrelativePath = ToProjectRelativePath(project, file, "resources");

            if (!resrelativePath.StartsWith("win32" + Path.DirectorySeparatorChar))
            {
                base.WriteItem(writer, project, file, relativePath, sourceSetType, logicalPath);
            }
        }
Example #17
0
 private static bool IsTLBorIDL(SuiteRelativePath path)
 {
     string ext = Path.GetExtension(path.ToString());
     if (ext != null)
     {
         var extl = ext.ToLowerInvariant();
         return extl == ".tlb" ||
                extl == ".idl";
     }
     return false;
 }
Example #18
0
        public void Compile(SuiteRelativePath scriptPath, TargetRelativePath targetPath, string version, Goal targetGoal)
        {
            var platform = targetGoal.Has("x64") ? "x64" : "x86";

            Run(suiteRoot,
                "/dVERSION=" + version,
                "/dPLATFORM=" + platform,
                "/dGOAL=" + targetGoal.Name,
                "/o" + Path.GetDirectoryName(Path.Combine(suiteRoot.GetRelativePath(targetRoot), targetPath)),
                scriptPath);
        }
Example #19
0
        public void Compile(SuiteRelativePath scriptPath, TargetRelativePath targetPath, string version, Goal targetGoal)
        {
            var platform = targetGoal.Has("x64") ? "x64" : "x86";

            Run(suiteRoot,
                "/dVERSION="+version,
                "/dPLATFORM="+platform,
                "/dGOAL="+targetGoal.Name,
                "/o"+Path.GetDirectoryName(Path.Combine(suiteRoot.GetRelativePath(targetRoot), targetPath)),
                scriptPath);
        }
Example #20
0
            private static bool IsTLBorIDL(SuiteRelativePath path)
            {
                string ext = Path.GetExtension(path.ToString());

                if (ext != null)
                {
                    var extl = ext.ToLowerInvariant();
                    return(extl == ".tlb" ||
                           extl == ".idl");
                }
                return(false);
            }
Example #21
0
        protected override string GetLogicalPath(Project project, SuiteRelativePath file, string sourceSetType)
        {
            var path = base.GetLogicalPath(project, file, sourceSetType);

            if (path.StartsWith("wpf\\"))
            {
                return(path.Substring(4).Replace('\\', '/'));
            }
            else
            {
                return(PrefixWithRootNamespace(project, PrefixNumericComponents(path)).Replace('\\', '.'));
            }
        }
Example #22
0
        protected virtual void WriteItem(XmlWriter writer, Project project, SuiteRelativePath file, string relativePath, SourceSetType sourceSetType, string logicalPath)
        {
            writer.WriteStartElement(GetElementNameFor(project, file));
            writer.WriteAttributeString("Include", relativePath);

            if (ProjectSourceSetName != sourceSetType)
            {
                writer.WriteElementString("LogicalName", logicalPath);
            }

            WriteAdditionalOptions(writer, project, file);

            writer.WriteEndElement();
        }
Example #23
0
        private void Copy(SuiteRelativePath sourcePath, string relativePath)
        {
            var relativeDir = Path.GetDirectoryName(relativePath);
            var fileName    = Path.GetFileName(relativePath);
            var targetDir   = targetRoot.GetChildDirectory(project.Module.Name, createIfMissing: true);

            IFileSystemDirectory realTargetDir = String.IsNullOrWhiteSpace(relativeDir)
                ? targetDir
                : targetDir.GetChildDirectory(relativeDir, createIfMissing: true);

            using (var source = suiteRoot.ReadBinaryFile(sourcePath))
                using (var target = realTargetDir.CreateBinaryFile(fileName))
                    StreamOperations.Copy(source, target);
        }
Example #24
0
        /// <summary>
        /// Provides the ability to add extra content to a given project source file
        /// </summary>
        /// <param name="writer">The project file writer</param>
        /// <param name="project">Project model</param>
        /// <param name="suiteRelativePath">Suite relative path of the source item</param>
        protected override void WriteAdditionalOptions(XmlWriter writer, Project project, SuiteRelativePath suiteRelativePath)
        {
            base.WriteAdditionalOptions(writer, project, suiteRelativePath);

            var projectRelativePath = ToProjectRelativePath(project, suiteRelativePath, ProjectSourceSetName);

            if (projectRelativePath == "stdafx.cpp")
            {
                var platform = platformManagement.GetDefaultPlatform(project);

                writer.WriteStartElement("PrecompiledHeader");
                writer.WriteAttributeString("Condition", string.Format("'$(Configuration)|$(Platform)' == 'Bari|{0}' ", platform));
                writer.WriteString("Create");
                writer.WriteEndElement();
            }
        }
Example #25
0
        /// <summary>
        /// Recursively adds every file in a given directory to a source set (<see cref="SourceSet"/>)
        /// </summary>
        /// <param name="target">The target source set to be extended</param>
        /// <param name="dir">The root directory for the operation</param>
        /// <param name="ignoreList">Ignore list for the target source set</param>
        private void AddAllFiles(SourceSet target, IFileSystemDirectory dir, SourceSetIgnoreList ignoreList)
        {
            foreach (var fileName in dir.Files)
            {
                var suiteRelativePath = new SuiteRelativePath(Path.Combine(suiteRoot.GetRelativePath(dir), fileName));
                if (!ignoreList.IsIgnored(suiteRelativePath))
                {
                    target.Add(suiteRelativePath);
                }
            }

            foreach (var childDirectory in dir.ChildDirectories)
            {
                AddAllFiles(target, dir.GetChildDirectory(childDirectory), ignoreList);
            }
        }
Example #26
0
        /// <summary>
        /// Recursively adds every file in a given directory to a source set (<see cref="SourceSet"/>)
        /// </summary>
        /// <param name="target">The target source set to be extended</param>
        /// <param name="dir">The root directory for the operation</param>
        /// <param name="ignoreList">Ignore list for the target source set</param>
        private void AddAllFiles(SourceSet target, IFileSystemDirectory dir, SourceSetIgnoreList ignoreList)
        {
            foreach (var fileName in dir.Files)
            {
                var suiteRelativePath = new SuiteRelativePath(Path.Combine(suiteRoot.GetRelativePath(dir), fileName));
                if (!ignoreList.IsIgnored(suiteRelativePath))
                {
                    target.Add(suiteRelativePath);
                }
            }

            foreach (var childDirectory in dir.ChildDirectories)
            {
                AddAllFiles(target, dir.GetChildDirectory(childDirectory), ignoreList);
            }
        }
Example #27
0
            private bool IsDllDataC(SuiteRelativePath path)
            {
                // DllData.c is a special file generated by MIDL

                var fileName = Path.GetFileName(path);
                if (fileName != null && fileName.ToLowerInvariant() == "dlldata.c")
                {
                    using (var reader = sourceSetRoot.ReadTextFile(GetSourceSetRelativePath(path)))
                    {
                        var contents = reader.ReadToEnd();
                        if (contents.StartsWith(dllDataCHeader))
                            return true;
                    }
                }

                return false;
            }
Example #28
0
        private void SetupInnoSetupPackagerFor(Product product, SuiteRelativePath scriptPath)
        {
            log.InfoFormat("Found InnoSetup script for product {0} at {1}", product.Name, scriptPath);

            if (product.Packager == null)
            {
                product.Packager = new PackagerDefinition(new PackagerId("innosetup"),
                    new InnoSetupPackagerParameters {ScriptPath = scriptPath});
            }
            else
            {
                if (product.Packager.PackagerType == new PackagerId("innosetup"))
                {
                    var parameters = product.Packager.Parameters as InnoSetupPackagerParameters;
                    if (parameters != null)
                        parameters.ScriptPath = scriptPath;
                }
            }
        }
Example #29
0
        /// <summary>
        /// Constructs the fingerprint based on the deserialized protocol data
        /// </summary>
        /// <param name="proto">The protocol data which was deserialized from a stream</param>
        public SourceSetFingerprint(SourceSetFingerprintProtocol proto)
        {
            fullDependency    = proto.FullDependency;
            fileNames         = new SortedSet <SuiteRelativePath>();
            lastModifiedDates = new Dictionary <SuiteRelativePath, DateTime>();
            lastSizes         = new Dictionary <SuiteRelativePath, long>();

            proto.Files.Do(pair =>
            {
                var path = new SuiteRelativePath(pair.Key);
                fileNames.Add(path);

                if (fullDependency)
                {
                    lastModifiedDates.Add(path, pair.Value.LastModifiedDate);
                    lastSizes.Add(path, pair.Value.LastSize);
                }
            });
        }
Example #30
0
            private bool IsDllDataC(SuiteRelativePath path)
            {
                // DllData.c is a special file generated by MIDL

                var fileName = Path.GetFileName(path);

                if (fileName != null && fileName.ToLowerInvariant() == "dlldata.c")
                {
                    using (var reader = sourceSetRoot.ReadTextFile(GetSourceSetRelativePath(path)))
                    {
                        var contents = reader.ReadToEnd();
                        if (contents.StartsWith(dllDataCHeader))
                        {
                            return(true);
                        }
                    }
                }

                return(false);
            }
Example #31
0
            private bool HasExtensionAndContainsLine(SuiteRelativePath path, string extension, string expectedLine)
            {
                var ext = Path.GetExtension(path);

                if (ext != null && ext.ToLowerInvariant() == extension)
                {
                    using (var reader = sourceSetRoot.ReadTextFile(GetSourceSetRelativePath(path)))
                    {
                        string line;
                        while ((line = reader.ReadLine()) != null)
                        {
                            if (line == expectedLine)
                            {
                                return(true);
                            }
                        }
                    }
                }

                return(false);
            }
Example #32
0
        private void SetupInnoSetupPackagerFor(Product product, SuiteRelativePath scriptPath)
        {
            log.InfoFormat("Found InnoSetup script for product {0} at {1}", product.Name, scriptPath);

            if (product.Packager == null)
            {
                product.Packager = new PackagerDefinition(new PackagerId("innosetup"),
                                                          new InnoSetupPackagerParameters {
                    ScriptPath = scriptPath
                });
            }
            else
            {
                if (product.Packager.PackagerType == new PackagerId("innosetup"))
                {
                    var parameters = product.Packager.Parameters as InnoSetupPackagerParameters;
                    if (parameters != null)
                    {
                        parameters.ScriptPath = scriptPath;
                    }
                }
            }
        }
Example #33
0
 /// <summary>
 /// Provides the ability to add extra content to a given project source file
 /// </summary>
 /// <param name="writer">The project file writer</param>
 /// <param name="project">Project model</param>
 /// <param name="suiteRelativePath">Suite relative path of the source item</param>
 protected virtual void WriteAdditionalOptions(XmlWriter writer, Project project, SuiteRelativePath suiteRelativePath)
 {
 }
Example #34
0
 /// <summary>
 /// The filter function
 /// </summary>
 /// <param name="path">Path to the file in the source set</param>
 /// <returns>Returns <c>true</c> if the file should be filtered out</returns>
 protected abstract bool FilterOut(SuiteRelativePath path);
Example #35
0
        protected override void WriteAdditionalOptions(XmlWriter writer, Project project, SuiteRelativePath suiteRelativePath)
        {
            base.WriteAdditionalOptions(writer, project, suiteRelativePath);

            var relativePath = ToProjectRelativePath(project, suiteRelativePath, "resources");

            writer.WriteElementString("Link", Path.Combine("_Resources", relativePath));
        }
Example #36
0
        private void Copy(SuiteRelativePath sourcePath, string relativePath)
        {
            var relativeDir = Path.GetDirectoryName(relativePath);
            var fileName = Path.GetFileName(relativePath);
            var targetDir = targetRoot.GetChildDirectory(project.Module.Name, createIfMissing: true); 

            IFileSystemDirectory realTargetDir = String.IsNullOrWhiteSpace(relativeDir)
                ? targetDir
                : targetDir.GetChildDirectory(relativeDir, createIfMissing: true);

            using (var source = suiteRoot.ReadBinaryFile(sourcePath))
            using (var target = realTargetDir.CreateBinaryFile(fileName))
                StreamOperations.Copy(source, target);
        }
Example #37
0
 public bool IsIgnored(SuiteRelativePath path)
 {
     return(ignoreExpressions.Any(expression => expression.IsMatch(path)));
 }
Example #38
0
        protected override void WriteAdditionalOptions(XmlWriter writer, Project project, SuiteRelativePath suiteRelativePath)
        {
            var projectRelativePath = ToProjectRelativePath(project, suiteRelativePath, ProjectSourceSetName);

            // Extra options for XAML pages
            var ext = Path.GetExtension(projectRelativePath).ToLowerInvariant();
            if (ext == ".xaml")
            {
                writer.WriteElementString("SubType", "Designer");
                writer.WriteElementString("Generator", "MSBuild:Compile");
            }

            // Extra options for XAML page code-behind files
            if (projectRelativePath.ToLowerInvariant().EndsWith(".xaml.cs"))
            {
                var fileName = Path.GetFileName(projectRelativePath);
                writer.WriteElementString("DependentUpon",
                    fileName.Substring(0, fileName.Length - 3));
            }

            // Settings file
            if (projectRelativePath.Equals("Properties" + Path.DirectorySeparatorChar + "Settings.Designer.cs",
                StringComparison.InvariantCultureIgnoreCase))
            {
                writer.WriteElementString("AutoGen", "True");
                writer.WriteElementString("DesignTimeSharedInput", "True");
                writer.WriteElementString("DependentUpon", "Settings.settings");
            }
            else if (projectRelativePath.Equals("Properties" + Path.DirectorySeparatorChar + "Settings.settings",
                StringComparison.InvariantCultureIgnoreCase))
            {
                writer.WriteElementString("Generator", "PublicSettingsSingleFileGenerator");
                writer.WriteElementString("LastGenOutput", "Settings.Designer.cs");
            }

            // WCF service references
            if (projectRelativePath.StartsWith("Service References" + Path.DirectorySeparatorChar, StringComparison.InvariantCultureIgnoreCase))
            {
                if (ext == ".cs")
                {
                    writer.WriteElementString("AutoGen", "True");
                    writer.WriteElementString("DesignTime", "True");
                    writer.WriteElementString("DependentUpon", Path.GetFileNameWithoutExtension(projectRelativePath) + ".svcmap");
                }
                else if (ext == ".xsd")
                {
                    writer.WriteElementString("SubType", "Designer");
                }
                else if (ext == ".svcmap")
                {
                    writer.WriteElementString("Generator", "WCF Proxy Generator");
                    writer.WriteElementString("LastGenOutput", Path.GetFileNameWithoutExtension(projectRelativePath) + ".cs");
                }
            }

            base.WriteAdditionalOptions(writer, project, suiteRelativePath);
        }
Example #39
0
 private string GetSourceSetRelativePath(SuiteRelativePath path)
 {
     return(suiteRoot.GetRelativePathFrom(sourceSetRoot, path));
 }
Example #40
0
 private bool IsIdlHeader(SuiteRelativePath path)
 {
     return(HasExtensionAndContainsLine(path, ".h", idlInterfaceHeader));
 }
Example #41
0
        /// <summary>
        /// Provides the ability to add extra content to a given project source file
        /// </summary>
        /// <param name="writer">The project file writer</param>
        /// <param name="project">Project model</param>
        /// <param name="suiteRelativePath">Suite relative path of the source item</param>
        protected override void WriteAdditionalOptions(XmlWriter writer, Project project, SuiteRelativePath suiteRelativePath)
        {
            base.WriteAdditionalOptions(writer, project, suiteRelativePath);

            var projectRelativePath = ToProjectRelativePath(project, suiteRelativePath, ProjectSourceSetName);

            if (projectRelativePath == "stdafx.cpp")
            {
                var platform = platformManagement.GetDefaultPlatform(project);

                writer.WriteStartElement("PrecompiledHeader");
                writer.WriteAttributeString("Condition", string.Format("'$(Configuration)|$(Platform)' == 'Bari|{0}' ", platform));
                writer.WriteString("Create");
                writer.WriteEndElement();
            }
        }
Example #42
0
 protected virtual string GetLogicalPath(Project project, SuiteRelativePath file, SourceSetType sourceSetType)
 {
     return ToProjectRelativePath(project, file, sourceSetType);
 }
Example #43
0
        protected override void WriteAdditionalOptions(XmlWriter writer, Project project, SuiteRelativePath suiteRelativePath)
        {
            base.WriteAdditionalOptions(writer, project, suiteRelativePath);

            var relativePath = ToProjectRelativePath(project, suiteRelativePath, "resources");

            if (relativePath.StartsWith("wpf" + Path.DirectorySeparatorChar))
            {
                relativePath = GetLogicalPath(project, suiteRelativePath, "resources");
            }
            else
            {
                relativePath = Path.Combine("_Resources", relativePath);
            }

            writer.WriteElementString("Link", relativePath);
        }
Example #44
0
 private string GetSourceSetRelativePath(SuiteRelativePath path)
 {
     return suiteRoot.GetRelativePathFrom(sourceSetRoot, path);
 }
Example #45
0
 /// <summary>
 /// Provides the ability to add extra content to a given project source file
 /// </summary>
 /// <param name="writer">The project file writer</param>
 /// <param name="project">Project model</param>
 /// <param name="suiteRelativePath">Suite relative path of the source item</param>
 protected virtual void WriteAdditionalOptions(XmlWriter writer, Project project, SuiteRelativePath suiteRelativePath)
 {
 }
Example #46
0
 protected virtual string GetLogicalPath(Project project, SuiteRelativePath file, SourceSetType sourceSetType)
 {
     return(ToProjectRelativePath(project, file, sourceSetType));
 }
Example #47
0
 public bool IsIgnored(SuiteRelativePath path)
 {
     return ignoreExpressions.Any(expression => expression.IsMatch(path));
 }
Example #48
0
 private bool IsIdlHeader(SuiteRelativePath path)
 {
     return HasExtensionAndContainsLine(path, ".h", idlInterfaceHeader);
 }
Example #49
0
 private bool IsProxyStub(SuiteRelativePath path)
 {
     return(HasExtensionAndContainsLine(path, ".c", proxyStubHeader));
 }
Example #50
0
 private bool IsGuidDefinition(SuiteRelativePath path)
 {
     return HasExtensionAndContainsLine(path, ".c", guidHeader);
 }
Example #51
0
 private bool IsGuidDefinition(SuiteRelativePath path)
 {
     return(HasExtensionAndContainsLine(path, ".c", guidHeader));
 }
Example #52
0
 private bool IsProxyStub(SuiteRelativePath path)
 {
     return HasExtensionAndContainsLine(path, ".c", proxyStubHeader);
 }
Example #53
0
            private bool HasExtensionAndContainsLine(SuiteRelativePath path, string extension, string expectedLine)
            {
                var ext = Path.GetExtension(path);
                if (ext != null && ext.ToLowerInvariant() == extension)
                {
                    using (var reader = sourceSetRoot.ReadTextFile(GetSourceSetRelativePath(path)))
                    {
                        string line;
                        while ((line = reader.ReadLine()) != null)
                        {
                            if (line == expectedLine)
                                return true;
                        }
                    }
                }

                return false;
            }
Example #54
0
 /// <summary>
 /// The filter function
 /// </summary>
 /// <param name="path">Path to the file in the source set</param>
 /// <returns>Returns <c>true</c> if the file should be filtered out</returns>
 protected abstract bool FilterOut(SuiteRelativePath path);
Example #55
0
        protected override void WriteAdditionalOptions(XmlWriter writer, Project project, SuiteRelativePath suiteRelativePath)
        {
            var projectRelativePath = ToProjectRelativePath(project, suiteRelativePath, ProjectSourceSetName);

            // Extra options for XAML pages
            var ext = Path.GetExtension(projectRelativePath).ToLowerInvariant();

            if (ext == ".xaml")
            {
                writer.WriteElementString("SubType", "Designer");
                writer.WriteElementString("Generator", "MSBuild:Compile");
            }

            // Extra options for XAML page code-behind files
            if (projectRelativePath.ToLowerInvariant().EndsWith(".xaml.cs"))
            {
                writer.WriteElementString("DependentUpon",
                                          projectRelativePath.Substring(0, projectRelativePath.Length - 3));
            }

            // Settings file
            if (projectRelativePath.Equals("Properties\\Settings.Designer.cs",
                                           StringComparison.InvariantCultureIgnoreCase))
            {
                writer.WriteElementString("AutoGen", "True");
                writer.WriteElementString("DesignTimeSharedInput", "True");
                writer.WriteElementString("DependentUpon", "Settings.settings");
            }
            else if (projectRelativePath.Equals("Properties\\Settings.settings",
                                                StringComparison.InvariantCultureIgnoreCase))
            {
                writer.WriteElementString("Generator", "PublicSettingsSingleFileGenerator");
                writer.WriteElementString("LastGenOutput", "Settings.Designer.cs");
            }

            // WCF service references
            if (projectRelativePath.StartsWith("Service References\\", StringComparison.InvariantCultureIgnoreCase))
            {
                if (ext == ".cs")
                {
                    writer.WriteElementString("AutoGen", "True");
                    writer.WriteElementString("DesignTime", "True");
                    writer.WriteElementString("DependentUpon", Path.GetFileNameWithoutExtension(projectRelativePath) + ".svcmap");
                }
                else if (ext == ".xsd")
                {
                    writer.WriteElementString("SubType", "Designer");
                }
                else if (ext == ".svcmap")
                {
                    writer.WriteElementString("Generator", "WCF Proxy Generator");
                    writer.WriteElementString("LastGenOutput", Path.GetFileNameWithoutExtension(projectRelativePath) + ".cs");
                }
            }

            base.WriteAdditionalOptions(writer, project, suiteRelativePath);
        }
Example #56
0
        protected override void WriteAdditionalOptions(XmlWriter writer, Project project, SuiteRelativePath suiteRelativePath)
        {
            base.WriteAdditionalOptions(writer, project, suiteRelativePath);

            var relativePath = ToProjectRelativePath(project, suiteRelativePath, "resources");

            if (relativePath.StartsWith("wpf" + Path.DirectorySeparatorChar))
                relativePath = GetLogicalPath(project, suiteRelativePath, "resources");
            else
                relativePath = Path.Combine("_Resources", relativePath);

            writer.WriteElementString("Link", relativePath);
        }