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


C# Project.GetDirectory方法代码示例

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


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

示例1: GetFileSystemManipulatorForEnvironment

        // FYI: VS SDK API for source control detection and support is really, really horrible.

        public static async Task<ISccBasicFileSystem> GetFileSystemManipulatorForEnvironment(Project project)
        {
            var dte = project.DTE;
            //if (!project.IsSourceControlled() && !dte.Solution.IsSourceControlled())
            //{
            //    return new NonSccBasicFileSystem();
            //}
            var detectedSccSystem = await DetectSccSystem(project);
            ISccBasicFileSystem result;
            switch (detectedSccSystem)
            {
                case "tfs":
                    result = new TfsExeWrapper(project.GetDirectory(), dte.GetLogger());
                    break;
                case "git":
                    result = new GitExeWrapper(project.GetDirectory(), dte.GetLogger());
                    break;
                case "hg": // not yet implemented
                    //result = null;
                    result = new NonSccBasicFileSystem();
                    break;
                case "svn": // not yet implemented
                    //result = null;
                    result = new NonSccBasicFileSystem();
                    break;
                case null:
                    result = new NonSccBasicFileSystem();
                    break;
                default: // not implemented
                    //result = null;
                    result = new NonSccBasicFileSystem();
                    break;
            }
            return result;
        }
开发者ID:freeart,项目名称:FastKoala,代码行数:37,代码来源:VsFileSystemManipulatorFactory.cs

示例2: DetectSccSystem

        private static async Task<string> DetectSccSystem(Project project)
        {
            // Did I mention? VS SDK API for source control detection and support is really, really horrible.

            var tfs = new TfsExeWrapper(project.GetDirectory(), VsEnvironment.Dte.GetLogger());
            if (await tfs.ItemIsUnderSourceControl(project.FullName)) return "tfs";
            return //await DetectSccSystem(project.GetDirectory())
                //?? 
                await DetectSccSystem(project.DTE.Solution.GetDirectory());
        }
开发者ID:sayedihashimi,项目名称:FastKoala,代码行数:10,代码来源:VsFileSystemManipulatorFactory.cs

示例3: DetectSccSystem

        private static async Task<string> DetectSccSystem(Project project)
        {
            // Did I mention? VS SDK API for source control detection and support is really, really horrible.

            var tfs = new TfsExeWrapper(project.GetDirectory(), VsEnvironment.Dte.GetLogger());
            var projectFilePath = project.FullName;
            if (string.IsNullOrWhiteSpace(projectFilePath)) return null;
            if (!projectFilePath.Contains("://") && File.Exists(projectFilePath))
            {
                try
                {
                    if (await tfs.ItemIsUnderSourceControl(projectFilePath))
                    {
                        return "tfs";
                    }
                }
                catch
                {
                    //var logger = VsEnvironment.Dte.GetLogger();
                    //logger.LogError(
                    System.Diagnostics.Debug.WriteLine(
                        "Something went wrong when checking to see if this file is under source control: "
                                    + projectFilePath, "Error");
                    var fileInfo = new FileInfo(projectFilePath);
                    var sb = new StringBuilder();
                    sb.AppendLine("Exists: " + fileInfo.Exists);
                    sb.AppendLine("IsReadOnly: " + fileInfo.IsReadOnly);
                    sb.AppendLine("Length: " + fileInfo.Length);
                    sb.AppendLine("Name: " + fileInfo.Name);
                    sb.AppendLine("Attributes: " + fileInfo.Attributes.ToString());
                    //logger.LogError("File details ...\r\n" + sb.ToString());
                    System.Diagnostics.Debug.WriteLine(sb.ToString());
                    //throw; //return "tfs"; // whatever
                }
            }
            var sccdir = project.DTE.Solution.GetDirectory();
            if (string.IsNullOrEmpty(sccdir)) sccdir = project.GetDirectory();
            return await DetectSccSystem(sccdir);
        }
开发者ID:freeart,项目名称:FastKoala,代码行数:39,代码来源:VsFileSystemManipulatorFactory.cs

示例4: DetermineCheckState

        private static bool? DetermineCheckState(Package package, Project project, string config, string filename)
        {
            var packageReferenceFile = new PackageReferenceFile(project.GetDirectory() + "/coapp.packages.config");

            foreach (var p in packageReferenceFile.GetPackageReferences().Where(p => p.CanonicalName.Name == package.CanonicalName.Name &&
                                                                                     p.CanonicalName.Flavor == package.CanonicalName.Flavor &&
                                                                                     p.CanonicalName.Architecture == package.CanonicalName.Architecture))
            {
                if (filename == null)
                    return true;

                if (config == null && p.Libraries.Any(l => l.Name == filename))
                    return true;

                if (p.Libraries.Any(l => l.ConfigurationName == config && l.Name == filename))
                    return true;
            }

            return false;
        }
开发者ID:henjuv,项目名称:coapp-vse,代码行数:20,代码来源:SolutionWalker.cs

示例5: ConfigureProject

        /// <summary>
        /// Configures the project for publishing.
        /// </summary>
        /// <param name="project">The project to configure.</param>
        /// <param name="settings">The settings.</param>
        /// <returns>
        /// true, if the configuration was modified; otherwise, false.
        /// </returns>
        private bool ConfigureProject(Project project, ProjectSettings settings)
        {
            if (settings != null)
            {
                var window = new ProjectSettingsWindow(project.Name, settings);

                // show dialog and modify settings
                bool? saveSettings = window.ShowDialog(Globals.GetMainWindowHandle());
                if (saveSettings.Value)
                {
                    settings.Save();

                    // file does NOT exist?
                    if (!settings.Exists())
                    {
                        // add to project
                        string projectDir = project.GetDirectory();
                        string filePath = settings.FilePath;
                        if (filePath.StartsWith(projectDir, StringComparison.OrdinalIgnoreCase))
                        {
                            ProjectItem item = project.ProjectItems.AddFromFile(filePath);
                            Logger.Log(" -> Settings file added to project '{0}'", project.Name);
                        }
                    }

                    return true;
                }
            }

            return false;
        }
开发者ID:ivan-korshun,项目名称:VS-PublishExtensions2013,代码行数:39,代码来源:PublishMenu.cs


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