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


C# Core.GetBool方法代码示例

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


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

示例1: ExecuteAction

        public GeneratorActionResult ExecuteAction(GeneratorArguments arguments, Core.InputFields.ActionInputValues values, Dictionary<string, string> parameters)
        {
            var registerIis = values.GetBool("RegisterIis");
            var hosttName = values.GetString("HostName");
            var location = values.GetString("DestinationFolder");
            var umbracoRelativePath = parameters["umbracoRelativePath"];

            if (registerIis)
            {
                // Get IIS reference
                var serverManager = new ServerManager();

                // Create new AppPool or use existing
                var appPool = serverManager.ApplicationPools.FirstOrDefault(x => x.Name == arguments.Name) ??
                              serverManager.ApplicationPools.Add(arguments.Name);

                // Umbraco is .NET 4.0
                appPool.ManagedRuntimeVersion = "v4.0";

                // Add site and configure
                var physicalPath = System.IO.Path.Combine(location, umbracoRelativePath);
                serverManager.Sites.Add(arguments.Name, physicalPath, 80);

                serverManager.Sites[arguments.Name].ApplicationDefaults.ApplicationPoolName = arguments.Name;
                serverManager.Sites[arguments.Name].Bindings.Clear();
                serverManager.Sites[arguments.Name].Bindings.Add("*:80:" + hosttName, "http");
                serverManager.Sites[arguments.Name].ServerAutoStart = true;

                // Commit
                serverManager.CommitChanges();
            }

            return new GeneratorActionResult(true, "");
        }
开发者ID:bplasmeijer,项目名称:uMadeEasy,代码行数:34,代码来源:RegisterIisAction.cs

示例2: ExecuteAction

        public GeneratorActionResult ExecuteAction(GeneratorArguments arguments, Core.InputFields.ActionInputValues values, Dictionary<string, string> parameters)
        {
            var editHostsFile = values.GetBool("EditHostsFile");
            var hostName = values.GetString("HostName");

            if (editHostsFile)
            {
                // Create backup
                System.IO.File.WriteAllText(string.Concat(HostFileWriter.HostFilePath, ".backup"),
                                            System.IO.File.ReadAllText(HostFileWriter.HostFilePath, Encoding.UTF8),
                                            Encoding.UTF8);

                var hostEditor = new HostFileWriter();

                hostEditor.AddOrUpdateEntry(hostName, "127.0.0.1", String.Concat("Dev URL for ", arguments.Name));

                hostEditor.Save();
            }

            return new GeneratorActionResult(true, "");
        }
开发者ID:bplasmeijer,项目名称:uMadeEasy,代码行数:21,代码来源:EditHostFileAction.cs

示例3: RollbackAction

        public GeneratorActionResult RollbackAction(GeneratorArguments arguments, Core.InputFields.ActionInputValues values, Dictionary<string, string> parameters)
        {
            var registerIis = values.GetBool("RegisterIis");

            if (registerIis)
            {
                var serverManager = new ServerManager();

                var site = serverManager.Sites.FirstOrDefault(x => x.Name == arguments.Name);

                if (site != null)
                    serverManager.Sites.Remove(site);

                var appPool = serverManager.ApplicationPools.FirstOrDefault(x => x.Name == arguments.Name);

                if (appPool != null)
                    serverManager.ApplicationPools.Remove(appPool);

                // Commit
                serverManager.CommitChanges();
            }

            return new GeneratorActionResult(true, "");
        }
开发者ID:florisrobbemont,项目名称:uMadeEasy,代码行数:24,代码来源:RegisterIisAction.cs

示例4: RollbackAction

        public GeneratorActionResult RollbackAction(GeneratorArguments arguments, Core.InputFields.ActionInputValues values, Dictionary<string, string> parameters)
        {
            var editHostsFile = values.GetBool("EditHostsFile");

            if (editHostsFile)
            {
                if (System.IO.File.Exists(string.Concat(HostFileWriter.HostFilePath, ".backup")))
                {
                    // Replace backup
                    System.IO.File.WriteAllText(HostFileWriter.HostFilePath,
                                                System.IO.File.ReadAllText(string.Concat(HostFileWriter.HostFilePath, ".backup"), Encoding.UTF8),
                                                Encoding.UTF8);
                }
            }

            return new GeneratorActionResult(true, "");
        }
开发者ID:bplasmeijer,项目名称:uMadeEasy,代码行数:17,代码来源:EditHostFileAction.cs


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