NStub.CSharp.NamespaceDetector.PrepareNamespace C# (CSharp) Méthode

PrepareNamespace() private méthode

Prepares and caches a namespace.
private PrepareNamespace ( string ns ) : string
ns string The input namespace.
Résultat string
        private string PrepareNamespace(string ns)
        {
            var sel = this.correctedNamespaces[ns];
            if (sel != null)
            {
                return sel;
            }

            string result = ns;
            foreach (var ctdecl in this.namespaces)
            {
                var splitter = ctdecl.Split(new[] { this.ShortestNamespace }, StringSplitOptions.RemoveEmptyEntries);
                if (splitter.Length == 1)
                {
                    string combined = splitter[0];
                    if (combined.StartsWith("."))
                    {
                        combined = combined.Substring(1, combined.Length - 1);
                        if (ns.StartsWith(combined + "."))
                        {
                            result = "global::" + result;
                            break;
                        }
                    }
                }
            }

            this.correctedNamespaces[ns] = result;
            return result;
        }