CmisSync.Lib.Cmis.UiUtils.UiConvenienceExtenders.CreateFuzzyCredentials C# (CSharp) Метод

CreateFuzzyCredentials() публичный статический Метод

public static CreateFuzzyCredentials ( this normalCredentials ) : List
normalCredentials this
Результат List
        public static List<LoginCredentials> CreateFuzzyCredentials(this ServerCredentials normalCredentials) {
            var result = new List<LoginCredentials>();
            result.Add(new LoginCredentials {
                Credentials = normalCredentials
            });
            result.Add(new LoginCredentials {
                Credentials = new ServerCredentials {
                    Address = new Uri(normalCredentials.Address.ToString()),
                    Password = new Password(normalCredentials.Password.ToString()),
                    Binding = normalCredentials.Binding == BindingType.AtomPub ? BindingType.Browser : BindingType.AtomPub,
                    UserName = normalCredentials.UserName
                }
            });

            string[] bindings = {
                BindingType.Browser,
                BindingType.AtomPub
            };
            string[] browserSuffixes = {
                "/cmis/browser"
            };
            string[] atompubSuffixes = {
                "/cmis/atom11",
                "/cmis/atom"
            };

            // Extract protocol and server name or IP address
            string prefix = normalCredentials.Address.GetLeftPart(UriPartial.Authority);

            string[][] suffixes = {
                browserSuffixes,
                atompubSuffixes
            };

            for (int i = 0; i < bindings.Length; ++i) {
                // Create all suffixes
                for (int j = 0; j < suffixes[i].Length; ++j) {
                    string fuzzyUrl = prefix + suffixes[i][j];
                    result.Add(new LoginCredentials {
                        Credentials = new ServerCredentials {
                            Address = new Uri(fuzzyUrl),
                            Binding = bindings[i],
                            UserName = normalCredentials.UserName,
                            Password = new Password(normalCredentials.Password.ToString())
                        }
                    });
                }
            }

            return result;
        }
    }