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


C# Rule.HasProperty方法代码示例

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


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

示例1: AzureDriveInfo

 public AzureDriveInfo(Rule aliasRule, ProviderInfo providerInfo, PSCredential psCredential = null)
     : base(GetDriveInfo(aliasRule, providerInfo, psCredential))
 {
     Path = new Path {
         Account = aliasRule.HasProperty("key") ? aliasRule["key"].Value : aliasRule.Parameter,
         Container = aliasRule.HasProperty("container") ? aliasRule["container"].Value : "",
         SubPath = aliasRule.HasProperty("root") ? aliasRule["root"].Value.Replace('/', '\\').Replace("\\\\", "\\").Trim('\\') : "",
     };
     Path.Validate();
     Secret = aliasRule.HasProperty("secret") ? aliasRule["secret"].Value : psCredential != null ? psCredential.Password.ToString() : null;
 }
开发者ID:ericschultz,项目名称:devtools,代码行数:11,代码来源:AzureDriveInfo.cs

示例2: SetWDK

        private void SetWDK( Rule build , string platform )
        {
            // pick up any wdk settings from the build/wdk property
            var frechk = "fre";
            var target = "XP";

            var wdkProperty = build.HasProperty("wdk") ? build["wdk"] : null;

            if( wdkProperty != null ) {
                frechk = wdkProperty["frechk"] == null ? "fre" : wdkProperty["frechk"].Value;
                target = wdkProperty["target"] == null ? "xp" : wdkProperty["target"].Value;
            }
            // start with the directory for the wdk
            var ddkLocation = Path.GetDirectoryName(_wdksetenvcmd7600.GetFullPath());
            if( ddkLocation.EndsWith("bin")) {
                ddkLocation = Path.GetDirectoryName(ddkLocation);
            }

            if( ddkLocation.IndexOf(' ') > -1 ) {
                ddkLocation = "\"{0}\"".format(ddkLocation);
            }

            Environment.SetEnvironmentVariable("current_wdk_location", ddkLocation);

            var cmdline = ddkLocation;

            // set the free/checked flag
            switch( frechk.ToLower() ) {
                case "check":
                case "checked":
                case "chk":
                    cmdline += " chk";
                    Environment.SetEnvironmentVariable("current_wdk_freechk", "chk" );
                    break;

                default:
                    cmdline += " fre";
                    Environment.SetEnvironmentVariable("current_wdk_freechk",  "fre");
                    break;
            }

            // platform choice
            cmdline += " "+platform.NormalizePlatform();

            // target OS
            switch( target.ToLower() ) {
                case "wlh":
                case "lh":
                case "vista":
                case "server2008":
                case "2008":
                case "windows6":
                case "win6":
                case "6":
                    cmdline += " WLH";
                    Environment.SetEnvironmentVariable("current_wdk_target", "WLH" );
                    break;

                case "win7":
                case "7":
                case "win6.1":
                case "6.1":
                case "2008r2":
                case "r2":
                case "server2008r2":
                    cmdline += " WIN7";
                    Environment.SetEnvironmentVariable("current_wdk_target", "WIN7");
                    break;

                case "wnet":
                case "2003":
                case "server2003":
                case "5.2":
                case "win5.2":
                    cmdline += " WNET";
                    Environment.SetEnvironmentVariable("current_wdk_target", "WNET");
                    break;

                case "HAL":
                    cmdline += " HAL";
                    Environment.SetEnvironmentVariable("current_wdk_target", "HAL");
                    break;

                default:
                    cmdline += " WXP";
                    Environment.SetEnvironmentVariable("current_wdk_target", "WXP");
                    break;
            }

            Console.WriteLine(@"WDK COMMAND LINE: ""{0}"" {1} & set ", _wdksetenvcmd7600, cmdline );

            _cmdexe.Exec(@"/c ""{0}"" {1} & set ", _wdksetenvcmd7600, cmdline );

            foreach (var x in _cmdexe.StandardOut.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)) {
                var p = x.IndexOf("=");
                if (p > 0) {
                    Environment.SetEnvironmentVariable(x.Substring(0, p), x.Substring(p + 1));
                }
            }
        }
开发者ID:cristina2sabre,项目名称:devtools,代码行数:100,代码来源:pTkMain.cs

示例3: GetDriveInfo

        private static PSDriveInfo GetDriveInfo(Rule aliasRule, ProviderInfo providerInfo, PSCredential psCredential)
        {
            var name = aliasRule.Parameter;
            var account = aliasRule.HasProperty("key") ? aliasRule["key"].Value : name;
            var container = aliasRule.HasProperty("container") ? aliasRule["container"].Value : "";

            if (string.IsNullOrEmpty(container)) {
                return new PSDriveInfo(name, providerInfo, @"{0}:\{1}\".format(ProviderScheme, account), ProviderDescription, psCredential);
            }

            var root = aliasRule.HasProperty("root") ? aliasRule["root"].Value.Replace('/', '\\').Replace("\\\\", "\\").Trim('\\') : "";

            if (string.IsNullOrEmpty(root)) {
                return new PSDriveInfo(name, providerInfo, @"{0}:\{1}\{2}\".format(ProviderScheme, account, container), ProviderDescription, psCredential);
            }

            return new PSDriveInfo(name, providerInfo, @"{0}:\{1}\{2}\{3}\".format(ProviderScheme, account, container, root), ProviderDescription, psCredential);
        }
开发者ID:ericschultz,项目名称:devtools,代码行数:18,代码来源:AzureDriveInfo.cs


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