Пример #1
0
        public void AddExternalReference(string externalUrl, string location)
        {
            Uri url;

            if (Uri.TryCreate(externalUrl, UriKind.Absolute, out url))
            {
                modules.Add(Module.CreateExternalModule(externalUrl, location));
            }
            else
            {
                throw new ArgumentException("External URL must be an absolute URI.", "externalUrl");
            }
        }
Пример #2
0
        public void AddReference(string resourcePath)
        {
            var module = moduleContainer.FindModuleContainingResource(resourcePath)
                         ?? moduleContainer.FindModule(resourcePath.TrimEnd('/', '*'));

            if (module == null)
            {
                // The resourcePath may be an external URL.
                Uri url;
                if (Uri.TryCreate(resourcePath, UriKind.Absolute, out url))
                {
                    modules.Add(Module.CreateExternalModule(resourcePath, location: ""));
                }
                else
                {
                    throw new ArgumentException("Resource not found: " + resourcePath);
                }
            }
            else
            {
                modules.Add(module);
            }
        }