コード例 #1
0
        public IISSiteWrapper(Site site)
        {
            var ftpSsl = !string.IsNullOrWhiteSpace(site.
                                                    GetChildElement("ftpServer")?.
                                                    GetChildElement("security")?.
                                                    GetChildElement("ssl")?.
                                                    GetAttributeValue("serverCertHash")?.
                                                    ToString());

            Site     = site;
            Bindings = site.Bindings.Select(x =>
            {
                var secure = x.Protocol == "https" || ((x.Protocol == "ftp") && ftpSsl);
                return(new IISBindingWrapper(x, secure));
            }).ToList();

            if (Bindings.All(b => b.Protocol == "ftp" || b.Protocol == "ftps"))
            {
                Type = IISSiteType.Ftp;
            }
            else if (Bindings.Any(b => b.Protocol == "http" || b.Protocol == "https"))
            {
                Type = IISSiteType.Web;
            }
        }
 BindingConfiguration GetConfiguredHttpBinding(EndpointConfiguration endpoint)
 {
     foreach (var b in Bindings.All())
     {
         if (b.Name == endpoint.BindingConfiguration)
         {
             return(b);
         }
     }
     return(Bindings.BasicHttpBinding [0]);
 }
コード例 #3
0
        private static void CreateBindings()
        {
            var files = Directory
                        .GetFiles($@"{BaseDirectory}\Bindings", "*.json")
                        .ToList();

            files.ForEach(file => Bindings.Add(File.ReadAllText(file).FromJson <Binding>()));
            var result = Bindings.All(b => b.Bind());

            if (!result)
            {
                File.WriteAllText($@"{BaseDirectory}\BindingErrors.txt", "Failed To Bind one or more items");
            }
            //  else File.WriteAllText($@"{BaseDirectory}\BindingErrors.txt", "No Errors");
        }
コード例 #4
0
            BindingConfiguration GetConfiguredHttpBinding(EndpointConfiguration endpoint)
            {
                if (Bindings.BasicHttpBinding.Count == 0)
                {
                    throw new InvalidOperationException("Binding configuration can be acquired only after loading is done.");
                }

                foreach (var b in Bindings.All())
                {
                    if (b.Name == endpoint.BindingConfiguration)
                    {
                        return(b);
                    }
                }
                return(Bindings.BasicHttpBinding [0]);
            }
コード例 #5
0
 private void ValidatePolicyVersion() =>
 GaxPreconditions.CheckState(Version <= 1 && Bindings.All(b => b.Condition == null),
                             "Helper methods cannot be invoked on policies with version {0} or with conditional bindings. For more information, see https://cloud.google.com/iam/docs/policies.", Version);