当前位置: 首页>>代码示例>>C#>>正文


C# ProjectItem.GetFullPath方法代码示例

本文整理汇总了C#中ProjectItem.GetFullPath方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectItem.GetFullPath方法的具体用法?C# ProjectItem.GetFullPath怎么用?C# ProjectItem.GetFullPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProjectItem的用法示例。


在下文中一共展示了ProjectItem.GetFullPath方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetProjectRelativePath

        public static string GetProjectRelativePath(ProjectItem projectItem)
        {
            Project project = projectItem.ContainingProject;
            string projRelativePath = null;

            string rootProjectDir = project.GetFullPath();
            rootProjectDir = EnsureTrailingBackSlash(rootProjectDir);
            string fullPath = projectItem.GetFullPath();

            if (!String.IsNullOrEmpty(rootProjectDir) && !String.IsNullOrEmpty(fullPath))
            {
                projRelativePath = MakeRelativePath(fullPath, rootProjectDir);
            }

            return projRelativePath;
        }
开发者ID:huoxudong125,项目名称:MVC5-Scaffolder,代码行数:16,代码来源:ProjectItemUtils.cs

示例2: Add

        public void Add(ProjectItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            var path = item.GetFullPath();
            var existing = Lookup(path);

            if (existing == null)
            {
                this.files[MakeKey(path)] = item;

                Logger.WriteLine($"{item.Name} was added to the cache");
            }
        }
开发者ID:matt40k,项目名称:vs-net-dte,代码行数:17,代码来源:AssetCache.cs

示例3: OverwriteProjectItemTextContent

 private void OverwriteProjectItemTextContent(ProjectItem item, string text)
 {
     var path = item.GetFullPath();
     SolutionManager.EnsureCheckedOutIfExists(path);
     _fileSystem.WriteAllText(path, text);
 }
开发者ID:tikrimi,项目名称:MvcScaffolding4TwitterBootstrapMvc,代码行数:6,代码来源:InvokeScaffoldTemplateCmdlet.cs

示例4: UpdateGeneratedDtos

        private void UpdateGeneratedDtos(ProjectItem projectItem, INativeTypesHandler typesHandler)
        {
            OutputWindowWriter.Show();
            OutputWindowWriter.ShowOutputPane(dte);
            OutputWindowWriter.WriteLine("--- Updating ServiceStack Reference '" + projectItem.Name + "' ---");
            string projectItemPath = projectItem.GetFullPath();
            var selectedFiles = projectItem.DTE.SelectedItems.Cast<SelectedItem>().ToList();
            bool isDtoSelected = false;
            isDtoSelected = selectedFiles
                .Any(item => item.Name.ToLowerInvariant()
                    .EndsWith(typesHandler.CodeFileExtension));

            //Handle FSharp file extension name change for DTO files, eg .dto.fs to .dtos.fs
            if (!isDtoSelected && typesHandler is FSharpNativeTypesHandler)
            {
                isDtoSelected = selectedFiles
                .Any(item => item.Name.ToLowerInvariant()
                    .EndsWith(".dto.fs"));
            }

            if (isDtoSelected)
            {
                string filePath = projectItemPath;
                var existingGeneratedCode = File.ReadAllLines(filePath).Join(Environment.NewLine);

                string baseUrl;
                if (!typesHandler.TryExtractBaseUrl(existingGeneratedCode, out baseUrl))
                {
                    OutputWindowWriter.WriteLine("Unable to read URL from DTO file. Please ensure the file was generated correctly from a ServiceStack server.");
                    return;
                }
                try
                {
                    var options = typesHandler.ParseComments(existingGeneratedCode);
                    bool setSslValidationCallback = false;
                    //Don't set validation callback if one has already been set for VS.
                    if (ServicePointManager.ServerCertificateValidationCallback == null)
                    {
                        //Temp set validation callback to return true to avoid common dev server ssl certificate validation issues.
                        setSslValidationCallback = true;
                        ServicePointManager.ServerCertificateValidationCallback =
                            (sender, certificate, chain, errors) => true;
                    }
                    string updatedCode = typesHandler.GetUpdatedCode(baseUrl, options);
                    if (setSslValidationCallback)
                    {
                        //If callback was set to return true, reset back to null.
                        ServicePointManager.ServerCertificateValidationCallback = null;
                    }
                    using (var streamWriter = File.CreateText(filePath))
                    {
                        streamWriter.Write(updatedCode);
                        streamWriter.Flush();
                    }
                }
                catch (Exception e)
                {
                    OutputWindowWriter.WriteLine("Failed to update ServiceStack Reference: Unhandled error - " + e.Message);
                }

                OutputWindowWriter.WriteLine("--- Update ServiceStack Reference Complete ---");
            }
            else
            {
                OutputWindowWriter.WriteLine("--- Valid file not found ServiceStack Reference '" + projectItem.Name + "' ---");
            }
        }
开发者ID:quyenbc,项目名称:ServiceStackVS,代码行数:67,代码来源:ServiceStackVSPackage.cs

示例5: Remove

 public void Remove(ProjectItem projectItem)
 {
     this.Remove(projectItem.GetFullPath());
 }
开发者ID:matt40k,项目名称:vs-net-dte,代码行数:4,代码来源:AssetCache.cs

示例6: GenerateJsFileFromProjectItem

        private ViewModel GenerateJsFileFromProjectItem(ProjectItem item, bool fromCodeSnippet)
        {
            var fileExtension = Path.GetExtension(item.GetFullPath());
            var language = fileExtension.Equals(".cs") ? SupportedLanguage.CSharp : SupportedLanguage.VBNet;

            if (!item.Saved)
                item.Save();

            try
            {
                JsFile jsFile;

                if (fromCodeSnippet)
                {
                    dynamic comObject = item.Document.Selection;
                    jsFile = _codeGenerator.GetJsFileFromCodeSnippet(comObject.Text, language);
                }
                else
                {
                    jsFile = _codeGenerator.GetJsFileFromCodeFile(item.GetFullPath(), language);
                }

                return ViewModelExtensions.MapViewModelFromJsFile(jsFile);
            }
            catch (Exception)
            {
                _schell.Toast("Error parsing file");
            }

            return null;
        }
开发者ID:chinaniit,项目名称:KnockoutGenerator,代码行数:31,代码来源:KnockoutGeneratorPackage.cs

示例7: FindProjectItemByFullPath

        private static ProjectItem FindProjectItemByFullPath(ProjectItem projectItem, string fullPath)
        {
            if (projectItem != null && projectItem.GetFullPath() == fullPath)
                return projectItem;

            foreach (ProjectItem childItem in projectItem.ProjectItems)
            {
                var re = FindProjectItemByFullPath(childItem, fullPath);
                if (re != null)
                    return re;
            }

            return null;
        }
开发者ID:tyrant39001,项目名称:Tyrant,代码行数:14,代码来源:DesignerCodeGenerator.cs


注:本文中的ProjectItem.GetFullPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。